Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following set of processes (tuples look like process, burst size):

ID: 3600650 • Letter: C

Question

Consider the following set of processes (tuples look like process, burst size): (P0, 10), (P1, 30), (P2, 15), (P3, 5). Assume the processes arrive in this order as well. Compute the average waiting time and average turnaround time for the following algorithms, and answer the final question:

-First-Come First-Served

-Shortest-Job-First

-Priority Scheduling (Assume priority is calculated as 5*processnumber+bursttime)

-Round Robin Scheduling (use time quantum 10)

Which of these algorithms gives the best turnaround time for this list of processes?

Explanation / Answer

Hi,
Given the processes burst times are
P0-10
P1-30
P2-15
P3-5
Given, they arrive in same order, that is all of them arrive at t=0
lets define the parameters we want to calculate
Waiting time-Amount of time spent ready to run but not running
Turn around time- mean time from submission to completion of process
1. FCFS

In this there is no preemption and processes are executed as an when they come,
average wait time= (10+40+55)/4=26.25
average turn around time= (10+40+55+60)/4=41.25

2.Shortest Job first:
In this, the process having least burst time is executed first, therefore in this case the order of execution will be
P3,P0,P2,P1
average wait time= (5+15+30)/4=12.5
average turn around time= (5+15+30+60)/4=27.5
3.Priority Scheduling (Assume priority is calculated as 5*processnumber+bursttime)
Lets calculate the priority,
P0- 5*0+10=10
P1- 5*1+30=35
P2- 5*2+15=25
P3- 5*3+5=20
So the order of execution will be P1,P2,P3,P0
average wait time= (30+45+50)/4=31.25
average turn around time= (30+45+50+60)/4=46.25
4.Round Robin Scheduling (use time quantum 10)
In this every process is executed for 10 seconds of CPU time,
average wait time= (30+35+30)/4=23.75
average turn around time= (10+60+50+35)/4=38.75
As we can see, turn around time is least for SJF for this processes.

Thumbs up if this was helpful, otherwise let me know in comments