Bankers Algorithm
$10-30 USD
Bezahlt bei Lieferung
Resource allocation using both an optimistic resource manager and the banker’s 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. After reading(all) the input, the program performs two simulations: one with the optimistic manager and one with the banker. Output is written to the screen.
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. 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 NOT require a cycle.
The input for the first run is.
2 1 4
initiate 1 1 4
request 1 1 1
release 1 1 1
terminate 1 0 0
initiate 2 1 4
request 2 1 1
release 2 1 1
terminate 2 0 0
The first line asserts that this run has 2 tasks and 1 resource type with 4 units.
The next line indicates that the run begins (at cycle 0-1, the cycle starting at 0 and ending at 1) with task 1 claiming (all) 4 units of resource 1. Further down on line 6 we see that task 2 also claims 4 units of resource 1 during cycle 0-1.
From lines 3 and 7 we learn that each task requests a unit during cycle 1-2 and returns that unit during the next cycle after the request is [login to view URL] the optimistic manager,the request is granted at 2 (the end of cycle 1-2) and the resource is returned during 2-3.
Input 1 does not use the compute [login to view URL] the optimistic manager each task terminates at time 3
Further details and input files included in zip. Must be written in C, C++, or C#
Projekt-ID: #8930206
Über das Projekt
Vergeben an:
Hi, I read the details, and ready to implement both Banker's Algorithm and Optimistic resource Manager. It's 3:40 AM here, and I'd probably be asleep after an hour or two. If you want to give me this project, I'l Mehr