Skip to main content

Posts

Showing posts with the label OS

Deadlock: Cause and Prevention, All you need to know

Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process. There are 4 conditions necessary for the occurrence of a deadlock. 1. Mutual Exclusion: When two people meet in the landings, they can’t just walk through because there is space only for one person. This condition to allow only one person (or process) to use the step between them (or the resource) is the first condition necessary for the occurrence of the deadlock. 2. Hold and Wait: When the 2 people refuse to retreat and hold their grounds, it is called holding. This is the next necessary condition for the deadlock. 3. No Preemption: For resolving the deadlock one can simply cancel one of the processes for others to continue. But the Operating System doesn’t do so. It allocates the resources to the processors for as much time as needed until the task is completed. Hence, there is no temporary reallocation of resources....