First Come First Served (FCFS) is the simplest disk scheduling algorithm that services requests in the order they arrive in the disk queue. It's a fair approach but often not the most efficient in terms of total head movement.
How FCFS Works
In FCFS disk scheduling, the disk controller simply processes I/O requests in the sequence they arrive, regardless of the location of the data being requested. The disk head moves directly from its current position to the cylinder of the next request in the queue.
The algorithm follows these steps:
- All incoming disk I/O requests are placed at the end of a FIFO queue
- The request at the front of the queue is serviced first
- After completing a request, the disk head moves to the cylinder of the next request in queue
- Total head movement is calculated by finding the absolute difference between consecutive requests
Example Calculation
Let's say we have a disk with 200 cylinders (0-199), and the head is currently at position 50. The request queue is:
| Request Sequence | 95 | 180 | 34 | 119 | 11 | 123 | 62 |
|---|
The FCFS will process these requests in order without any rearrangement:
| Head Movement | |50-95| | |95-180| | |180-34| | |34-119| | |119-11| | |11-123| | |123-62| |
|---|---|---|---|---|---|---|---|
| Distance | 45 | 85 | 146 | 85 | 108 | 112 | 61 |
Total head movement = 45 + 85 + 146 + 85 + 108 + 112 + 61 = 642 cylinders
Advantages
- Simple to implement and understand
- Fair to all processes - no starvation
- Low overhead as no additional processing is required
Disadvantages
- Often results in excessive head movement
- Does not consider the current head position when scheduling the next request
- Not optimized for performance or throughput
- Can lead to the "wild swing" problem where head moves back and forth across the disk