Question: Suppose a process is defined to behave as described in Figure. Design and implement a resource manager for reusable resources. When multiple processes are blocked

Suppose a process is defined to behave as described in Figure. Design and implement a resource manager for reusable resources. When multiple processes are blocked on a resource and one or more units become available, call a policy function to select the process to receive resources. Implement any simple policy you like. Test your resource manager by creating a testbed with N different processes (N is a testbed parameter) and M different resources (M is a testbed parameter), where Ri initially has ci units of the resource (ci is a testbed parameter). Only one process can be running at a time, so you will also need a simple scheduler to allocate the processor to processes in the order in which they become ready. A running process should execute for a small random amount of time and then request one of the units of resource, transitioning to the blocked state. When the resource is allocated to the process, it should be moved to the ready state. Later, the testbed should release each resource it acquired. Your testbed processes need only simulate real work by real processed. For example, your testbed might have a code schema similar to this:

#define N 50

Scanf(“%d”, M); // define a value for M 

For(i=0; i

for(i=0; i

waitTime = rand ();

for (j=0; j

                                  // process

request(r[i%M],…);  // Ask for k < c[i%M] units 

waitTime = rand();

for(j=0; j

                                  // process 

release(r[i%M], …)                // Release resource 

}

A more comprehensive test procedure would cause processed to hold more than one resource type at a time. If you have time, make your test driver check some of these more complex situations. 

            Experiment with various small values of N < 8, M < 10, and ci. The random amount of time a process runs should be kept as small as possible so that your tests do not take an inordinate amount of time. Be sure your test cases cause processes to block for unavailable resources. Hand in listing of your resource manager and testbed, along with a trace (fewer than five pages) of state transitions in a test session.  

running Done( request request Schedule Start blocked ready

Step by Step Solution

3.39 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This is the equivalent of a full lab exercise without any background information It is a nice but laborious exercise resourcec SPECIFICATION This program must read N the number of processes read M the ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

34-E-CE-OS (435).docx

120 KBs Word File

Students Have Also Explored These Related Computer Engineering Questions!