Question: Banker s Algorithm, written in C For this project, you will write a program that implements the banker s algo - rithm discussed in Section
Bankers Algorithm, written in C
For this project, you will write a program that implements the bankers algorithm discussed in Section Customers request and release resources from the bank. The banker will grant a request only if it leaves the system in a safe state. A request that leaves the system in an unsafe state will be denied. Write this program in C
The Banker
The banker will consider requests from n customers for m resources types, as outlined in Section The banker will keep track of the resources using the following data structures:
#define NUMBER OF CUSTOMERS
#define NUMBER OF RESOURCES
the available amount of each resource
int availableNUMBER OF RESOURCES;
the maximum demand of each customer
int maximumNUMBER OF CUSTOMERSNUMBER OF RESOURCES;
the amount currently allocated to each customer
int allocationNUMBER OF CUSTOMERSNUMBER OF RESOURCES;
the remaining need of each customer
int needNUMBER OF CUSTOMERSNUMBER OF RESOURCES;
The banker will grant a request if it satisfies the safety algorithm outlined in Section If a request does not leave the system in a safe state, the banker will deny it Function prototypes for requesting and releasing resources are as follows:
int request resourcesint customer num, int request;
void release resourcesint customer num, int release;
The request resources function should return if successful and if unsuccessful.
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
