Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use c++ or python Requirement Simulate the Banker's algorithm Suppose we have 3 resources, 5 processes For a given input of resource total number (Total

use c++ or python
image text in transcribed
image text in transcribed
image text in transcribed
Requirement Simulate the Banker's algorithm Suppose we have 3 resources, 5 processes For a given input of resource total number (Total vector) current resource allocation state (Allocation matrix) each maximization request (Max matrix) Determine whether deadlock will happen? If no deadlock, give a safe sequence of the processes. Implement in any programming language you prefer Refer to Chapter06 for details of the banker's algorithm General steps of the program You can read the inputs from either the command line or a (1) Let the user input the necessary data file Total vector: Total resource numbers Max matrix: Maximum required resources of each process Allocation matrix: Allocated resources to each process (2) Calculate the Need and Available data Need matrix: resources still need by each process Available vector: resources can be allocated (3) Determine whether the current state is safe or not If yes, print the safe sequence Sample input Total vector You can let the user input the total resources like below Total vector = [3 2 2] Please input the total resources of type 1: 3 Please input the total resources of type 2: 2 Please input the total resources of type 3: 2 Sample input - Max matrix Please input the Max resources of type 1 for process 1: 7 Please input the Max resources of type 2 for process 1: 5 Please input the Max resources of type 3 for process 1: 3 You can let the user input the maximum required resources shown in below table like this Max 7 5 3 3 2 2 9 0 2 2 2 2 4 3 3 Please input the Max resources of type 1 for process 2: 3 please input the Max resources of type 2 for process 2: 2 please input the Max resources of type 3 for process 2: 2 Please input the Max resources of type 1 for process 3: 9 please input the Max resources of type 2 for process 3: e Please input the Max resources of type 3 for process 3: 2 Please input the Max resources of type 1 for process 4: 2 Please input the Max resources of type 2 for process 4: 2 Please input the Max resources of type 3 for process 4: 2 Please input the Max resources of type 1 for process 5: 4 Please input the Max resources of type 2 for process 5: 3 lease put the Max resources of type 3 for process 3 The Allocation matrix is similar

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

Students also viewed these Databases questions

Question

=+What is the most that you should pay to complete development?

Answered: 1 week ago

Question

=+development and make the product, should you go ahead and do so?

Answered: 1 week ago