Originally posted: 11/07/07
Note: With Corrected P3. 11/09/07

You are given a system with four resources, A B C and D.

At a given instance of time, all the resources have been given out 
except for 1 As, 5 Bs, 2 Cs and 0 Ds.

There are five processes running in the system at this point in time.

P0 claims that it will need at most 1 C and 2 Ds. 
It has currently been allocated 1 C and 2 Ds.

P1 claims that it will need at most 1 A, 7 Bs, and 5 Cs.
P1 currently has been allocated 1 A.

P2 claims that it will need at most 2 As, 3 Bs, 5 Cs and 6 Ds.
P2 currently has been allocated 1 A, 3 Bs, 5 Cs, and 4 Ds.

P3 claims that it will need at most 6 Bs, 5 Cs and 2 Ds.
P3 currently has been allocated 6 Bs, 3 Cs, and 2 Ds.

P4 claims that it will need at most 6 Bs, 5 Cs and 6 Ds.
P4 currently has been allocated 1 C and 4 Ds.

Problem 1: Show that the system is in a safe state? Show your work.

Problem 2: Given this system, P4 then requests 6 Bs. 
        Demonstrate whether this request should be granted. Show your work.

Problem 3: Use the results from Problem 2. P1 then requests 4 Bs and 2 Cs.
        Demonstrate whether this request should be granted. Show your work.

Problem 4: Use the results from Problem 3. P0 then requests 1 A.
        Demonstrate whether this request should be granted. Show your work.

Problem 5: Use the results from Problem 4. P2 then requests 1 A. 
        Demonstrate whether this request should be granted. Show your work.