04 Home Work - Round Robin Scheduling Algorithm
04 Home Work - Round Robin Scheduling Algorithm
D a t a S t r u c t u r e s a n d A l g o r i t h m s
Home Work 04 Marks 10
Instructions
Work on this home work individually. Absolutely NO collaboration is allowed. Any traces of plagiarism would result in a ZERO marks
in this homework and possible disciplinary action.
Due Date
Paste the solution(s) folder of the problems (source code .cpp files only) labeled with your complete roll number in SEM – HW 04,
SEA – HW 04 and CSM – HW 04 folders for SE Morning, SE Afternoon and CS Morning sections respectively till Tuesday, April 15,
2018 before 05:00 PM. These folders are available at \\printsrv\Teacher Data\Umair Babar\Students.
To implement the round robin scheduling, we keep the ready queue as a FIFO queue of the processes. New processes are added to
the tail of the ready queue. The CPU scheduler picks the first process from the ready queue, sets a timer to interrupt after one time
quantum in a row.
7. Up to the time interval (quantum) switch the CPU towards next process and reduce the previous process service time by
time slice (hint: use loop). If the service time is found to be less than or equal to zero print the process attributes and delete
the node from the linked lists.
8. Repeat the step 7 until the linked list is empty.
Formulas to calculate the waiting time and the turnaround time for a process.
At the end your program should output the average waiting time and the average turnaround time for all the processes.
Sample Run
Input.txt
5
1
A 0 3
B 0 4
C 1 5
D 3 6
E 5 6
Output
Process Name Arrival Time Service Time Finish Time Turn-around-time Waiting Time
A 0 3 8 8 5
B 0 4 14 14 10
C 1 5 19 18 13
D 3 6 23 20 14
E 5 6 24 19 13
NOTE: - No submission will be accepted after the DUE DATE and TIME.
B E S T O F L U C K