A disk contains total 200 tracks and Request Queue contains tracks 82, 170, 43, 140, 24, 16, 190. Apply FCFS and SCAN and find total track movements if head start position is at 50. Compare the results and Discuss which algorithm is better to apply?
Answers
Answer:
Disk Scheduling Algorithms
This tutorial is prepared for those that need assistance in Disk Scheduling Algorithms.
INTRODUCTION
In operating systems, seek time is very important. Since all device requests are linked in queues, the seek time is increased causing the system to slow down. Disk Scheduling Algorithms are used to reduce the total seek time of any request.
PURPOSE
The purpose of this material is to provide one with help on disk scheduling algorithms. Hopefully with this, one will be able to get a stronger grasp of what disk scheduling algorithms do.
TYPES OF DISK SCHEDULING ALGORITHMS
Although there are other algorithms that reduce the seek time of all requests, I will only concentrate on the following disk scheduling algorithms:
First Come-First Serve (FCFS)
Shortest Seek Time First (SSTF)
Elevator (SCAN)
Circular SCAN (C-SCAN)
LOOK
C-LOOK
These algorithms are not hard to understand, but they can confuse someone because they are so similar. What we are striving for by using these algorithms is keeping Head Movements (# tracks) to the least amount as possible. The less the head has to move the faster the seek time will be. I will show you and explain to you why C-LOOK is the best algorithm to use in trying to establish less seek time.
Given the following queue -- 95, 180, 34, 119, 11, 123, 62, 64 with the Read-write head initially at the track 50 and the tail track being at 199 let us now discuss the different algorithms.
1. First Come -First Serve (FCFS) [DIAGRAM] All incoming requests are placed at the end of the queue. Whatever number that is next in the queue will be the next number served. Using this algorithm doesn't provide the best results. To determine the number of head movements you would simply find the number of tracks it took to move from one request to the next. For this case it went from 50 to 95 to 180 and so on. From 50 to 95 it moved 45 tracks. If you tally up the total number of tracks you will find how many tracks it had to go through before finishing the entire request. In this example, it had a total head movement of 640 tracks. The disadvantage of this algorithm is noted by the oscillation from track 50 to track 180 and then back to track 11 to 123 then to 64. As you will soon see, this is the worse algorithm that one can use.
Answer:
SCAN disk algorithm is the best ,as compared to FCFS because it has low number of track and it has low in the average of frequency
Explanation:
FCFS
In the R/W head of disk executes the requests in the same order as they arrive by moving inward and outward of the disk
Total no. of the track
= (82-50)+(170-82)+(170-43)+(140-43)+(140-24)+(24-16)+(190-16)
=32+88+127+97+116+8+174
= 642
SCAN
In this algorithm, R/W head moves in a particular direction till the end ,by executing all the disk requests coming in this direction , all then it turns back and moves in the backward direction by executing the requests coming in the path
Total no. of the track
= (82-50)+(140-82)+(170-140)+(190-170)+(199-190)+(199-43)+(43-24)+(24-16)
= 32+58+30+20+9+ 156+19+18
=332