A system of four concurrent processes, P, Q, R and S, use shared resources A,…

PYQ GATE 1989Modified — slightly modified from the official paper; see the solution

A system of four concurrent processes, P, Q, R and S, use shared resources A, B and C. The sequences in which processes, P, Q, R and S request and release resources are as follows:

Process P: requests A; requests B; releases A; releases B.

Process Q: requests C; requests A; releases C; Q releases A.

Process R: requests B; requests C; releases B; releases C.

Process S: requests A; requests C; releases A; releases C.

If a resource is free, it is granted to a requesting process immediately. There is no preemption of granted resources. A resource is taken back from a process only when the process explicitly releases it.

(i) Can the system of four processes get into a deadlock? If yes, give a sequence (ordering) of operations (for requesting and releasing resources) of these processes which leads to a deadlock.

(ii) Will the processes always get into a deadlock? If your answer is no, give a sequence of these operations which leads to completion of all processes.

(iii) What strategies can be used to prevent deadlocks in a system of concurrent processes using shared resources if preemption of granted resources is not allowed?

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…