Verified Jobs Live
Computer Networks & OS Intermediate Level ~4 min read

What is a Process vs a Thread, and what are the causes and conditions of a Deadlock?

Quick Revision Summary

Processes have isolated memory spaces; threads share memory within a process. Deadlocks require Mutual Exclusion, Hold & Wait, No Preemption, and Circular Wait.

Interactive Practice Mode
Formulate your thoughts or take notes before revealing the model solution.
Model Answer & Deep-Dive Explanation

Process vs Thread:

  • Process: Independent execution unit with its own dedicated virtual address space, file descriptors, and security context. Inter-process communication (IPC) requires sockets, pipes, or shared memory.
  • Thread: Lightweight execution unit within a process. Threads share the process's heap, code segment, and global variables, but have their own independent Stack and Program Counter.

Coffman's Four Deadlock Conditions:

  1. Mutual Exclusion: At least one resource must be held in a non-shareable mode.
  2. Hold and Wait: A process must be holding at least one resource and waiting to acquire additional resources held by others.
  3. No Preemption: Resources cannot be forcibly confiscated from a process holding them.
  4. Circular Wait: A closed chain of processes exists such that each process holds at least one resource needed by the next.

Interviewer Evaluation Points & Scoring Rubric

  • 1 1. Differentiates memory isolation between processes and threads. 2. Names all 4 Coffman conditions. 3. Mentions deadlock prevention strategies.