LOOK Disk Scheduling Algorithm
LOOK Disk Scheduling Algorithm
Aim
To simulate the LOOK disk scheduling algorithm and calculate the total head movement with an example.
Theory
LOOK is an improved version of SCAN.
-
In SCAN, the head moves to the disk end (0 or max track) even if no request exists there.
-
In LOOK, the head only goes as far as the last request in that direction, then reverses.
👉 It “looks ahead” for pending requests before moving further — hence the name LOOK.
Key Idea
| SCAN | LOOK |
|---|---|
| Goes to disk end always | Stops at last request |
| Extra unnecessary movement | Avoids unnecessary movement |
| Less efficient | More efficient |
Algorithm
-
Read disk requests.
-
Read initial head position.
-
Sort the request queue.
-
Choose direction (LEFT or RIGHT).
-
If RIGHT:
-
Service all requests greater than head in ascending order.
-
Reverse direction.
-
Service remaining smaller requests in descending order.
-
-
If LEFT:
-
Service smaller requests first.
-
Reverse and service larger ones.
-
-
Sum total head movement.
Program: C-SCAN Disk Scheduling (C)
Example Run
Input
Enter number of requests: 8 Enter the requests: 98 183 37 122 14 124 65 67 Enter initial head position: 53 Enter direction (1 = RIGHT, 0 = LEFT): 1
Step 1: Sort Requests
Step 2: Service RIGHT side first
Requests greater than 53:
Head moves:
53 → 65 → 67 → 98 → 122 → 124 → 183
Step 3: Reverse direction
Remaining requests:
Head moves:
183 → 37 → 14
Sample Run Table
Comparison with SCAN
| Algorithm | Movement |
|---|---|
| SCAN | 331 |
| LOOK | 299 |
👉 LOOK saves movement because it does NOT go to track 199.
Advantages
-
Avoids unnecessary movement to disk ends
-
Better performance than SCAN
-
Fair servicing of requests
-
Reduced seek time
Disadvantages
-
Slightly more complex than FCFS
-
Still direction-based (not optimal like SSTF)
Result
The LOOK disk scheduling algorithm was successfully simulated.
For the given example, the total head movement = 299 tracks, which is less than SCAN.
Comments
Post a Comment