You are on page 1of 3

Considering the above problem, we represent process and cpu burst time in a chart and assuming

that process that arrives at time 0(Arrival time in the main memory)

Process Burst time( in


Milliseconds)
P1 17
P2 15
P3 5
In this question asked to use non-preemptive scheduling , In non preemptive scheduling, once CPU is
assigned to process, the processor(CPU) do not release until the completion of that process.

FCFS and SJF are non-preemptive scheduling algorithm, they do not release CPU until the completion
of process.

Average turn around time= time interval between the submission of process and time of
completion, ie

Turn around time= Finishing time – Arrival time

Average waiting time=sum of periods spent waiting by a process in the ready queue

Ie, Average waiting time=Starting time –Arrival Time

We will first work with FCFS CPU Scheduling

FCFS(First Come First Serve) CPU Scheduling

First of we will have to draw Gantt Chart for representation of all process in memory and cpu burst
time.
Now we have to calculate Average turn around time,

Average turn around time

Turn around time= Finishing time – Arrival time

Turn around time for P1=17-0=17

Turn around time for P2=32-0=32

Turn around time for P3=37-0=37

*Average turn around time =17+32+37/3

=52/3=50millisecond

Now we have to calculate Average waiting time,

Average waiting time

waiting time = Stating time – Arrival time

Waiting time for P1=0-0=0

Waiting time for P2=17-0=17

Waiting time for P3=32-0=32

*Average waiting time =0+17+32/3

=49/3=27.66millisecond

Shortest Job First(SJF)


we will have to draw Gantt Chart for SJF representation of all process in memory and cpu burst time.

Now we have to calculate Average turn around time,

Average turn around time


Turn around time= Finishing time – Arrival time

Turn around time for P1=37-0=37

Turn around time for P2=20-0=20

Turn around time for P3=5-0=5

*Average turn around time =37+20+5/3

=62/3=58millisecond

Now we have to calculate Average waiting time,

Average waiting time

waiting time = Stating time – Arrival time

Waiting time for P1=20-0=20

Waiting time for P2=5-0=5

Waiting time for P3=0-0=0

*Average waiting time =20+5+0/3

=30/3=10millisecond

*Performance of algorithm is depending on average waiting time. In both Scheduling, SJF is best
scheduling algorithm

You might also like