Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Review the banker's algorithm discussed in class. Your program must be named banker and will read the allocation, max, available, and request vectors from a

Review the banker's algorithm discussed in class. Your program must be named "banker" and will read the allocation, max, available, and request vectors from a file. The name of the file will be passed to your program as a command line argument. The input file format is the following:
number of processes: n
number of resource types: m
An n x m allocation matrix
An n x m max matrix
A 1 x m available vector
A i : 1 x m request vector
Your program will output the following in a standardized format.
Echo the number of processes.
Echo the number of resource types.
Echo the allocation matrix. Label the processes and resource types (see sample output).
Echo the max matrix. Label the processes and resource types (see sample output).
Compute and print the need matrix. Label the processes and resource types (see sample output).
Echo the available vector. Label the resource types.
Compute if the system is in a safe state.
Echo the request vector. Label the process making the request and resource types (see sample output).
Compute if the request can be granted.
Compute the new available vector (see sample output).
Please show how this can be done in python, and c++.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started