Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (1 vote)
2K views

Operating System - Elevator Algorithm

The Elevator Algorithm, also known as SCAN, is a disk scheduling algorithm that models the behavior of an elevator. It services requests by moving the disk arm/head in one direction until it reaches the edge of the disk, at which point it reverses direction and services any remaining requests in the opposite direction. A variation, called Circular SCAN or C-SCAN, ensures the disk arm returns to the first track after reaching the edge before servicing requests in the opposite direction. C-SCAN has a higher average seek time than standard SCAN.

Uploaded by

Hagane No Cire
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
2K views

Operating System - Elevator Algorithm

The Elevator Algorithm, also known as SCAN, is a disk scheduling algorithm that models the behavior of an elevator. It services requests by moving the disk arm/head in one direction until it reaches the edge of the disk, at which point it reverses direction and services any remaining requests in the opposite direction. A variation, called Circular SCAN or C-SCAN, ensures the disk arm returns to the first track after reaching the edge before servicing requests in the opposite direction. C-SCAN has a higher average seek time than standard SCAN.

Uploaded by

Hagane No Cire
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Disk Scheduling

{ Elevator Algorithm

Elevator Algorithm

What it is? And why is it called Elevator Algorithm?

Elevator Algorithm also called as Scan Algorithm

is a disk scheduling algorithmthe This algorithm is named after to determine thebuildingof the disk's behavior of a motion elevator, arm and head in servicing read and where the elevator continues to write requests. travel in its current direction (up or down) until empty, stopping only to let individuals off or to pick up new individuals heading in the same direction.

Elevator Algorithm

{ How it works?

When a new request arrives while the drive is idle, the initial arm/head movement will be in the direction of the cylinder where the data is stored, either in or out.

As additional requests arrive, requests are serviced only in the current direction of arm movement until the arm reaches the edge of the disk. When this happens, the direction of the arm reverses, and the requests that were remaining in the opposite direction are serviced, and so on.

How Elevator Algorithm Works

Elevator Algorithm

Are there any other variations?

this method ensures all requests are serviced in only one direction, that is, once the head has arrived at the outer edge of the disk, it returns to the beginning and services the new requests in this one direction only

Circular Elevator Algorithm or C-SCAN

Elevator Algorithm

{ Example

Given the following disk request sequence for a disk with 100 tracks:
list of pending disk requests (listed by track number): 44, 20, 95, 4, 50, 52, 47, 61, 87, 25 Head pointer 50 (current position of R/W heads) assume that the SCAN algorithm is currently going from a lower track number to a higher track number

Seek 1 : | 50 - 52 | Seek 2 : | 61 - 52 | Seek 3 : | 87 - 61 | Seek 4 : | 95 - 87 | Seek 5 : | 47 - 95 | Seek 6 : | 44 - 47 | Seek 7 : | 25 - 44 | Seek 8 : | 20 - 25 | Seek 9 : | 4 - 20 | Total

=2 =9 = 26 =8 = 48 =3 = 19 =5 = 16 = 136

Average Time Seek : 136 / 10 = 13.6

Elevator Algorithm

Difference between Scan and C-Scan

Example list of pending disk requests (listed by track number): 100, 50, 10, 20, 75. The starting track number for the examples will be 35. The list will need to be sorted in ascending order: 10, 20, 50, 75, 100. Direction will be upward

The following is an example showing the difference of Scan and C-Scan in terms of Average Time Seek

SCAN
Seek 1 : 50 - 35 = 15 Seek 2 : 75 - 50 = 25 Seek 3 : 100 - 75 = 25 (SCAN will just reverse direction and service the next closest disk request) Seek 4 : 20 - 100 = 80 Seek 5 : 10 - 20 = 10 Total : 155 Average : 155 / 5 = 31

C-SCAN

Seek 1 : 50 - 35 = 15 Seek 2 : 75 - 50 = 25 Seek 3 : 100 - 75 = 25 (c-scan always goes back to the first track) Seek 4: 0 - 100 = 100 Seek 5 : 10 - 0 = 10 Seek 6 : 20 - 10 = 10 Total : 185 Average : 185 / 5 = 37

You might also like