What is FCFS scheduling?

Why Interviewers Ask This

Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid Operating Systems basics — a prerequisite for any developer role.

Answer

First Come First Served (FCFS) is the simplest CPU scheduling algorithm. Processes are scheduled in the order they arrive in the ready queue — a FIFO queue. The process at the front gets the CPU; new arrivals go to the back. Example: Processes: P1 (burst: 24ms), P2 (burst: 3ms), P3 (burst: 3ms) arriving at t=0: P1 → P2 → P3 (in arrival order). Gantt chart: |P1(0-24)|P2(24-27)|P3(27-30)|. Waiting times: P1=0ms, P2=24ms, P3=27ms. Average waiting time = (0+24+27)/3 = 17ms. Convoy effect: if P3 and P2 arrived first: |P3(0-3)|P2(3-6)|P1(6-30)|. Waiting: P3=0, P2=3, P1=6. Average = 3ms — much better! If a CPU-intensive process arrives before many short I/O-bound processes, all short processes wait for the long one. This is the Convoy Effect — a major problem with FCFS. Characteristics: non-preemptive; simple implementation (just a queue); poor average waiting time for mixed workloads; no starvation (every process eventually runs); poor for interactive systems (long waits for short processes); fair in the "first-come" sense. Performance: depends heavily on arrival order. Optimal if processes arrive with shortest first. Worst if longest arrives first. Used in: batch systems where fairness by arrival order is acceptable, real-time disk scheduling variation (SCAN algorithms build on FCFS).

Pro Tip

If you're unsure about a detail, say so honestly and explain your reasoning. Interviewers respect candidates who can think through uncertainty rather than bluffing.