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 _________?

Options

A

6

B

8

C

2

D

5

Show Answer

Correct Answer :

Option A

6

Solution :

The correct option is 6.

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

Let:
- The number of processes be P.
- The maximum demand of resources for each process i be Ri.
- The total number of resources in the system be R.

Here, we are given:
- Number of processes, P = 5
- Maximum resource requirement for each process, R i = 2 for all processes.

A deadlock occurs in the worst-case scenario when every process has acquired one less than its maximum requirement and is waiting for one more resource. In this state, all processes are blocked, and no progress can be made.

To find this worst-case allocation where deadlock is just about to occur, we allocate R i - 1 resources to each process:
Max resources allocated without completing any process = i = 1 P ( R i - 1 )

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

If we have exactly 5 resources, each of the 5 processes can hold 1 resource. Since each process needs 2 resources to finish, they will all wait indefinitely for another resource, resulting in a deadlock.

To ensure a deadlock-free execution, we must add at least 1 more resource to the system. This extra resource will allow at least one process to satisfy its maximum demand, complete its execution, and release all of its held resources back to the pool for other processes to use.

Thus, the minimum number of resources R required to guarantee deadlock-free execution is:
R i = 1 P ( R i - 1 ) + 1
R 5 + 1 = 6

Therefore, a minimum of 6 records are required to ensure deadlock-free execution.

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...