Skip to content
Worked Examples · Example 32
Q.

Consider the available processes given below in the ready queue for execution and with given burst time.

Process NoArrival TimeBurst time
P102
P212
P353
P464

a) What is the time at which all the processes get executed?

b) Find the average waiting time and average turnaround time using the non-pre-emptive FCFS scheduling algorithm.

Puducherry CbseNCERTSubjective· 3mImportance★★★★★est
30% · 32/106 Questions
✓ Free question

FCFS order P1→P2→P3→P4 gives completion times 2,4,8,122,4,8,12 (a 11-unit CPU idle gap between 44 and 55); waiting times 0,1,0,20,1,0,2 (avg 0.750.75) and turnaround times 2,3,3,62,3,3,6 (avg 3.53.5).

Turnaround time=Completion time−Arrival time,\text{Turnaround time}=\text{Completion time}-\text{Arrival time},

Waiting time=Turnaround time−Burst time.\text{Waiting time}=\text{Turnaround time}-\text{Burst time}.

FCFS is non-pre-emptive: a process runs to completion in order of arrival; the CPU idles if the next process has not yet arrived.

  1. Order by arrival: P1 (00), P2 (11), P3 (55), P4 (66). Build the Gantt chart:
    • P1: runs 0→20\to 2.
    • P2: arrived at 11, CPU free at 22, runs 2→42\to 4.
    • P3: arrives at 55 (CPU idle 4→54\to 5), runs 5→85\to 8.
    • P4: arrived at 66, CPU free at 88, runs 8→128\to 12.

P1⏟0−2 P2⏟2−4 idle⏟4−5 P3⏟5−8 P4⏟8−12\underbrace{\text{P1}}_{0-2}\ \underbrace{\text{P2}}_{2-4}\ \underbrace{\text{idle}}_{4-5}\ \underbrace{\text{P3}}_{5-8}\ \underbrace{\text{P4}}_{8-12}

  1. a) Time all processes get executed == completion of the last process P4 =12=12 time units.
  2. Compute turnaround and waiting times:
ProcessArrivalBurstCompletionTurnaround =C−A=C-AWaiting =TAT−B=\text{TAT}-B
P10222200
P21243311
P35383300
P464126622
  1. Average waiting time =0+1+0+24=34=0.75=\dfrac{0+1+0+2}{4}=\dfrac{3}{4}=0.75 time units.
  2. Average turnaround time =2+3+3+64=144=3.5=\dfrac{2+3+3+6}{4}=\dfrac{14}{4}=3.5 time units.
✓Final answer

a) All processes are executed by time 12\mathbf{12} units. b) Average waiting time =0.75=\mathbf{0.75} units and average turnaround time =3.5=\mathbf{3.5} units.

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.