FCFS stands for First Come First Serve, this algorithm entertains the task in the order they arrived in the disk queue. It is the simplest and easy to understand disk scheduling algorithm. In this, the head or pointer moves in the direction in which the task arrives and moves till all request is served. However, the FCFS algorithm has a more fair policy of handling upcoming requests. FCFS algorithm lags in performance in comparison to all the remaining disk scheduling algorithms.
Consider a disk with 200 tracks (0-199) and the disk queue having I/O requests in the following order as follows: 98, 183, 40, 122, 10, 124, 65. The current head position of the Read\Write head is 53. Calculate the total number of track movements of Read/Write head using FCFS algorithm.
Total head movements = (98-53)+(183-98)+(183-40) +(122-40)+(122-10)+(124-10)+(124-65) = 640
C-LOOK is the modified version of the LOOK algorithm. In this algorithm, the head starts from the first request in one direction and moves towards the last request at the other end, serving all requests in between. After reaching the last request in one end, the head jumps in another direction and move towards the remaining requests and then satisfies them in the same direction as before. C-LOOK algorithm serves the requests only in one direction. Unlike FCFS, it doesn’t serve requests in order of there arrival.
Consider a disk with 200 tracks (0-199) and the disk queue having I/O requests in the following order as follows: 98, 183, 40, 122, 10, 124, 65. The current head position of the Read/Write head is 53 and will move in Right direction. Calculate the total number of track movements of Read/Write head using C-LOOK algorithm.
Total head movements = (65-53)+(98-65)+(122-98) +(124-122)+(183-124)+(183-10)+(40-10) = 333
Difference between FCFS and C-LOOK Disk Scheduling Algorithm :
S.No. FCFS DISK SCHEDULING ALGORITHM C-LOOK DISK SCHEDULING ALGORITHM 1. FCFS algorithm is easy to understand and implement. In C-LOOK there is an overhead of finding end requestssufferthe . 2. In FCFS algorithm there is high variance in response time and waiting time. In C-LOOK there is low variance in response time and waiting time. 3. FCFS doesn’t cause starvation to any request, but request can experience Convoy effect. In C-LOOK algorithm neither the requests suffers starvation nor Convoy effect. 4. FCFS is inefficient in seek movements. But it is very efficient in terms of seek movement in all the disk scheduling algorithms. 5. In the above example of FCFS, the head starts from 53 and serves the requests in the order of their arrival in disk queue. In above example of C-LOOK algorithm, the head moves from 53, serves all requests in the right direction till it reaches the last request in one end. Then it jumps to the remaining requests and serves them in the right direction only. 6. In FCFS algorithm Throughput decreases. In C-LOOK algorithm Throughput increases.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
In case you wish to attend live classes with industry experts, please refer DSA Live Classes