Deadlocking in Concurrent and Distributed system

 There are 5 resources, A, B, F, G, I, each of which can be acquired and released. There are two resource-user (or thread) types S and T.

 Each instance of S repeatedly executes this code sequence: It acquires I, then A, and then G. It releases A and G. It acquires B. It releases I and then B. 

Each instance of T repeatedly executes this code sequence: It acquires G and then F It releases G It acquires A It releases F and then A 

a) How many instances of S does it take to create deadlock if there are no instances of T? 

b) How many instances of T does it take to create deadlock if there are no instance of S?

c) There are instances of S and of T. How many instances of S and how many instances of T does it take to create deadlock? Note: In some cases, no deadlock is possible no matter how many instances/threads there are. 

Tags: No tags