SSTF Disk Scheduling (Shortest Seek Time First)

 

SSTF Disk Scheduling (Shortest Seek Time First)

🔷 What is SSTF?

SSTF selects the disk request that is closest to the current head position.

👉 Key idea:

  • Always service the request with minimum seek distance


1. How SSTF Works

🔷 Step-by-Step

  1. Start at current head position

  2. Find the request nearest to current position

  3. Move head to that request

  4. Repeat until all requests are served


2. Example 

🔹 Given:

  • Request queue:

    98, 183, 37, 122, 14, 124, 65, 67
  • Initial head position:

    53

🔷 Step-by-Step Execution

Step 1: From 53

Closest request:

  • 65 (distance = 12)

  • 67 (14)

  • 37 (16)

👉 Choose 65


Step 2: From 65

Remaining:

98, 183, 37, 122, 14, 124, 67

Closest:

  • 67 (2)

👉 Choose 67


Step 3: From 67

Closest:

  • 37 (30)

  • 98 (31)

👉 Choose 37


Step 4: From 37

Closest:

  • 14 (23)

👉 Choose 14


Step 5: From 14

Closest:

  • 98 (84)

  • 122 (108)

👉 Choose 98


Step 6: From 98

Closest:

  • 122 (24)

  • 124 (26)

👉 Choose 122


Step 7: From 122

Closest:

  • 124 (2)

👉 Choose 124


Step 8: From 124

Remaining:

  • 183

👉 Choose 183


🔷 Final Order of Service

53 → 65 → 67 → 37 → 14 → 98 → 122 → 124 → 183

3. Total Head Movement

53→65 = 12 65→67 = 2 67→37 = 30 37→14 = 23 14→98 = 84 98→122 = 24 122→124 = 2 124→183 = 59

👉 Total = 236 cylinders


4. Advantages

✅ 1. Reduced Seek Time

  • Much less movement than FCFS (640 → 236)


✅ 2. Better Performance

  • Faster response time


5. Disadvantages

🔴 1. Starvation

  • Requests far from head may wait indefinitely


🔴 2. Not Fair

  • Favors nearby requests


6. Key Insight

👉 SSTF is like Shortest Job First (SJF) in CPU scheduling:

  • Always picks nearest request

  • Optimizes performance but may ignore distant requests


7. Comparison Snapshot

Algorithm    Total Movement    Efficiency
FCFS            640        Poor
SSTF        236        Much better

8. Simple Analogy

  • Like a delivery person:

    • Always goes to the nearest house next

    • Saves fuel, but far houses wait longer


9. Key Takeaway

  • SSTF selects request with minimum seek time

  • Improves performance significantly

  • May cause starvation

Comments

Popular posts from this blog

Operating Systems OS PCCST403 Semester 4 BTech KTU CS 2024 Scheme

Introduction to Operating System -Virtualization, Concurrency, and Persistence

Operating Systems PCCST403 Scheme and Syllabus