In this assignment, you implement a multi-threaded program to simulate the Banker's Algorithm (pseudo code in Textbook). There are 10 threads in the system with a maximum possible requests for a common resource. Each thread keeps requests some random number of resources (between 1 to maximum) from the system. A thread sleeps some time between requests to simulate the execution of tasks after acquiring all the necessary resources. Use Banker's Algorithm to make sure the system is always in safe state.
Parameters:
MAX units: the total number of unit is 8.
MAX claims: each thread can request up to 6 units of the resource.
Report: you should write a 2-3 page report that includes
The basic structure of your program
Some curves for the performance of the program. For example, relationship between throughput (#jobs completed) and sleeping time, relationship between throughput (#jobs completed) over time, etc.
Justification of your results.
Submission:
Should zip everything into one file, including source code, report, and README
README should detail operating system, version of C++ or thread library, comand to compile/run your program.
BONUS:
10% for including 2 resources in the system or 15% for including 5 resources in the system
10% for implementing Lock Ordering with 5 resources.
I remember performing the bankers algorithm by hand in university. I never got to program it but would enjoy the chance to. I will write a generic program that can scale to an arbitrary number of resources and threads. It will be able to read in the resource configuration from a file and record the results it produces.