Question
The goal of this lab is to do resource allocation using both an optimistic resource manager and the bankers algorithm of Dijkstra. The optimistic resource
The goal of this lab is to do resource allocation using both an optimistic resource manager and the bankers algorithm of Dijkstra. The optimistic resource manager is simple: Satisfy a request if possible, if not make the task wait; when a release occurs, try to satisfy pending requests in a FIFO manner. Your program takes one command line argument, the name of file containing the input. After reading (all) the input, the program performs two simulations: one with the optimistic manager and one with the banker. Output is written to stdout (the screen). Input files for thirteen required runs are available on the web, together with the expected output. We will test your program on additional runs as well. The input begins with two values T, the number of tasks, and R, the number of resource types, followed by R additional values, the number of units present of each resource type. (If you set arbitrary limits on say T or R, you must, document this in your readme, check that the input satisfies the limits, print an error if it does not, and set the limits high enough so that the required inputs all pass.) Then come multiple inputs, each representing the next activity of a specific task. The possible activities are initiate, request, compute, release, and terminate. Time is measured in fixed units called cycles and, for simplicity, no fractional cycles are used. The manager can process one activity (initiate, request, or release) for each task in one cycle. However, the terminate activity does NO T require a cycle. To ease the programming,Ihave specified all activities to have the same format, namely a string followed by three unsigned integers. The initiate activity (which must precede all others for that task) is written initiate task-number resource-type initial-claim (The optimistic manager ignores the claim.) If there are R resource types, there are R initiate activities for each task, each requiring one cycle. The request and release activities are written request task-number resource-type number-requested release task-number resource-type number-released The compute activity is written compute task-number number-of-cycles unused This activity means that for the next several cycles the process is computing and will make no requests or releases. The process retains its current resources during the computation. The fourth value is not used; I include it so that all activities have the same format. Finally the terminate operation, which does NO T require a cycle is written terminate task-number unused unused The last two values are not used; I include them so that all activities have the same format.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started