Skip to content
Worked Examples · Example 34
Q.

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

Process NoArrival TimeBurst time
P113
P224
P312
P444

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 SJF scheduling algorithm.

Puducherry CbseNCERTSubjective· 3mImportance★★★★★est
32% · 34/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 →

Non-preemptive SJF runs P3→P1→P2→P4P3 \to P1 \to P2 \to P4; everything finishes at t=14t=14, with average waiting time 3 and average turnaround time 6.25.

Turnaround Time=Completion Time−Arrival Time,Waiting Time=Turnaround Time−Burst Time\text{Turnaround Time} = \text{Completion Time} - \text{Arrival Time}, \qquad \text{Waiting Time} = \text{Turnaround Time} - \text{Burst Time}

In non-preemptive SJF, at every scheduling instant the process (already arrived and not finished) with the smallest burst time is picked and runs to completion without interruption.

Given:

ProcessArrivalBurst
P113
P224
P312
P444
  1. t=0t=0: no process has arrived (earliest arrival is 11) ⇒\Rightarrow CPU idle for 0→10 \to 1.
  2. t=1t=1: available ={P1(3), P3(2)}= \{P1(3),\ P3(2)\}. Shortest burst =P3= P3. Run P3: 1→31 \to 3.
  3. t=3t=3: available ={P1(3), P2(4)}= \{P1(3),\ P2(4)\}. Shortest =P1= P1. Run P1: 3→63 \to 6.
  4. t=6t=6: available ={P2(4), P4(4)}= \{P2(4),\ P4(4)\}. Tie ⇒\Rightarrow pick earlier arrival P2P2. Run P2: 6→106 \to 10.
  5. t=10t=10: only P4P4 left. Run P4: 10→1410 \to 14.

Gantt chart: idle(0–1) ∣ P3(1–3) ∣ P1(3–6) ∣ P2(6–10) ∣ P4(10–14)\text{idle}(0\text{–}1)\ |\ P3(1\text{–}3)\ |\ P1(3\text{–}6)\ |\ P2(6\text{–}10)\ |\ P4(10\text{–}14).

  1. Completion, Turnaround, Waiting:

| Process | Arrival | Burst | Completion | TAT =C−A=C-A | WT =TAT−B=TAT-B |

|---|---|---|---|---|---| …

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.