Question
Write a program (in java) that detects if there is a deadlock in the system by using a resource allocation graph. Your program should read
Write a program (in java) that detects if there is a deadlock in the system by using a resource allocation graph. Your program should read from a file the following inputs: the number of processes and the number of resources. For each process it should read four numbers: the number of resources it is currently holding, the IDs of resources it is holding, the number of resources it is currently requesting, the IDs of resources it is requesting. The output of the program should indicate if there is a deadlock in the system. In case there is, the program should print out the identities of all processes that are deadlocked. (For simplicity, consider there is only one instance of each resource.) A sample input:
2 2 //number of processes, number of resources
1 1 1 2 // 4 numbers for process 1
1 2 1 1 // 4 numbers for process 2
Output: Deadlock
***NOTE: Please clarify the steps and don't copy the answer from different questions exist here in Chegg because they are differen from this Q!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started