Consider a system with twelve magnetic tape drives and three processes ๐‘ƒ1,๐‘ƒ2โ€ฆ

2015

Consider a system with twelve magnetic tape drives and three processesย ๐‘ƒ1,๐‘ƒ2ย andย ๐‘ƒ3. processย ๐‘ƒ1ย requires maximum ten tape drives, processย ๐‘ƒ2ย may need as many as four tape drives andย ๐‘ƒ3ย may need upto nine tape drives. Suppose that at timeย ๐‘ก1, processย ๐‘ƒ1ย is holding five tape drives, processย ๐‘ƒ2ย is holding two tape drives and processย ๐‘ƒ3ย is holding three tape drives, At timeย ๐‘ก1, system is in:

  1. A.

    safe state

  2. B.

    unsafe state

  3. C.

    deadlocked state

  4. D.

    starvation state

Attempted by 82 students.

Show answer & explanation

Correct answer: B

Compute available resources and remaining needs.

Total tape drives = 12. Allocated: P1 = 5, P2 = 2, P3 = 3. Available = 12 - (5 + 2 + 3) = 2.

  • Remaining need for P1 = maximum 10 - allocated 5 = 5

  • Remaining need for P2 = maximum 4 - allocated 2 = 2

  • Remaining need for P3 = maximum 9 - allocated 3 = 6

Apply the Banker's safety check:

  1. With 2 available, the process that needs 2 can finish (P2). After it finishes it releases its 2 allocated drives, so available becomes 4.

  2. Now available = 4, but the other processes need 5 and 6 respectively. Neither can finish with 4 available, so no sequence allows all processes to finish.

Therefore the system is in an unsafe state.

Note: Unsafe means there is no guaranteed safe sequence for all processes; it is not the same as deadlock. This situation is not deadlocked because at least one process can finish immediately, but the system is still unsafe.

A video solution is available for this question โ€” log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor