Multiple choice

An operating system has 11 devices and has three processes P1, P2 and P3 with maximum resource requirements of 6, 4 and 9, respectively. There are two states of allocation of devices, as follows: State 1 - Processes P1, P2, P3 have devices allocated 3, 3, 4, respectively. State 2 - Processes P1, P2, P3 have devices allocated 2, 2, 6, respectively.

Which of the following is correct?

  1. State 1 is safe and state 2 is unsafe

  2. Both state 1 and state 2 are safe

  3. Both state 1 and state 2 are unsafe

  4. Only state 1 is unsafe

  5. Only state 2 is safe

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

 
 
  For state 1 Max - P1 : 6 P2 : 4 P3 : 9
Allocated - P1 : 3 P2 : 3 P3 : 4 Need - P1 : 3 P2 : 1 P3 : 5 Total tape drives = 11 Total allocated = 3+3+4= 10 Available = 11 - 10 = 1 then P2 can get 1 more device and it finishes its job, and returns 3 devices to the system. Then the system will have 4 free devices. P1 gets 3 tape drives and finishes its job. P3 then returns all 6 drives to the system.Then P3 can get 5 more devices and it does its job. P3 returns  9. Hence, in the end total drives are 11. Hence, state 1 is safe.
 
 For state 2  Max - P1 : 6 P2 : 4 P3 : 9 Allocated - P1 : 2 P2 : 2 P3 : 6 Need - P1 : 4 P2 : 2 P3 : 3 Total tape drives = 11 Total allocated = 2+2+6= 10 Available = 11 - 10= 1. Here, total available devices is 1 and need are 4, 2 and 3. So, system can not fullfill any request. Hence, state 2 is unsafe.