What is First-Come-First-Served (FCFS) Scheduling?
Learn FCFS CPU scheduling — FIFO dispatch, the convoy effect, and waiting time — with examples and OS interview questions answered.
Expected Interview Answer
First-Come-First-Served (FCFS) is a non-preemptive CPU scheduling algorithm that runs processes strictly in the order they arrive in the ready queue, giving each one the CPU until it completes or blocks.
FCFS maintains a simple FIFO queue: when the CPU is free, the process at the head of the queue is dispatched and runs to completion (or until it performs a blocking I/O call) before the next one starts. Its appeal is simplicity — no per-process metadata like burst time or priority is needed, and starvation is impossible since every process eventually reaches the head of the queue. The major weakness is the convoy effect: if a long CPU-bound process arrives first, every short process behind it must wait for the full duration of that long process, inflating average waiting time even though the total work done is unchanged. Because it is non-preemptive, FCFS also gives poor response time for interactive workloads, which is why real operating systems use it mainly as a tie-breaker or a component of more sophisticated multilevel schedulers rather than as the primary policy.
- Simplest scheduling algorithm to implement and reason about
- No starvation — every process reaches the head of the queue eventually
- No overhead from estimating burst times or tracking priorities
- Useful baseline for comparing average waiting time of other algorithms
AI Mentor Explanation
FCFS scheduling is like a single net bowling machine queue where players bat strictly in the order they signed up, with no player allowed to jump ahead regardless of how quick their session would be. If the first player booked a marathon two-hour session, everyone else waits the full two hours before their much shorter turn even starts. This is exactly the convoy effect: one long job at the front inflates the wait for every short job stuck behind it in the queue.
Step-by-Step Explanation
Step 1
Arrival
Each process is appended to the ready queue in the exact order it becomes runnable.
Step 2
Dispatch head of queue
When the CPU is free, the process at the front of the FIFO queue is scheduled to run.
Step 3
Run to completion
The dispatched process runs non-preemptively until it finishes or issues a blocking call — it is never interrupted mid-execution.
Step 4
Advance the queue
The next process in arrival order is dispatched, and the cycle repeats until the queue is empty.
What Interviewer Expects
- A clear definition centered on strict arrival-order, non-preemptive dispatch
- Explanation of the convoy effect and why it hurts average waiting time
- Recognition that FCFS cannot starve any process
- Awareness that FCFS is a poor fit for interactive, response-time-sensitive workloads
Common Mistakes
- Claiming FCFS is preemptive
- Not being able to explain the convoy effect with an example
- Confusing FCFS with priority scheduling
- Assuming FCFS minimizes average waiting time (it usually does not)
Best Answer (HR Friendly)
“FCFS scheduling simply runs processes in the exact order they show up, first one in gets the CPU first, and it keeps running until it is done before the next one starts. It is easy to implement and completely fair in terms of order, but if a long job lands at the front, every short job behind it has to wait a long time — that is called the convoy effect.”
Code Example
struct process {
int pid;
int burst_time;
int waiting_time;
int turnaround_time;
};
void fcfs_schedule(struct process procs[], int n) {
int current_time = 0;
for (int i = 0; i < n; i++) {
procs[i].waiting_time = current_time;
current_time += procs[i].burst_time;
procs[i].turnaround_time = current_time;
/* process i runs uninterrupted from its start until completion */
}
}Follow-up Questions
- What is the convoy effect and which algorithm fixes it?
- Is FCFS preemptive or non-preemptive, and why does that matter?
- How does FCFS compare to Shortest-Job-First on average waiting time?
- Why is FCFS rarely used alone in modern interactive operating systems?
MCQ Practice
1. FCFS scheduling dispatches processes based on?
FCFS is a FIFO policy — the process that arrived earliest is scheduled first, with no reordering by burst time or priority.
2. What is the convoy effect in FCFS scheduling?
When a long CPU-bound process is first in the queue, every shorter process behind it must wait for its entire duration, inflating average waiting time.
3. Can a process be starved indefinitely under FCFS?
Since FCFS never reorders the queue, every process is guaranteed to eventually reach the head and run — starvation cannot occur.
Flash Cards
What is FCFS scheduling? — A non-preemptive algorithm that runs processes strictly in their arrival order in the ready queue.
What is the convoy effect? — Short processes stuck waiting behind one long process at the front of the FIFO queue.
Is FCFS preemptive? — No — once dispatched, a process runs to completion or until it blocks.
Can FCFS starve a process? — No — the FIFO order guarantees every process eventually reaches the front.