Help me in Round Robin Algorithem& Shortest remaining time next
Use the CPU trace generator to generate jobs (or process) traces and simulate the
following algorithms
1. Shortest remaining time next (aka Shortest Job First with pre-emption,
aka SJF, shortest next burst time).
2. Round-Robin with user set-able time quantum (the time quantum should
be a userset-able command line parameter. Default time quantum is 20 time
units)
[Hint: aka = also known as]
The CPU trace generated by your CPU trace generator must have the following
format:
? numberOfJobs
? JobId_1 [space] arrivalTime [space] numberofIORequests [space] [Priority]
Followed by
? burstTime_1
? burstTime_2
? burstTime_3
? ...
? JobId_2 [space] arrivalTime [space] numberofIORequests [space] [Priority]
Followed by
? burstTime_1
? burstTime_2
? burstTime_3
? ...
? JobId_numberOfJobs [space] arrivalTime [space] numberofIORequests
[space] [Priority]
Followed by
? burstTime_1
? burstTime_2
? burstTime_3
? ...
An example of a trace file is:
2
1 0 3 1
5
60
19
21
2 3 2 2
5
5
7
Your CPU scheduling simulator should read this trace and simulate the algorithms
listed above. You want to test your program with a mix of 2 - 20 jobs and (the
same) two test cases (traces) for each algorithm:
1. Predominantly I/O bound jobs (interactive)
2. Predominantly CPU bound jobs (batch)
Your simulation should output the following statistics
• Average throughput measured in jobs per time unit
• Average turnaround time measured in time units
• Average waiting time measured in time units
Predominantly I/O bound jobs means the main part of this process/job will be
I/O based. It means the most of the execution time of that process will require
Input/Output from/to user and vise versa for Predominantly CPU bound jobs.
Clarification:
You are required to submit 3 files; each should accept the following command line
Parameters:
* If not specified, then default quantum size = 20
Trace File
• We are not simulating I/O burst times
• Priority has been excluded
• The ranges for generated values are as follows:
o No. of jobs: Random number between 2 and 20
o Arrival time: There should be between 0-20 time units between job
arrivals
o No. of I/O Requests: Random number between 1 and 20
o No. of CPU Bursts: # of I/O Requests + 1
o Burst Duration: Random number between 1 and 100
(Please note: I/O bound processes will have shorter bursts on average
then CPU bound processes)
An example of a trace file is:
2
1 0 2
5
60
19
2 3 1
5 5
Shortest Remaining Time First
If a process P1 is running and a new process enter the ready queue, allow P1 to
run again, i.e. include it in the processes in contention.