Course contentsShow
← Computer Science
Lesson 1252 of 2,87229. CPU SchedulingFree lesson

First-Come, First-Served (FCFS) Scheduling

Learn the simplest scheduling algorithm where processes are executed in arrival order and its convoy effect problem.

First-Come, First-Served (FCFS) Scheduling

What you'll learn: You'll understand the simplest CPU scheduling algorithm that executes processes in the exact order they arrive, and why it can cause significant performance problems.

The Core Idea

First-Come, First-Served (FCFS) is the most straightforward scheduling algorithm: processes are executed in the order they arrive in the ready queue. Think of it like a single checkout line at a grocery store—whoever gets in line first gets served first, no matter how many items they have.

When a process arrives, it's placed at the end of the ready queue. The CPU runs the first process until it completes (non-preemptive), then moves to the next one. There's no priority, no interruption, just pure sequential execution.

How It Works

Imagine three processes arrive in this order:

  1. Process A needs 24ms of CPU time
  2. Process B needs 3ms of CPU time
  3. Process C needs 3ms of CPU time

With FCFS, Process A runs completely (0-24ms), then B (24-27ms), then C (27-30ms). Process B and C must wait the full 24ms even though they need very little CPU time.

The Convoy Effect Problem

This scenario illustrates the convoy effect—when short processes get stuck waiting behind long ones, like cars trapped behind a slow-moving truck on a single-lane road. Average waiting time becomes poor because quick jobs can't jump ahead.

In our example, average waiting time = (0 + 24 + 27) / 3 = 17ms. If the short processes had arrived first, it would be much better!

Key Takeaway: FCFS is simple to implement but suffers from the convoy effect, where short processes experience long waiting times when stuck behind CPU-intensive processes, resulting in poor average performance metrics.