Round-robin CPU scheduling emulator

"IDRIS AYODEJI BELLO" <[email protected]>
Newsgroups gmane.org.ballistichelmet.lambda
Message-ID <[email protected]>
Hi,

Can u help out on this?

2. Specifications

You are to simulate the execution of up to 128 interactive processes by a computer system with a very large memory, one terminal per user, a CPU, and up to eight identical disk units. For simulation purposes, we will represent each process by a fixed number of process steps whose order and durations are known a priori. To simplify the program, we will assume that:

a) there is enough memory space for all interactive processes, and

b) processes never wait for terminal access.

All time durations will be expressed in milliseconds.

Your program should maintain one CPU queue and one disk queue for each disk unit. If by accident, two resources allocations need to be made at the same time, you should allocate the CPU first then the disk and then the terminals.

The CPU should be scheduled according to a round-robin policy. All processes have the same priority, and processes that use the CPU for more than QUANTUM time units immediately return to the end of the ready queue. All disks should be scheduled according to a First Come First Served policy.

3. Input Specifications

Your program should read its input file name from its command line as in:

./a.out input.txt

Your input will consist of four lines describing the global parameters of the system, namely, the number of disk units (NDISKS), followed by the disk access read access time (DRDTIME), the disk write access time (DWRTIME) and the duration of the time slice (QUANTUM) as in:

NDISKS 2 // Two disk drives
DRDTIME 6 // Duration of a disk read
DWRTIME 7 // Duration of a disk write
QUANTUM 100 // Duration of CPU time slice

Each process will be described by its start time, followed by a sequence of resource requests and user think times.

These resources requests will include:

a) CPU requests (CPU),

b) disk read requests (READ),

c) disk write requests (WRITE),

d) terminal write requests (TERMINAL), and

e) user think times (THINK) representing the times when the user either decides what to do next or types an input line.

Your input will thus look like:

NDISKS 2 // Two disk drives
DRDTIME 6 // Duration of a disk read
DWRTIME 7 // Duration of a disk write
QUANTUM 100
/!
/ Duration of CPU time slice
START 12000 // Start time of first process
CPU 90 // Request CPU for 90 ms
READ 0 // Read from drive 0
CPU 200 // This CPU request is longer than the time slice
TERMINAL 500
THINK 5000
CPU 100
WRITE 0 //Write to drive 0
CPU 100
WRITE 1 //Write to drive 1
CPU 20
TERMINAL 2
000
CPU 20 // Last step of first process
START 12010 // Start time of second process
...

There will never be more than 1024 process steps. All processes will always be sorted by start times.

4. Error Handling

You program should be able to reject input lines with incorrect keywords. It should abort after printing an error message with the number of the input line and the offending keyword.

5. Output Specifications

Your program should print out one line of output every time a process starts or terminates. This line should include the process sequence number and the current simulated time in milliseconds. When all the processes in your input stream have completed, your simulator should print a summary report listing:

a) the current simulated time,

b) the number of processes that have completed,

c) the total numbers of disk reads and disk writes,

d) the CPU and disk utilizations.

6. Important

Your program should start by a block of comments containing your name, the course number, the due date and a very short description of the assignment. It should contain functions and these functions should have arguments. Each function should start by a short description of the task it performs.

Each variable definition should be followed by a comment describing the function of the variable as in:

int arr_time; // arrival time

Array sizes should be specified using symbolic constants defined at the beginning of the program.

Cell- +1-281-235-2606

Home- +1-281-265-7854

----------
Add photos to your e-mail with MSN 8. Get 2 months FREE*.

_______________________________________________
Lambda mailing list
[email protected]
http://ballistichelmet.org/mailman/listinfo/lambda
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.