C-SCAN (Circular SCAN) Disk Scheduling Algorithm
C-SCAN (Circular SCAN) Disk Scheduling Algorithm
Aim
To simulate the C-SCAN disk scheduling algorithm and compute the total head movement, displaying Step, From, To, Movement.
Theory
C-SCAN (Circular SCAN) is an improved version of SCAN.
-
The head moves only in one direction (say LEFT → RIGHT).
-
It services all requests while moving in that direction.
-
When it reaches the last track, it jumps to the first track (0) without servicing requests during the return.
-
Then continues again in the same direction.
👉 This provides more uniform waiting time than SCAN.
Why C-SCAN?
Advantages
-
Uniform waiting time
-
No bias toward middle cylinders
-
Predictable response time
Disadvantages
-
Extra head movement due to circular jump
-
Slightly more movement than SSTF
Algorithm
-
Read number of disk requests.
-
Read request queue.
-
Read initial head position.
-
Read disk size.
-
Sort requests.
-
Move head in one direction only (RIGHT assumed):
-
Service all requests greater than head.
-
-
Move head to disk end.
-
Jump to track 0.
-
Continue servicing remaining smaller requests.
-
Calculate total head movement.
Program: C-SCAN Disk Scheduling (C)
Example (Same Request Set)
Input
Enter number of requests: 8 Enter requests: 98 183 37 122 14 124 65 67 Enter initial head position: 53 Enter disk size (max track number): 200
Sorted Requests
Sample Run (RIGHT direction only)
Service right side:
53 → 65 → 67 → 98 → 122 → 124 → 183 → 199
Jump to start:
199 → 0
Continue:
0 → 14 → 37
Output Table
Observation
| Algorithm | Head Movement |
|---|---|
| FCFS | 640 |
| SSTF | 236 |
| SCAN | 331 |
| C-SCAN | 382 |
👉 C-SCAN may move more than SCAN but provides fairer waiting time.
Result
The C-SCAN disk scheduling algorithm was successfully implemented and tested.
For the given example, total head movement = 382 tracks.
Comments
Post a Comment