Consider the following set of processes, with the length of the CPU-burst time g
ID: 3814474 • Letter: C
Question
Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Priority P1 20 4 P2 5 3 P3 30 2 P4 2 3 P5 5 1 Assume the processes arrived in the order P1, P2, P3, P4, P5, all at time 0. What is the turnaround time (i.e., time of completion) of each process for each of the following four scheduling algorithms: FCFS (First Come First Serve), Round Robin (quantum=l), SJF (Shortest Job First), and a non-preemptive priority (a smaller priority number implies a higher priority)? For each of the four scheduling algorithms listed above, state whether your answer would have changed if each process arrived 1 millisecond apart (P1 at time 0, P2 at time 1, etc.) and briefly explain why.Explanation / Answer
1.
a. Turnaround time
1. FCFS
0------------------20----------------------25--------------------55-------------------57----------------62
Turn around time :
P1 : 20-0 =20
P2 : 25-0 = 25
P3 : 55-0 = 55
P4: 57-0 = 57
P5: 62-0 = 62
2.ROUND ROBIN(QUANTUM =1)
Turn around time :
P1 : 51
P2 : 20
P3 : 62
P4: 9
P5: 22
3. SJF
0--------------------2---------------------7--------------------12--------------------32--------------------62
Turn around time :
P1 : 32
P2 : 7
P3 : 62
P4: 2
P5: 12
4. PRIORITY
0--------------------5--------------------35--------------------40-------------------42---------------------62
Turn around time :
P1 : 62
P2 : 40
P3 : 35
P4: 42
P5: 5
B.
Yes, the turn around time will change. This is because turn around time is equal to process completion time minus arrival time. In part a, the arrival times for all processes are 0. So a process which arrives late will have lesser turn around time.
P1 P2 P3 P4 P5