C++/Deadlock Detection program in C++
I am having trouble figuring out ohow to construct the following C++ program based on these instructions:
Design a program that can detect deadlocks in a resource graph.
Your program should have a menu system with two options:
1. Construct a resource graph
2. Detect deadlocks
If user selects 1, you program should prompt for further inputs as followings.
If user answer for More is ‘N' then your program will go back to main menu. Otherwise continue adding more nodes to the resource graph.
When user selects 2, you start to search for a deadlock.
Your program should utilize the following data structure
If you detect a deadlock, you should print program will try to find a deadlock within the resource graph the content of L so that L contains the deadlock set.
Any help you can provide me with constructing this C++ program will be apprreciated. Thanks.
Hello Shawn, thanks for the question.
I'm not sure exactly what you mean by detecting a deadlock. What you can do to prevent data corruption and deadlocks is to use a CRITICAL_SECTION object. If you go to the MSDN and look up the help for CRITICAL_SECTION, I'm sure it will be more than adequate for accomplishing what you want to do. If you do not have a copy of the MSDN it can be found online at msdn.msn.com I believe.
I hope this information was helpful.