Proposal 3 - Strict Alteration
3. Main memory: No deadlock handling is explicitly necessary. The memory allocated to a program is simply preempted by swapping out the program
5.3 Key words
7.2.2 Disk Scheduling
For a multiprogramming system with many processes, the disk queue may often be non-empty. Thus, when a request is complete, the disk scheduler has to pick a new request from the queue and service it. As apparent, the amount of head movement needed to satisfy a series of I/O requests could affect the performance. For this reason, a number of scheduling algorithms have been proposed.
7.2.2.1 First cum first served (FCFS) scheduling
This form of scheduling is the simplest one but may not provide the best service.
The algorithm is very easy to implement. In it the system picks every time the first request from the disk queue. In this scheduling the total seek time may be substantially high as evident from the following example:
Considered an ordered disk queue with requests involving tracks:
86,140, 23, 50, 12, 89, 14, 120, 64
The following figure shows the movement of read/write head in First Come First Serve scheduling.
12 14 23 50 58 64 86 89 120 140
Queue: 86, 140, 23, 50, 12, 89, 14, 120, 64 Head starts at 58
Figure 2: First Come First Serve Disk scheduling
As evident from the above figure, a lot of time (i.e. seek time) is consumed in to and fro movement of the head.
7.2.2.2 Shortest seek time first (SSTF) scheduling
This scheduling algorithm services the request whose track position is closest to the current track position. Shortest-Seek-Time-First selects the request that is asking for minimum seek time from the current head position. Since seek time is generally proportional to the track difference between the requests, this approach is implemented by moving the head to the closest track in the request queue.
The following figure shows the read/write head movement in Shortest-Seek-Time-First scheduling for the above example discussed in First Come First Serve scheduling. It shows a substantial improvement in disk services i.e. reduction in the total movement of the head resulting into the reduced seek time.
Shortest Seek Time First is just like the Shortest Job First process scheduling.
So it is having the limitations of Shortest Job First also. It may cause starvation of some requests.
12 14 23 50 58 64 86 89 120 140
Queue: 86, 140, 23, 50, 12, 89, 14, 120, 64 Head starts at 58
Figure 3: Shortest Seek Time First Scheduling
7.2.2.3 Scan
12 14 23 50 58 64 86 89 120 140
Queue: 86, 140, 23, 50, 12, 89, 14, 120, 64 Head starts at 58
Figure 4: Scan scheduling
In this algorithm the read/write head moves back and forth between the innermost and outermost tracks. As the head gets to each track, satisfies all outstanding requests for that track. In this algorithm also, starvation is possible only if there are repeated requests for the current track. The scan algorithm is sometimes called the elevator algorithm. As it is familiar to the behavior of elevators as they service requests to move from floor to floor in a building.
X.2.2.4 C-scan (Circular scan)
scan is a variant of scan. It is designed to provide a more uniform wait time. C-scan moves the head from one end of the disk to another, servicing requests as it goes. When it reaches the other end, however, it immediately return to the beginning of the disk, without servicing any requests on the return trip. C-scan treats the disk, as it was circular, with the last track adjacent to the first one.
12 14 23 50 58 64 86 89 120 140
Queue: 86, 140, 23, 50, 12, 89, 14, 120, 64 Head starts at 58
Figure 5: C-Scan scheduling
7.2.2.5 Look
This algorithm is also similar to scan but unlike scan, the head does not unnecessarily travel to the innermost track and outermost track on each circuit. In
this algorithm, head moves in one direction, satisfying the request for the closest track like scan in that direction. When there are no more requests in that direction the head is traveling, head reverse the direction and repeat.
7.2.2.6 N-step scan
In it the request queue is divided into sub queues with each sub queue having a maximum length of N. Sub queues are processed in FIFO order. Within a sub queue, requests are processed using Scan. While a sub queue is being serviced, incoming requests are placed in the next non-filled sub queue. N-step scan eliminates any possibility of starvation.
7.2.2.7 F-Scan
The "F" stands for "freezing" the request queue at a certain time. It is just like N-step scan but there are two sub queues only and each is of unlimited length.
While requests in one sub queue are serviced, new requests are placed in other sub queue.
7.2.3 Scheduling algorithm selection
As there are so many disk-scheduling algorithms, an important question is how to choose a scheduling algorithm that will optimize the performance. The commonly used algorithm is Shortest-Seek-Time-First and it has a natural appeal also. San and its variants are more appropriate for system with a heavy load on the disk. It is possible to define an optimal scheduling algorithm, but computational overheads required for that may not justify the savings over Shortest-Seek-Time-First and scan.
No doubt in any scheduling algorithm the performance depends on the number and types of the requests. If every time there is only one outstanding request, then the performance of all the scheduling algorithms will be more or less equivalent. Studies suggest that even First-Come-First-Serve performance will also be reasonably well.
It is also observed that performance of scheduling algorithms is also greatly influenced by the file allocation method. The requests generated by the
contiguously allocated files will result in minimum movement of the head. But in case of indexed access and direct access where the blocks of a file are scattered on the disk surface resulting into a better utilization of the storage space, there may be a lot of movement of the head.
In all these algorithms, to improve the performance, the decision is taken on the basis of head movement i.e. seek time. Latency time is not considered as a factor. Because it is not possible to predict latency time because rotational location cannot be determined. However, multiple requests for the same track may be serviced based on latency.