Bird
Raised Fist0
Operating Systemsknowledge~20 mins

SSTF (Shortest Seek Time First) in Operating Systems - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
SSTF Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding SSTF Disk Scheduling

Which of the following best describes the main goal of the SSTF (Shortest Seek Time First) disk scheduling algorithm?

ATo select the request closest to the current head position to minimize seek time.
BTo process requests in the order they arrive without reordering.
CTo always move the disk head in one direction until the end before reversing.
DTo prioritize requests based on their arrival time and size.
Attempts:
2 left
💡 Hint

Think about how SSTF tries to reduce the movement of the disk head.

📋 Factual
intermediate
2:00remaining
SSTF Disk Scheduling Behavior

Given the current head position at track 50 and pending requests at tracks 45, 70, 55, and 40, which request will SSTF service next?

ATrack 70
BTrack 40
CTrack 55
DTrack 45
Attempts:
2 left
💡 Hint

Calculate the distance from the current head position to each request.

🔍 Analysis
advanced
2:00remaining
SSTF Starvation Problem

Why can the SSTF disk scheduling algorithm cause starvation for some requests?

ABecause SSTF always moves the head in one direction, causing requests in the opposite direction to wait.
BBecause SSTF processes requests strictly in arrival order, ignoring seek time.
CBecause requests far from the current head position may be delayed indefinitely if closer requests keep arriving.
DBecause SSTF prioritizes requests based on their size rather than position.
Attempts:
2 left
💡 Hint

Consider what happens if new requests keep appearing near the current head position.

❓ Comparison
advanced
2:00remaining
Comparing SSTF and SCAN Algorithms

Which statement correctly compares SSTF and SCAN disk scheduling algorithms?

ABoth SSTF and SCAN always service requests in the order they arrive.
BSSTF selects the closest request regardless of direction, while SCAN moves the head in one direction servicing all requests until the end before reversing.
CSSTF moves the head in one direction only, while SCAN selects the closest request at each step.
DSCAN causes starvation, but SSTF guarantees fair servicing of all requests.
Attempts:
2 left
💡 Hint

Think about the movement pattern of the disk head in both algorithms.

❓ Reasoning
expert
3:00remaining
Calculating Total Seek Time with SSTF

Given the initial head position at track 100 and pending requests at tracks 120, 90, 130, 70, and 110, what is the total seek time (sum of all head movements) if SSTF is used to service all requests?

A90 tracks
B80 tracks
C100 tracks
D110 tracks
Attempts:
2 left
💡 Hint

Calculate the distance to the closest request at each step and sum all movements.

Practice

(1/5)
1. What does SSTF (Shortest Seek Time First) disk scheduling algorithm prioritize?
easy
A. The request closest to the current head position
B. The request that arrived first
C. The request farthest from the current head position
D. Requests in a fixed circular order

Solution

  1. Step 1: Understand SSTF purpose

    SSTF aims to reduce the seek time by choosing the disk request nearest to the current head position.
  2. Step 2: Compare options with SSTF behavior

    Only the request closest to the current head position matches this behavior; others describe different algorithms.
  3. Final Answer:

    The request closest to the current head position -> Option A
  4. Quick Check:

    SSTF = closest request [OK]
Hint: Pick the request nearest to the head position [OK]
Common Mistakes:
  • Confusing SSTF with FCFS (First Come First Serve)
  • Thinking SSTF picks requests in arrival order
  • Assuming SSTF picks the farthest request
2. Which of the following is the correct way to describe SSTF in disk scheduling?
easy
A. It processes requests in the order they arrive.
B. It selects the request with the longest waiting time first.
C. It selects the request closest to the current head position.
D. It moves the head in one direction servicing all requests.

Solution

  1. Step 1: Review SSTF definition

    SSTF selects the disk request closest to the current head position to minimize seek time.
  2. Step 2: Match options with SSTF behavior

    The option "It selects the request closest to the current head position." correctly describes SSTF. Other options describe different algorithms like FCFS or SCAN.
  3. Final Answer:

    It selects the request closest to the current head position. -> Option C
  4. Quick Check:

    SSTF = closest request selection [OK]
Hint: Remember SSTF picks nearest request, not oldest [OK]
Common Mistakes:
  • Mixing SSTF with FCFS or SCAN algorithms
  • Assuming SSTF picks requests by waiting time
  • Confusing direction-based scheduling with SSTF
3. Given the disk head is at position 50 and requests are at positions [45, 70, 10, 55], which request will SSTF service first?
medium
A. 45
B. 70
C. 10
D. 55

Solution

  1. Step 1: Calculate distances from head position 50

    Distances: 45 (5), 70 (20), 10 (40), 55 (5)
  2. Step 2: Identify closest request

    Requests at 45 and 55 are both 5 units away. SSTF can pick either, but usually picks the first closest found, here 45.
  3. Final Answer:

    45 -> Option A
  4. Quick Check:

    Closest request = 45 [OK]
Hint: Calculate absolute distance, pick smallest [OK]
Common Mistakes:
  • Choosing the farthest request by mistake
  • Ignoring equal distances and picking wrong one
  • Confusing SSTF with FCFS order
4. A disk head is at position 30. Requests are at [35, 25, 40, 20]. A student incorrectly picks 40 as the next request in SSTF. What is the error?
medium
A. They ignored the current head position.
B. They chose the farthest request instead of the closest.
C. They picked the request with the longest waiting time.
D. They selected requests in arrival order.

Solution

  1. Step 1: Calculate distances from head position 30

    Distances: 35 (5), 25 (5), 40 (10), 20 (10)
  2. Step 2: Identify correct SSTF choice

    Closest requests are 35 and 25 (5 units away). Choosing 40 (10 units) is incorrect.
  3. Final Answer:

    They chose the farthest request instead of the closest. -> Option B
  4. Quick Check:

    SSTF picks closest, not farthest [OK]
Hint: Always pick request with minimum distance [OK]
Common Mistakes:
  • Picking requests based on arrival time
  • Ignoring actual distances from head
  • Confusing SSTF with other algorithms
5. A disk head starts at position 100. The request queue is [120, 89, 130, 80, 110]. Using SSTF, what is the order in which requests will be serviced?
hard
A. [110, 120, 130, 89, 80]
B. [89, 80, 110, 120, 130]
C. [110, 120, 89, 80, 130]
D. [110, 89, 80, 120, 130]

Solution

  1. Step 1: Start at head position 100 and find closest request

    Distances: 120(20), 89(11), 130(30), 80(20), 110(10). Closest is 110 (10 units).
  2. Step 2: Move head to 110 and repeat

    Remaining: 120(10), 89(21), 130(20), 80(30). Closest is 120 (10).
  3. Step 3: Move head to 120 and repeat

    Remaining: 89(31), 130(10), 80(40). Closest is 130 (10).
  4. Step 4: Move head to 130 and repeat

    Remaining: 89(41), 80(50). Closest is 89 (41).
  5. Step 5: Move head to 89 and last request is 80 (9 away)

    Order: 110, 120, 130, 89, 80.
  6. Final Answer:

    [110, 120, 130, 89, 80] -> Option D
  7. Quick Check:

    SSTF services closest request each step [OK]
Hint: Pick closest request step-by-step from current head [OK]
Common Mistakes:
  • Not updating head position after each request
  • Choosing requests by arrival order
  • Ignoring equal distances and picking wrong request
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard