ITPEC FE Morning April 2023 Question 18

Source exam: ITPEC FE Morning April 2023Topic: Computer Systems & Hardware

ITPEC FE Morning April 2023 — Question 18 of 80

SRTF Average Waiting Time — calculate avg waiting time under preemptive Shortest Remaining Time First scheduling.

Given processes:

ProcessArrivalBurst
P108
P223
P337
P454

Step 1: Build the timeline

  • t=0: P1 starts (only process available, remaining=8)
  • t=2: P2 arrives (burst=3). P1 remaining=6. 3 < 6preempt P1, run P2
  • t=3: P3 arrives (burst=7). P2 remaining=2. 2 < 7 → P2 continues
  • t=5: P2 completes. P4 arrives (burst=4). Remaining: P1=6, P3=7, P4=4. Min=4 → run P4
  • t=9: P4 completes. Remaining: P1=6, P3=7. Min=6 → run P1
  • t=15: P1 completes. Run P3
  • t=22: P3 completes

Step 2: Calculate waiting times

  • Waiting Time = (Completion - Arrival) - Burst
  • P1: (15 - 0) - 8 = 7
  • P2: (5 - 2) - 3 = 0
  • P3: (22 - 3) - 7 = 12
  • P4: (9 - 5) - 4 = 0

Result: (7 + 0 + 12 + 0) / 4 = 4.75

Why not others:
- (a) 3.0 — underestimates P1 and P3 waiting

- (c) 5.5 — likely a non-preemptive SJF calculation error

- (d) 10.25 — sum of waiting times (19), not the average

Key rule: In SRTF, always draw a timeline checking remaining times at each arrival and completion event. Use Waiting = Turnaround - Burst for each process.

AI-generated — may contain errors

The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.