Question Details

There are 5 processes in a system. The maximum number of records a process can take is 2. At a time, a process can take only a single resource and can free only a single resource. How many records are required to ensure deadlock-free execution ?

Show Answer

Correct Answer :

6

Solution :

The correct answer is 6.

To determine the minimum number of resources (records) required to guarantee a deadlock-free execution, we can apply the resource allocation principle for deadlock prevention.

Let:
- N be the number of processes in the system. Here, N=5.
- Ri be the maximum number of resources required by process i. Here, each process requires a maximum of 2 resources, so Ri=2 for all i.

To find the worst-case allocation where a deadlock can potentially occur, we consider the state where every process is allocated one resource less than its maximum requirement. In this state, no process can complete, and all processes are waiting for their remaining resource.

The maximum number of resources that can be allocated without satisfying any process's complete request is:
i=1N(Ri-1)

Substituting the given values:
(2-1)+(2-1)+(2-1)+(2-1)+(2-1)=5×1=5

If the system has only 5 resources, it is possible for each of the 5 processes to hold 1 resource and wait indefinitely for a second resource, resulting in a deadlock.

To guarantee that a deadlock will never occur, we must add at least 1 more resource to the system. This additional resource ensures that at least one process can acquire its maximum required resources, run to completion, and subsequently release all its held resources back to the pool for other processes to use.

Therefore, the minimum number of resources (records) required for deadlock-free execution is:
5+1=6

Unlock Our Free Library

Access expert-curated educational resources and study materials—completely free.

Ask AI Tutor
5 left
Q1 View Question & Options
AI Tutor is solving this question...
Reading question context & options...