Process vs thread, and what causes a deadlock
How the interviewer asks it
“Explain the difference between a process and a thread. Then describe a deadlock with a simple example and the four conditions that cause it.”
Typed drills are free and unlimited: the AI scores your answer against the outline below.
What the interviewer is looking for
- Processes have separate memory; threads share their process's memory.
- A clear two-lock deadlock example.
- All four conditions: mutual exclusion, hold and wait, no preemption, circular wait.
- A practical prevention, such as always taking locks in the same order.
How to structure your answer
- 01
Process vs thread
Memory, creation cost, communication and what happens when one crashes.
- 02
Example
Thread A holds lock 1 and waits for lock 2; thread B holds lock 2 and waits for lock 1.
- 03
Four conditions
Name each and show where it appears in the example.
- 04
Prevention
Break one condition: global lock ordering, timeouts with try-lock, or acquiring all locks at once.
Best answers from candidates
No candidate answers yet. Type yours, and if it scores 6 or more you can show it here without your name.
Answers are shared by candidates, without names, after a privacy check. Add yours
Common mistakes
- Confusing deadlock with starvation or a race condition.
- Listing the conditions without linking them to the example.
- Saying "just remove the locks".
Follow-up questions to expect
- How would you prevent the deadlock in your example without removing the locks?
- What is the difference between deadlock avoidance and prevention?
Now answer it out loud
Max will ask you this exact question, listen to your answer, push on the weak spots with follow-ups like the ones above, and score you when you finish.
Practice with MaxFree: a 5-minute voice round and unlimited typed drills, with scored feedback. No card, and your camera is never recorded.
More campus placement interview questions
Preparing for this round? Read how to answer “tell me about yourself” as a software engineer and hR interview questions for freshers, with sample answers and campus placement interview preparation: a guide for final-year students.