Operating System - FCFS (First-Come, First-Served) Scheduling
Definition:
FCFS (First-Come, First-Served) is the simplest scheduling algorithm in Operating Systems.
Processes are executed in the order they arrive — like a queue at a ticket counter.
Key Characteristics:
Feature | Description |
---|---|
Type | Non-preemptive |
Scheduling Order | Based on arrival time |
Fairness | Fair but not always efficient |
Implementation | Using a FIFO queue |
Example:
Process | Arrival Time | Burst Time |
---|---|---|
P1 | 0 ms | 4 ms |
P2 | 1 ms | 3 ms |
P3 | 2 ms | 1 ms |
Execution Order (FCFS):
-
P1 arrives at 0 → starts first
-
P2 arrives at 1 → waits for P1
-
P3 arrives at 2 → waits for P1 and P2
Gantt Chart:
| P1 | P2 | P3 |
0 4 7 8
Calculations:
Process | Arrival | Burst | Start | Completion | Turnaround Time (CT - AT) | Waiting Time (TAT - BT) |
---|---|---|---|---|---|---|
P1 | 0 | 4 | 0 | 4 | 4 | 0 |
P2 | 1 | 3 | 4 | 7 | 6 | 3 |
P3 | 2 | 1 | 7 | 8 | 6 | 5 |
Advantages:
-
Simple and easy to implement.
-
Fair (no starvation).
Disadvantages:
-
Long waiting time for short processes that arrive after long ones (convoy effect).
-
Not suitable for interactive systems.
Conclusion:
FCFS is best suited for simple batch systems, but not ideal for time-sharing or interactive environments due to poor average waiting time and response time.