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.
Saved automatically
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:
- Mutual Exclusion: At least one resource must be held in a non-shareable mode.
- Hold and Wait: A process must be holding at least one resource and waiting to acquire additional resources held by others.
- No Preemption: Resources cannot be forcibly confiscated from a process holding them.
- 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.
Related Questions in Computer Networks & OS
What happens under the hood during the TCP 3-Way Handshake and 4-Way Termination?
Intermediate level • 62 views
What is the difference between Docker Containerization and Kubernetes Container Orchestration?
Intermediate level • 59 views
What is virtual memory, and why is it useful even when a system has enough RAM?
Easy level • 59 views
How does a process differ from a thread?
Easy level • 58 views
What happens step-by-step during a DNS Lookup when typing a URL into the browser?
Intermediate level • 57 views