Search your topic here

Unsafe state in os

UNSAFE STATE IN OS:

Consider a system with twelve magnetic tape drives and three processes p1,p2 and p3. Process p1 requires maximum ten tape drives, process p2 may need as many as four tape drives and p3 may need upto nine tape drives. Suppose that at time t1, process p1 is holding five tape drives, process p2 is holding two tape drives and process p3 is holding three tape drives. At time t1, system is in :

Processes
Maximum needs
Current needs
P1
10
05
P2
04
02
P3
09
03

Total number of magnetic tapes = 12
Already allocated magnetic tapes = 10
So, number of free magnetic tapes = 12 – 10 =2

From the above table,
Process P2 requires 2 more tapes for completion and since two tapes are free, they are allocated to process P2. Then, number of free tape drives = 4.

Since process P1 is allocated 5 tape drives, and has a maximum of 10, P1 may then request 5 more tape drives. Since only 4 tape drives are available, so, process P1 must wait.

Similarly, process P3 may request an additional 6 tape drives and have to wait.

Here process P1 and P3 both required the resource, but there is not proper availability of resource.


Its known as Unsafe State, which also leads to Deadlock. But Unsafe state means not occurence Deadlock each time.

LEAVE A REPLY










Related topics

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.