Question: Homework 4 Banker s algorithm Implement the Banker's algorithm for deadlock avoidance, with a given set of N processes ( N < 1 0 ,
Homework Bankers algorithm
Implement the Banker's algorithm for deadlock avoidance, with a given set of N processes
N processes are P P PN and M resource types M resources are R R RM Use Java or
CC for the implementation, with a simple interface, where the user only supplies the name of the
input file text file, say inputtxt The program reads all the necessary input data from that file. You
are free to choose the format of the input file, just make sure it contains all the necessary data. The
input data and the result of the algorithm must be displayed on the screen.
The pseudo code for the Greedy version for the Bankers algorithm can be found in this modules
Commentary. We know that this algorithm only finds ONE solution safe sequence of processes
assuming there is one; otherwise reports there is no solution.
You must adjust this algorithm to find exactly TWO solutions instead of just one assuming of course
there are at least two solutions If the algorithm only has one solution this must be reported as such
and the single solution must be displayed.
To resume, there are only three possible scenarios, for a correct input file:
There is no solution no safe sequence The program must report there is no solution.
There is EXACTLY ONE solution safe sequence The program must report there is exactly one
solution. The solution must be displayed on screen.
There are TWO OR MORE solutions safe sequences The program must find EXACTLY TWO
solutions. The solutions must be displayed on screen. If there are more than two solutions, it
doesnt matter which ones are found, as long as they are exactly two.
Note : the solution must be based on the Greedy version for the Bankers algorithm; in particular, using
an approach for finding ALL solutions and then keeping and reporting just two of them is NOT allowed.
Note : The input file may be incorrect, for various reasons. This must be checked and reported by your
program before any attempt of finding a solution.
HINTS:
The input files should start with N and M then the necessary matrices
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
