Skip to content
ExtendedSource checked

First Come First Served Scheduling

Runs tasks in the order they arrive.

Quick Facts

Compact metadata for implementation and discovery.

Category
Scheduling
Difficulty
Beginner
Family
Queue Scheduling
Tier
Extended
Status
Verified
Review
Source Checked
Sources
1
Formulas
0
Relationships
1
Code example
Ready
Visualization
Ready
Aliases
FCFS

Overview

First Come First Served Scheduling is a simple non-preemptive policy that processes the oldest ready task first.

Core Concepts

task orderingqueue frontierprocess schedulingqueue schedulingready queuetask priorityresource allocation

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(n)

Average

O(n log n)

Worst

O(n log n)

Space

O(n)

When to Use

  • Use First Come First Served Scheduling when you need to keep tasks in arrival order.
  • Use it for batch queues with inputs like tasks with arrival times.
  • Use it when tasks, priorities, deadlines, or resource limits drive execution order.
  • Use it when the Queue Scheduling tradeoff is acceptable for the problem size.

When Not to Use

  • Avoid it when fairness, latency, and throughput requirements conflict but are not prioritized.
  • Avoid it when the required output is not execution order.

What It Does

  • Keeps tasks in arrival order
  • Runs each task until completion

Use Cases

  • Batch queues
  • Simple service systems
  • Scheduling education

Inputs

  • Tasks with arrival times

Outputs

  • Execution order
  • Waiting and completion times

Pseudocode

  1. 1.Sort or receive tasks by arrival time
  2. 2.Place ready tasks in a queue
  3. 3.Run the front task until it finishes
  4. 4.Remove it and run the next task
  5. 5.Repeat until all tasks finish

Canonical Example

Input
tasks = A(4ms), B(2ms), C(1ms)
Output
execution order and completion times
Explanation
First Come First Served Scheduling: The scheduler chooses which task should run next according to its rule.

Implementation Notes

  • Keep the input contract explicit: Tasks with arrival times.
  • Use this step as the implementation spine: Sort or receive tasks by arrival time.
  • Then preserve the next state change: Place ready tasks in a queue.
  • Record arrival time, remaining work, and completion time so schedule metrics can be checked.

Common Pitfalls

  • FCFS is fair by arrival order but can suffer from long tasks blocking short tasks.
  • Ignoring starvation, preemption cost, or inaccurate duration estimates.
  • Returning execution order without handling empty, invalid, or boundary inputs.

Interactive Mechanism Walkthrough

Graph Frontier & Edge Relaxation

Show tasks entering and leaving a queue in arrival order.

First Come First Served Scheduling mechanism walkthrough step 1 of 5suvwxt
Step 1 of 5: Sort or receive tasks by arrival time
arrival-queue

Notes

First Come First Served Scheduling operates in O(n log n) time and O(n) space within the Queue Scheduling family. Often compared with Shortest Job First and Round Robin Scheduling.

Sources (1)

What each reference supports for this entry.

Operating System Concepts

Book

Operating-systems reference for first-come-first-served scheduling and FIFO ready-queue dispatch.

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Alternative toShortest Job First

First-come-first-served preserves arrival order, while shortest-job-first reorders by estimated duration.

Tags

SchedulingQueueOperating Systems