A system has 4 processes and 5 allocatable resources. The current allocation…

2015

A system has 4 processes and 5 allocatable resources. The current allocation and maximum needs are as follows:

The smallest value of x for which the above system in safe state is __________ .

  1. A.

    1

  2. B.

    3

  3. C.

    2

  4. D.

    0

Attempted by 88 students.

Show answer & explanation

Correct answer: C

Solution using Banker's algorithm:

Step 1: Compute the Need for each process as Need = Maximum - Allocated.

  • Process A need = Maximum - Allocated = [0, 1, 0, 0, 2]

  • Process B need = [0, 2, 1, 0, 0]

  • Process C need = [1, 0, 3, 0, 0]

  • Process D need = [0, 0, 1, 1, 1]

Step 2: Let Available = [0, 0, x, 1, 1]. Test values of x from smallest upward to find the minimal x that yields a safe sequence.

  1. x = 0: Available = [0,0,0,1,1]. No process has all its needs ≤ Available (Process D needs 1 unit of the third resource but x = 0). So the system is unsafe for x = 0.

  2. x = 1: Available = [0,0,1,1,1]. Only Process D has needs that can be satisfied (it requires 1 of the third, 1 of the fourth, 1 of the fifth). After D completes, Available increases by D's allocation, enabling further progress. However, checking the resulting Available after subsequent completions shows at least one process still cannot obtain all required units in some orders, so x = 1 is not sufficient to guarantee a safe completion order for all processes.

  3. x = 2: Available = [0,0,2,1,1]. Now apply the Banker's safety check to find a finishing order. One valid safe sequence is:

    • 1) Process D can run first because Need D = [0,0,1,1,1] ≤ Available = [0,0,2,1,1]. After D finishes, Available becomes Available + Allocated(D).

    • 2) With the resources freed by D, another process's needs can be satisfied (for example, Process C or A depending on the intermediate Available). Continue picking a process whose needs are ≤ current Available, run it to completion, and add its allocation to Available.

    • 3) Repeat until all processes complete. For x = 2 a full finishing order exists, so the state is safe.

Conclusion: The smallest value of x that makes the system safe is 2.

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

Explore the full course: Mppsc Assistant Professor