Question: To elaborate program (programming language you may choose free as you want) that determines if the system state is safe or unsafe. Let n be
To elaborate program (programming language you may choose free as you want) that determines if the system state is safe or unsafe.
Let n be the number of processes in the system and m be the number of resource types. Then we need the following data structures:
Available: A vector of length m indicates the number of available resources of each type. If Available[j] = k, there are k instances of resource type Rj available.
Max: An nm matrix defines the maximum demand of each process. If Max[i,j] = k, then Pi may request at most k instances of resource type Rj.
Allocation: An nm matrix defines the number of resources of each type currently allocated to each process. If Allocation[i,j] = k, then process Pi is currently allocated k instance of resource type Rj.
Need: An nm matrix indicates the remaining resource need of each process. If Need[i,j] = k, then Pi may need k more instances of resource type Rj to complete task.
Note: Need = Max - Allocation.
At the beginning program is asking for input information:
How many processes are executing in system now n
How many units of each systems recourse is available Available data structure
Maximum units of resource for each of running processes Max data structure
Then program is asking for:
how much recourse units of each type is currently allocated to each process Allocation data structure
how much recourse units each of process want to get now for utilization Need data structure
All input information would be presented as output programs information.
Program checks if it is possible to satisfied processes requests for safe systems stay. If it is possible then program gives comment safe state, otherwise comment unsafe state and completes executing.
Documentation of this task would consist:
The Banker's algorithm description (many resources types)
Program algorithm scheme (the block diagram for this algorithm)
Program source module
Program executing example
User instruction
Please do it correctly as in instructions. Use C++ or eclipse if you can.
Please write codes on word or something to be able to see codes clearly.
!!! there is already one anwers for this in chegg do not copy from there i need differnet one otherwise i will report !!!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
