





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















A deadlock P1 P2 P R R R2 R
Safe Unsafe Deadlocked Start End
Still Needs Currently Allocated Max. Needs
Current State: Free = (12 – (5 + 2 + 2)) = 3 This state is safe because, there is a sequence (P followed by P0 followed by P2) by which max needs of each process can be satisfied. This is called the reduction sequence. Free = 3 After reducing P1, Free = 5 After reducing P0, Free = 10 Then reduce P2.
Banker’s algorithm for deadlock avoidance
5 processes, 3 resource types A (10 instances), B (5 instances), C (7 instances) P4 4 3 3
MaxNeeds Allocated StillNeeds Free This state is safe, because there is a reduction sequence <P1, P3, P4, P2, P0> that can satisfy all the requests. Exercise: Formally go through each of the steps that update these matrices for the reduction sequence.
If P1 requests 1 more instance of A and 2 more instances of C can we safely allocate these? – Note these are all allocated together! and we denote this set of requests as (1,0,2) If allocated the resulting state would be: P4 4 3 3
MaxNeeds Allocated StillNeeds Free This is still safe since there is a reduction sequence <P1,P3,P4,P0,P2> to satisfy all the requests. (work this out!) Hence the requested allocations can be made.