Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

its an operating system question Instructions 1. It is an individual assignment 2. Late sul si penalty will be applied 3. This is part of

its an operating system question
image text in transcribed
image text in transcribed
Instructions 1. It is an individual assignment 2. Late sul si penalty will be applied 3. This is part of the work in assignment 3 you will continue this work 4. Read carefully the description below and provide a sac page report explaining the idea of the assignment and the expected solutit. You need ale to provide a flowchart To be submitted: Expx your answers and upload a PDF file. Ne hand writing to be used! Add a screenshot of the flowchart to your PDF file. 6. Add a cover letter stating your group members artike Homework Description A bank came allocate is available cash in a way they actors' meets are sened leaving the rest of the customers' needs sed. You are tasked with designing a banking system that includes 1) multithreading, 2) presents a conditional vids deadlock A bank shall receive many customers and their requests and will des coolingly making sure that the request loves the system is a safe stately whics that a request leaving in an unsafe sta will be denied The starter code with comments will be printed to you byendo . Yemed follow the format provided when vingeigement Handling. Reguests If a new process enters the system, the bank must first check that the mer of resources requested by the process does not exceed the wailable serce. If therested number does not exceed the availability then the bank shall all these to the process in the state of the bank wilt be safe. Otherwise this request must be died and shall water press release cough resources Maintained data structures The data structures (assemaphos) maintain the date of this ci system. The following data structures shall be maintained in order to have a functional banking system N will be the mamber of processes customers Mwill be the number of resource typer Available array of length to this captures the total of each one type available 1.6. Availablem will contain the number of available resources of typem. Man bym matrix that will capture the total number of res of each of types requested by the process such that the number of resources allotted to the proces shall not read the Maximequested by the process Allocation by mmatris dat will capture the al mercach of types allocated to the proces nie. Allocation will hold theme of res of typem allocated to proces Need a bym matrix that will capture the total number of revences et cachem types that are yet to be allocated to the process nie. Needlm will hold the forces of type mtu are yet to be allocated to process in order to complete the request ime: Nood-Max Allocation) Request: urray of required number of each type of source generated by the customer head. The size should not exceed the total types of resources available at the bank Safety Aborithm You have to develop this principle algorithm to check if them is adest. You have to check if all the resources requested by the processes are satisfied A system is safe if the following conditions are reached 1. If all the sotal number of records of each type required by anal contemer head 2. If all the customer threads are served and the process is finished Course System Course Code 21 Page Resource-Request Allocation: You have to develop this principle algorithm which checks for the following: 1. The total number of resources of each type requested by the customer thread should not exceed the Need, if it does then raise an error. 2. If the total number of resources of each type requested by the customer thread should not exceed the Available, else the customer thread must wait 3. If the above two conditions are satisfied then resources are allocated to the customer thread by the bank, and the state of the bank and the customer are updated. The Bank: The bank will accept requests from n customers for m resource types as described above (Ch.7. Section 7.5.3). The banker will keep a record of the resources using Available, Max, Need, and Allocation data structures The Customers: Create n customer threads that will request and release resources of the bank. The customers will continually loop, requesting and releasing resources randomly. The customer requests for resources will be limited by the Need matrix. The request will be granted to the customer thread if the safety algorithm mentioned above is satisfied. If the request would put the system in an unsafe position, then the request will be denied Utilize the following functions: int request_resource(int cust_id, int request[]): int release_resource(int cust_id, int relacase[]); Return values of the above functions will be o if successful and -1 otherwise. Multiple threads will concurrently access the shared data through these two functions, hence access must be controlled through mutex locks to prevent race conditions. Points to note: 1. Prevent race conditions 2. Prevent deadlocks 3. Update the data structure semaphores. 4. Print the results. 5. Add comments to your code Instructions 1. It is an individual assignment 2. Late sul si penalty will be applied 3. This is part of the work in assignment 3 you will continue this work 4. Read carefully the description below and provide a sac page report explaining the idea of the assignment and the expected solutit. You need ale to provide a flowchart To be submitted: Expx your answers and upload a PDF file. Ne hand writing to be used! Add a screenshot of the flowchart to your PDF file. 6. Add a cover letter stating your group members artike Homework Description A bank came allocate is available cash in a way they actors' meets are sened leaving the rest of the customers' needs sed. You are tasked with designing a banking system that includes 1) multithreading, 2) presents a conditional vids deadlock A bank shall receive many customers and their requests and will des coolingly making sure that the request loves the system is a safe stately whics that a request leaving in an unsafe sta will be denied The starter code with comments will be printed to you byendo . Yemed follow the format provided when vingeigement Handling. Reguests If a new process enters the system, the bank must first check that the mer of resources requested by the process does not exceed the wailable serce. If therested number does not exceed the availability then the bank shall all these to the process in the state of the bank wilt be safe. Otherwise this request must be died and shall water press release cough resources Maintained data structures The data structures (assemaphos) maintain the date of this ci system. The following data structures shall be maintained in order to have a functional banking system N will be the mamber of processes customers Mwill be the number of resource typer Available array of length to this captures the total of each one type available 1.6. Availablem will contain the number of available resources of typem. Man bym matrix that will capture the total number of res of each of types requested by the process such that the number of resources allotted to the proces shall not read the Maximequested by the process Allocation by mmatris dat will capture the al mercach of types allocated to the proces nie. Allocation will hold theme of res of typem allocated to proces Need a bym matrix that will capture the total number of revences et cachem types that are yet to be allocated to the process nie. Needlm will hold the forces of type mtu are yet to be allocated to process in order to complete the request ime: Nood-Max Allocation) Request: urray of required number of each type of source generated by the customer head. The size should not exceed the total types of resources available at the bank Safety Aborithm You have to develop this principle algorithm to check if them is adest. You have to check if all the resources requested by the processes are satisfied A system is safe if the following conditions are reached 1. If all the sotal number of records of each type required by anal contemer head 2. If all the customer threads are served and the process is finished Course System Course Code 21 Page Resource-Request Allocation: You have to develop this principle algorithm which checks for the following: 1. The total number of resources of each type requested by the customer thread should not exceed the Need, if it does then raise an error. 2. If the total number of resources of each type requested by the customer thread should not exceed the Available, else the customer thread must wait 3. If the above two conditions are satisfied then resources are allocated to the customer thread by the bank, and the state of the bank and the customer are updated. The Bank: The bank will accept requests from n customers for m resource types as described above (Ch.7. Section 7.5.3). The banker will keep a record of the resources using Available, Max, Need, and Allocation data structures The Customers: Create n customer threads that will request and release resources of the bank. The customers will continually loop, requesting and releasing resources randomly. The customer requests for resources will be limited by the Need matrix. The request will be granted to the customer thread if the safety algorithm mentioned above is satisfied. If the request would put the system in an unsafe position, then the request will be denied Utilize the following functions: int request_resource(int cust_id, int request[]): int release_resource(int cust_id, int relacase[]); Return values of the above functions will be o if successful and -1 otherwise. Multiple threads will concurrently access the shared data through these two functions, hence access must be controlled through mutex locks to prevent race conditions. Points to note: 1. Prevent race conditions 2. Prevent deadlocks 3. Update the data structure semaphores. 4. Print the results. 5. Add comments to your code

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

Database And Expert Systems Applications Dexa 2021 Workshops Biokdd Iwcfs Mlkgraphs Al Cares Protime Alsys 2021 Virtual Event September 27 30 2021 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Anna Fensel ,Jorge Martinez-Gil ,Lukas Fischer

1st Edition

3030871002, 978-3030871000

More Books

Students also viewed these Databases questions

Question

using signal flow graph

Answered: 1 week ago

Question

b. Where did they come from?

Answered: 1 week ago

Question

c. What were the reasons for their move? Did they come voluntarily?

Answered: 1 week ago

Question

5. How do economic situations affect intergroup relations?

Answered: 1 week ago