SCAN Disk Scheduling (Elevator Algorithm)

 

SCAN Disk Scheduling (Elevator Algorithm)

🔷 What is SCAN Scheduling?

The SCAN algorithm moves the disk head in one direction across the disk, servicing requests along the way, and when it reaches the end, it reverses direction and continues servicing.

👉 It behaves like an elevator:

  • Goes in one direction → services requests

  • Reaches end → reverses → services on the way back


1. How SCAN Works

🔷 Step-by-Step

  1. Disk head starts at current position

  2. Moves in a fixed direction (towards 0 or max cylinder)

  3. Services all requests in that direction

  4. Reaches the end of the disk

  5. Reverses direction

  6. Continues servicing remaining requests


 2. Example 

🔹 Given:

  • Request queue:

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

    53
  • Direction:
    👉 Moving toward 0


🔷 Step-by-Step Movement

Moving Left (toward 0):

  • 53 → 37 → 14 → 0

Reverse Direction (toward higher cylinders):

  • 0 → 65 → 67 → 98 → 122 → 124 → 183


🔷 Final Order of Service

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



3. Key Characteristics

1. Reduced Head Movement

  • Services nearby requests together

  • Avoids large back-and-forth jumps (unlike FCFS)


 2. Fairness

  • Every request will eventually be serviced

  • No starvation


3. Bidirectional Movement

  • Head continuously moves:

    • Forward → backward → forward...


 4. Limitations

🔴 1. Long Waiting Time for Some Requests

  • Request just behind the head:

    • Must wait until:

      • Head reaches end

      • Then reverses


🔴 2. Unnecessary Movement

  • Head always goes to end of disk

  • Even if no requests there


5. Important Insight

👉 When head reaches one end:

  • Few requests nearby (recently serviced)

  • Many requests at opposite end (waiting longer)

👉 SCAN helps balance:

  • Efficiency

  • Fairness


6. Comparison with FCFS

Feature        FCFSSCAN
Order        Arrival order        Sorted by direction
Head movement        Large, random        Controlled
Performance        Poor        Better
Fairness        Yes        Yes

7. Key Takeaways 

  • SCAN = Elevator algorithm

    • Goes up → serves all floors
    • Then goes down → serves remaining

  • Head moves in one direction, then reverses

  • Improves performance by reducing seek time

  • Ensures fairness (no starvation)

  • May cause delays for requests just missed



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