Example:
Suppose the order of request is- (82,170,43,140,24,16,190)
And current position of Read/Write head is : 50
FCFS:
So, total seek time:
=(82-50)+(170-82)+(170-43)+(140-43)+(140-24)+(24-16)+(190-16)
=642
SSTF:
So, total seek time:
=(50-43)+(43-24)+(24-16)+(82-16)+(140-82)+(170-40)+(190-170)
=208
SCAN:
Therefore, the seek time is calculated as:
=(199-50)+(199-16)
=332
CSCAN:
Seek time is calculated as:
=(199-50)+(199-0)+(43-0)
=391
LOOK:
So, the seek time is calculated as:
=(190-50)+(190-16)
=314
CLOOK:
So, the seek time is calculated as:
=(190-50)+(190-16)+(43-16)
=341
LIFO– In LIFO (Last In, First Out) algorithm, newest jobs are serviced before the existing ones i.e. in order of requests that get serviced the job that is newest or last entered is serviced first and then the rest in the same order.
Advantages
- Maximizes locality and resource utilization
Disadvantages
- Can seem a little unfair to other requests and if new requests keep coming in, it cause starvation to the old and existing ones.
N-STEP SCAN – It is also known as N-STEP LOOK algorithm. In this a buffer is created for N requests. All requests belonging to a buffer will be serviced in one go. Also once the buffer is full no new requests are kept in this buffer and are sent to another one. Now, when these N requests are serviced, the time comes for another top N requests and this way all get requests get a guaranteed service
Advantages
- It eliminates starvation of requests completely
- FSCAN– This algorithm uses two sub-queues. During the scan all requests in the first queue are serviced and the new incoming requests are added to the second queue. All new requests are kept on halt until the existing requests in the first queue are serviced.
Advantages
- FSCAN along with N-Step-SCAN prevents “arm stickiness” (phenomena in I/O scheduling where the scheduling algorithm continues to service requests at or near the current sector and thus prevents any seeking)
Each algorithm is unique in its own way. Overall Performance depends on the number and type of requests.
Average Rotational latency is generally taken as 1/2(Rotational latency).