0
0
Operating-systemsConceptBeginner · 3 min read

FCFS Disk Scheduling: How It Works and When to Use

FCFS disk scheduling is a simple method where disk requests are handled in the exact order they arrive, like a queue. It processes each request fully before moving to the next without reordering.
⚙️

How It Works

FCFS stands for First-Come, First-Served. Imagine a line at a grocery store checkout where customers are served in the order they arrive. Similarly, in FCFS disk scheduling, the disk controller processes read or write requests in the exact order they come in.

When a request arrives, the disk head moves to the requested location and completes the operation before moving on to the next request. This method is straightforward and fair because no request jumps ahead, but it may cause delays if a request far from the current head position comes early.

💻

Example

This example shows how FCFS schedules disk requests arriving at different positions on the disk.

python
def fcfs_disk_scheduling(requests, head_start):
    total_movement = 0
    current_position = head_start
    for request in requests:
        movement = abs(request - current_position)
        total_movement += movement
        print(f"Move from {current_position} to {request} with movement {movement}")
        current_position = request
    print(f"Total head movement: {total_movement}")

# Disk requests in order
requests = [55, 58, 39, 18, 90, 160, 150, 38, 184]
head_start = 50
fcfs_disk_scheduling(requests, head_start)
Output
Move from 50 to 55 with movement 5 Move from 55 to 58 with movement 3 Move from 58 to 39 with movement 19 Move from 39 to 18 with movement 21 Move from 18 to 90 with movement 72 Move from 90 to 160 with movement 70 Move from 160 to 150 with movement 10 Move from 150 to 38 with movement 112 Move from 38 to 184 with movement 146 Total head movement: 458
🎯

When to Use

FCFS disk scheduling is best when simplicity and fairness are more important than speed. It is easy to implement and ensures every request is handled in order, which can be useful in systems where requests must be processed sequentially.

However, it is not efficient for heavy disk usage because it can cause long wait times if requests are scattered. It is suitable for small or lightly loaded systems or when predictability is needed over performance.

Key Points

  • FCFS processes disk requests in the order they arrive.
  • It is simple and fair but can cause long delays.
  • Not efficient for disks with many scattered requests.
  • Good for systems needing predictable, sequential processing.

Key Takeaways

FCFS disk scheduling handles requests in arrival order without reordering.
It is simple and fair but can lead to high disk head movement and delays.
Best used in systems with low disk request load or where order matters.
Not suitable for performance-critical systems with many random requests.