In: Computer Science
6. Consider the following set of processes P1, P2, P3, P4.
Process Burst Time Arrival Time Priority
P1 3 0 1
P2 5 1 2
P3 8 3 3
P4 4 4 2
a) Draw Gantt charts that illustrate the execution of these
processes using the following scheduling algorithms: first-come,
first-served (FCFS), priority scheduling (larger number=high
priority), and Round-Bobin (RR, quantum=2).
b) Compute the average waiting time, turnaround time for the three
algorithms. Turnaround time – amount of time to execute a process
(the time from submission to completion). Waiting time – amount of
time a process has been waiting in the ready queue.
*Please answer in text format, not hand written*
Hi, hope you are doing good. If you have any query please let me know in the comment. Have a nice day!
b)
TAT=CT-AT and WT=TAT-BT
FCFS
Process | AT | BT | CT | TAT | WT |
P1 | 0 | 3 | 3 | 3 | 0 |
P2 | 1 | 5 | 8 | 7 | 2 |
P3 | 3 | 8 | 16 | 13 | 5 |
P4 | 4 | 4 | 20 | 16 | 12 |
Average TAT= (3+7+13+16)/4=39/4=9.75
Average WT= (0+2+5+12)/4= 19/4=4.75
Priority Scheduling
Process | AT | BT | CT | TAT | WT |
P1 | 0 | 3 | 3 | 3 | 0 |
P2 | 1 | 5 | 16 | 15 | 10 |
P3 | 3 | 8 | 11 | 8 | 0 |
P4 | 4 | 4 | 20 | 16 | 12 |
Average TAT= (3+15+8+16)/4=10.5
Average WT= (0+10+0+12)/4=5.5
Round Robin Scheduling
Average TAT= (5+15+17+11)/4=48/4=12
Average WT= (2+10+9+7)/4=28/4=7
Process | AT | BT | CT | TAT | WT |
P1 | 0 | 3 | 5 | 5 | 2 |
P2 | 1 | 5 | 16 | 15 | 10 |
P3 | 3 | 8 | 20 | 17 | 9 |
P4 | 4 | 4 | 15 | 11 |
7 |