# Disk Scheduling

#### What is Disk Scheduling?

As a computer deals with multiple processes over time, requests to access the disk accumulate. The way that the operating system determines which requests to satisfy first is called disk scheduling.&#x20;

&#x20;A magnetic disk is organized as a stack of platters, each platter divided into tracks and sectors. The set of corresponding tracks on all platters is called a cylinder.&#x20;

<figure><img src="https://3601924473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgFpI6H35EMjG52w5PcIP%2Fuploads%2F9AaHerwRfjni7aGcKRRo%2FScreenshot%202024-09-04%20152910.png?alt=media&#x26;token=c65884b3-7c17-4047-a792-f123997e8092" alt=""><figcaption></figcaption></figure>



Things to consider:&#x20;

**Seak Time** is the time it takes for the heads to reach the appropriate cylinder.&#x20;

#### I / O Requests

1. The first thing that gets sent is a request for input or output.
2. File handle (The name of the file)
3. Memory address for the transfer
4. amount of data to be transferred

If the drive controller is available, then the request is processed; if not, then it is added to a queue.

### First come, first serve&#x20;

It is super easy and straightforward.&#x20;

<figure><img src="https://3601924473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgFpI6H35EMjG52w5PcIP%2Fuploads%2Fw7CeVg7arC6VrTjQ9mpy%2Fimage.png?alt=media&#x26;token=9e81295e-6902-4810-9f8f-8c26268671a7" alt=""><figcaption></figcaption></figure>

&#x20;The Disk Head Position starts at 53, then goes to 98 and so forth. There is a lot of moving back and forth. This is longer and takes a lot of movement.

### Scan

Scan is more of an elevator algorithm. The head is going to start from, lets say, 53 again, and then work its way down to 0, then jump to 199&#x20;

<figure><img src="https://3601924473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgFpI6H35EMjG52w5PcIP%2Fuploads%2FS5hh9myRWaKEZFkX8bBO%2Fimage.png?alt=media&#x26;token=e80c8b67-000d-49d5-a3cd-48a17d8e975a" alt=""><figcaption></figcaption></figure>

It alawys moves from the left. The way that the disk Schudel is, it is always working in the order of what it can hit on its way. Some potential issues of this are if you get a lot of requests for a certain region while your disk is in a different area handling new requests when there are still a lot of old requests that need to be handled. This can cause starvation to the disk.&#x20;
