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 is the architectural difference between Docker Containers and Virtual Machines (VMs)?
Beginner level • 1 views
What is the difference between 'git merge' and 'git rebase', and when should each be used in a team workflow?
Beginner level • 1 views
What is the difference between Docker Containerization and Kubernetes Container Orchestration?
Intermediate level • 1 views
What happens step-by-step during a DNS Lookup when typing a URL into the browser?
Intermediate level • 1 views
Explain Linux File Permissions, Inodes, and the difference between Hard Links and Symbolic Links.
Intermediate level • 1 views