Skip to content
Worked Examples · Example 33
Q.

Consider the below processes available in the ready queue for execution, with arrival time as 0 for all and given burst time. Find the average waiting time using the SJF scheduling algorithm.

ProcessBurst Time
P125
P24
P37
P43
Sikkim CbseNCERTSubjective· 3mImportance★★★★★est
31% · 33/106 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Under SJF the processes run shortest-first (P4, P2, P3, P1); the average waiting time works out to 6 ms.

Average Waiting Time=∑iWTin\text{Average Waiting Time} = \frac{\sum_{i} WT_i}{n}

where WTi=WT_i = waiting time of process ii = (time it starts running) −- (its arrival time), and n=n = number of processes. In Shortest-Job-First (SJF) the ready process with the smallest burst time is executed next. All arrival times are 00.

  1. Order the bursts (shortest first). Given bursts: P1=25, P2=4, P3=7, P4=3P1=25,\ P2=4,\ P3=7,\ P4=3. Ascending order: P4(3)→P2(4)→P3(7)→P1(25)P4(3) \to P2(4) \to P3(7) \to P1(25).
  2. Build the Gantt chart (all arrive at 00):
ProcessBurstStartFinish
P4303
P2437
P37714
P1251439

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.