Skip to content
GATEiit

GATE CSE 2018 Q49: Banker's algorithm safety check for four processes and resources E, F, G

Syllabus topic: Deadlock

Question

In a system, there are three types of resources: E, F and G. Four processes P0, P1, P2 and P3 execute concurrently. At the outset, the processes have declared their maximum resource requirements using a matrix named Max as given below. For example, Max[P2,F] is the maximum number of instances of F that P2 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 3 instances of E and 3 instances of F are the only resources available.

Allocation
EFG
P0101
P1112
P2103
P3200
Max
EFG
P0431
P1214
P2133
P3541

From the perspective of deadlock avoidance, which one of the following is true?

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 2/3 mark in GATE.
Show answer and explanation

Answer: A (official GATE 2018 final answer key)

Concept used: Banker's safety algorithm: a state is safe if some order lets every process obtain its remaining need (Max − Allocation) from the available pool and then release its allocation.

Concept notes

Loading notes…

First step: Compute Need = Max − Allocation for each process and look for one whose need fits in Available = (3, 3, 0).

Full step-by-step solution

Loading…

Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.

More questions on Deadlock

Every PYQ on this topic →

Share this question

WhatsAppDownload image

Source: official GATE 2018 CS question paper and final answer key, organised by IIT Guwahati. Question paper · Answer key