SSTF disk scheduling - operating system tutorial


Before starting with SSTF disk scheduling  - operating system tutorial, it is a request to the readers please read about basics of disk scheduling first if you are new to disk scheduling.
Last time we discussed about FCFS disk Scheduling and today we will be discussing about SSTF disk scheduling (SSTF disk scheduling  - operating system tutorial). This algorithm overcomes the disadvantages of FCFS. So, let's start, shall we?

SSTF Disk Scheduling

In FCFS we saw that the request were fulfilled in the sequence which they came. Due to this many times the read/write head has to move from one corner of disk to other corner of the disk leaving the requests which were present in between.SSTF overcomes this disadvantage of FCFS.
In SSTF we fulfill the request which is closest to the read/write head. As we will fulfill the closer requests first so the read/write head movement will decrease.
But if suppose read/write head was at 100 and the next requests are at 90 and 110. So, the distance of both the requests from read/write head is equal. In that case the read/write head will first fulfill the request which is in the direction in which the last request was fulfilled. Suppose last request fulfilled was 105, then read/write head will move towards 110 because it will not change the direction of read/write head.
Let's solve a problem to get a better understanding of the algorithm:
Show the order of execution of the requests:
                         98,183,41,122,14,124,65,67
Also compute the seek time. Read/write head is at 53 initially.

soln 
       
SSTF disk scheduling  - operating system tutorial

1. Initially read/write head is at 53. 
2. The next request closest to 53 are 41 and 65. So you can choose either of them. I have chosen 65. Total movement is 65-53=12.
3. The next closest request to 65 is 67. So read/write head moves to 67. Total movement is 67-65=2.
4. The next closest request to 67 is 41. So read/write head moves to 41. Total movement is 67-41=26.
5. The next closest request to 41 is 14. So read/write head moves to 14. Total movement is 41-14=27.
6. The next closest request to 14 is 98. So read/write head moves to 98. Total movement is 98-14=84.
7. The next closest request to 98 is 122. So read/write head moves to 122. Total movement is 122-98=24.
8. The next closest request to 122 is 124. So read/write head moves to 124. Total movement is 124-122=2.
9. The next closest request to 124 is 183. So read/write head moves to 183. Total movement is 183-124=59.
10. Total seek movements is 12+2+26+27+84+24+2+59=236.

Advantages

1. Seeks movements are reduced which is good.
2. Less waiting time and response time. Since we are choosing closest request hence response time and waiting time is less.
3. Increased Throughput.

Disadvantages

1. You will have to bear the overhead of finding the closest request.
2. We know at a time thousands of requests comes in the disk. Thus it might happen that the read/write head moves at one portion of disk only and the requests which are far away from it might starve.


Post a Comment (0)
Previous Post Next Post