📖 7. Deadlocks
📖 From Operating System • 880 questions available
About 7. Deadlocks
A deadlock is a situation where two or more processes are stuck, waiting for each other to release a resource, and as a result, none of them can proceed. Imagine two cars arriving at an intersection from different directions, each waiting for the other to go. They are stuck forever unless an external force intervenes. In a computer, this happens when, for example, Process A has a file and needs a printer, while Process B has the printer and needs the same file. Both are waiting, and neither can finish.
For a deadlock to occur, four specific conditions must be met: mutual exclusion (resources cannot be shared), hold and wait (a process holds resources while waiting for others), no preemption (resources cannot be forcibly taken away), and circular wait (a cycle of processes each waiting for the next). The OS can deal with deadlocks in three ways: by preventing one of these conditions, by avoiding them using careful planning (like an algorithm), or by detecting them and recovering (for example, by forcibly terminating one of the processes). The goal is to ensure that the system doesn't grind to a halt.
Practice MCQs for 7. Deadlocks. Test your knowledge with carefully crafted questions across easy, medium, and hard difficulty levels.
🔄 Last updated: 2026-07-11