In a system, there are three types of resources: and . Four processes , , and execute concurrently. At the outset, the processes have declared their maximum resource requirements using a matrix named Max as given below. For example, Max[] is the maximum number of instances of that would require. The number of instances of the resources allocated to the various processes at any given state is given by a matrix named Allocation.
Consider a state of the system with the Allocation matrix as shown below, and in which instances of and instances of are only resources available.
From the perspective of deadlock avoidance, which one of the following is true?
View worked solution
Answer: A
To determine if the system is in a safe state, we first calculate the Need matrix using the formula:
Let's compute the Need for each process:
The initial available resources are: .
We can find a safe sequence by checking which processes can satisfy their needs with the current available resources:
- Step 1: Both and have needs that can be satisfied by the available resources . Let's execute first.
After finishes and releases its resources: - Step 2: Now, only can be satisfied because .
After finishes and releases its resources: - Step 3: Now, can be satisfied because .
After finishes and releases its resources: - Step 4: Finally, can be satisfied because .
After finishes and releases its resources:
Since a complete safe sequence exists, the system is in a safe state.
Free practice · Your answers on this page are not saved.
