1.

What do you understand about a deadlock in the context of operating systems? What are the necessary conditions for a deadlock?

Answer»

A deadlock occurs when a group of processes is halted because each process is holding a resource and waiting for another process to obtain it.

Consider the situation when two trains are approaching each other on the same TRACK and there is only one track: once they are in front of each other, neither train can move. In operating systems, a similar situation happens when two or more processes hold some resources while waiting on resources owned by other processes (s). 

For example, let us assume that there are two trucks trying to cross a one-way bridge from opposite ends. NONE of the trucks is ready to move back and neither can any of them cross the bridge. In this situation, a deadlock has been obtained.

Following are the necessary conditions for a deadlock :

  • MUTUAL Exclusion: One or more resources are not available for sharing. That is, only one process can use the resource at a time.
  • Hold and Wait: A process is holding at least one resource and waiting for further resources.
  • No Preemption: A resource can only be obtained from a process if it is released by the process. There can be no FORCED SNATCHING of the resources.
  • Circular Wait: A group of processes are waiting for each other in a circular fashion.


Discussion

No Comment Found