54 Consider the following set of processes, with the length of the CPU burst tim
ID: 3750252 • Letter: 5
Question
54 Consider the following set of processes, with the length of the CPU burst time given in milliseconds Process Burst Time Priority Ps I The processes are assumed to have arrived in the order P1, P2, P3, P4,Ps all at time 0. Draw four Gantt charts that illustrate the execution of these pro- cesses using the following scheduling algorithms: FCPS, SJF, non- preemptive priority (a larger priority number implies a higher priority), and RR (quantum 2). What is the turnaround time of each process for each of the scheduling algorithms in part a? a. b. What is the waiting time of each process for each of these schedul- ing algorithms? c. Which of the algorithms results in the minimum average waiting time (over all processes)? d.Explanation / Answer
a.Gantt chart:
FCFS(First Come First Served): As per the order of arrival of processes P1,P2, P3,P4 and P5 they are served in this algorithm. Below is the Gantt chart for FCFS.
0 2 3 11 15 20
SJF(Shortest Job First): The process with least burst time(P2 with 1 burst time) will be executed first and followed by second least(P1 with 2 burst time) and so on till the last process get executed. Below is the Gantt chart for SFJ.
0 1 3 7 12 20
Non-premptive priority(with high priority process served first): Without preemption(i.e. suspension) each process will be served based on their priorty. The process P3 with high priority 4 is first executed, followed by P5 with priority 3 and followed by P1(eventhough P4 also has same priority as P1) as P1 is the first in order to arrive before P4 process. P1 is followed by P4 and P4 is followed by P2 which is having the least priority. Gantt chart for Non-premptive priority:
0 8 13 15 19 20
RoundRobin(RR): Each process in the order of arrival is given fixed time slot(2 units) to execute in a cyclic way till all the processes gets executed completely.Gantt chart for RR:
0 2 3 5 7 9 11 13 15 17 18 20
b. Turn Around Time(TAT) = Completion time - Arrival time
TAT
For FCFS:
P1: 2-0=2, P2: 3-0=3, P3: 11-0=11,P4: 15-0=15, P5: 20-0=20
For SJF:
P1:3-0=3, P2: 1-0=1, P3: 20-0=20,P4: 7-0=7, P5: 12-0=12
For non-preemptive HighPriority:
P1: 15-0=15, P2: 20-0=20, P3: 8-0=8,P4: 19-0=19, P5: 13-0=13
For RR:
P1: 2-0=2, P2: 3-0=3, P3: 20-0=20,P4: 13-0=13, P5: 18-0=18
c. Waiting time = Turn Around Time - Burst Time
For FCFS:
P1: 2-2=0, P2: 3-1=2, P3: 11-8=3,P4: 15-4=11, P5: 20-5=15
For SJF:
P1 = 1, P2 = 0, P3=12, P4 = 3, P5=7
For non-preemptive high priority:
P1=13,P2=19,P3=0,P4=15,P5=8
For RR:
P1=0, P2= 2, P3=12, P4=9, P5=13
c. Minium average waiting time among these algorithm is:
Average waiting time for FCFS:
(0+2+3+11+15)/5= 31/5 = 6.2
for SJF:
(1+0+12+3+7)/5=23/5=4.6
for non preemptive high priority:
(13+19+0+15+8)/5=11
for RR:
(0+2+12+9+13)/5=36/5=7.2
Therefore SJF has the minimum average waiting time.
P1 P2 P3 P4 P5Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.