Question: Round Robin Scheduling Program simulation. Write a program in C/C++ that simulates a system program Specifications: Your program must use some form of visual presentation
Round Robin Scheduling Program simulation. Write a program in C/C++ that simulates a system program
Specifications:
- Your program must use some form of "visual presentation" to show, at least, the following four components:
- A CPU
- A ready queue showing all the processes waiting to be dispatched to use the CPU
- An I/O device
- An I/O queue showing all the processes waiting to use the I/O device
- Your choice of "visual presentation" will be a text-mode to an output file (user will enter the name of the output file as first command-line input parameter) and the text-mode or GUI program implemented using any UI framework of your choice
- The description of a simulated process includes the following information:
- Arrival time (ta) of the process
- Number of CPU bursts (N)
- CPU burst durations (ci, i = 1, 2, ..., N), I/O burst durations (dj, j = 1, 2, ..., N-
- written in one line of the input file (the name of the input file will be entered by the user as second command-line input parameter) in the following order:
ta N c1 d1 c2 d2 ... cN-1 dN-1 cN
- An integer counter will simulate the system clock there will be an output log file (the name of the log file will be entered by the user as third command-line input parameter). Every time unit in your simulation will be listed in this file along with what event(s) took place at that time. Every 5 time units (5, 10, 15, ) also display the current contents of the Ready Queue and I/O Queue (before events at that time begin).
- The simulator shall print an appropriate message when a simulated process changes its state. It shall print a message when it performs one of the following actions: Each message is prefixed with the current simulation time.
- Starts a new process
- Schedules a process to run
- Moves a process to the I/O Waiting (Blocked) State
- Preempts a process from the Running State
- Moves a process back into the Ready State (due to I/O completion)
- Starts servicing a process' I/O request
- When a simulated process is interrupted (because its current CPU burst is longer than the quantum) the process is preempted and re-enter the ready queue. When a simulated process completes its current CPU burst, it will then use its I/O burst, the simulator changes the process' state to Blocked. At this point, the CPU becomes idle and the dispatcher may select another process from the ready queues.
- The simulated system has only one CPU and one I/O device. The I/O request of a process will be performed only if the I/O device is available. Otherwise, the process requesting the I/O operation will have to wait until the device is available. I/O is handled by the simulated device on first-come-first-serve basis. Upon completion of its I/O burst, a process will change from Blocked state to Ready and join the Ready Queue again.
- When a simulated process terminates, the simulator then outputs a statement of the form: Job %d terminated: Turn Around Time = %d, Wait time = %d, I/O wait = %d where " Turn Around Time " is total elapsed time, "Wait time" is the total time spent by a process in the Ready Queue, and "I/O wait" is the total amount of time the process had to wait for the I/O device.
- At the end of simulation, the simulator shall display the percentage of CPU utilization, average Turn Around Time, average wait time, and average I/O wait time.
Job Arrival Time CPU bursts I/O bursts
1 3 2, 8, 4 5, 7
2 5 4 -
3 6 8, 10, 7, 6 2, 2, 5
Please note the following: Each process always starts and ends with a CPU burst.The jobs in the input file are sorted in ascending order by their arrival time
Required Test Cases (you are required to validate the data results below are correct and create more tests!):
3 3 2 5 8 7 4
5 1 4
6 4 8 2 10 2 7 5 6
> Results for quantum = 3 CPU utilization = 84%
P0 (TAT = 36, ReadyWait = 10, I/O-wait=0)
P1 (TAT = 7, ReadyWait = 3, I/O-wait=0)
P2 (TAT = 52, ReadyWait = 12, I/O-wait=0)
3 3 2 5 2 7 4
5 2 1 10 2
6 4 1 15 1 12 4 8 6
> Results for quantum = 2 CPU utilization = 32%
P0 (Turn Around Time = 43, ReadyWait = 0, I/O-wait=23)
P1 (Turn Around Time = 17, ReadyWait = 0, I/O-wait=4)
P2 (Turn Around Time = 66, ReadyWait = 0, I/O-wait=19)
3 3 2 5 8 7 4
4 1 4
6 3 2 5 2 7 4
8 4 8 2 10 2 7 5 6
10 2 1 10 2
13 4 1 15 1 12 4 8 6
> Results for quantum = 2 CPU utilization = 77%
P0 (Turn Around Time = 60, ReadyWait = 18, I/O-wait=16)
P1 (Turn Around Time = 7, ReadyWait = 3, I/O-wait=0)
P2 (Turn Around Time = 47, ReadyWait = 7, I/O-wait=20)
P3 (Turn Around Time = 86, ReadyWait = 24, I/O-wait=22)
P4 (Turn Around Time = 19, ReadyWait = 5, I/O-wait=1)
P5 (Turn Around Time = 75, ReadyWait = 7, I/O-wait=21)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
