DeadLocks

DeadLocks

If we talk about multiprogramming or multithreading environment, many processes may demand for a finite number of available resources. Now suppose that one process request some resources and if resources are not available at that time, the process enters in a waiting stage and when resources available, process use these resources but sometimes resources are held by other waiting processes than waiting process is never again able to change its state, this is called deadlocks.

This is common problems when we are writing any application in different programming languages.

It is important why deadlock occurs suppose there are two process (P1 and P2) and two resources (R1 and R2) with single instance.

Now P1 request R1 and R1is held by P2 and p2 request R2 and R2 is held by P1

Just like that

 

P1----P1 Request R1----- >R1--- P2 holds R1--- >P2---P2 request R2------ >R2---- P1 holds R2---- >P1

This is the situation of deadlock

Ebook Download
View all
Learn
View all