A system contains three programs and each requires three tape units for its…

2014

A system contains three programs and each requires three tape units for its operation. The minimum number of tape units which the system must have such that deadlocks never arise is _________.

Attempted by 144 students.

Show answer & explanation

Correct answer: 7

Key idea: If there are n programs and each may need up to m tape units, deadlock can be avoided only if the total number of tape units R satisfies R ≥ n·(m−1)+1.

Reasoning for this problem:

  • If there were only 6 tape units, each of the three programs could hold 2 units (since each needs 3) and then wait for one more unit. That would be 3 × 2 = 6 units held and every program waiting — a deadlock.

  • With 7 tape units, at least one program can obtain all 3 units it needs, finish, and release its units. Those released units can then be used by others, so a circular wait (deadlock) cannot persist.

  • Applying the formula with n = 3 and m = 3 gives 3·(3−1)+1 = 3·2+1 = 7.

Answer: 7 tape units.

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

Explore the full course: Gate Guidance By Sanchit Sir