0
0
Operating Systemsknowledge~10 mins

FCFS (First Come First Served) in Operating Systems - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - FCFS (First Come First Served)
Processes arrive in order
Queue processes by arrival time
Pick first process in queue
Run process to completion
Remove process from queue
Repeat for next process
All done
FCFS schedules processes in the order they arrive, running each to completion before starting the next.
Execution Sample
Operating Systems
Processes = ['P1', 'P2', 'P3']
Arrival = [0, 2, 4]
Burst = [5, 3, 1]
Schedule by arrival
Run each fully in order
This example shows three processes arriving at different times, scheduled and run one after another in arrival order.
Analysis Table
StepCurrent TimeProcess SelectedProcess Start TimeProcess End TimeQueue State
10P105[P1]
25P258[P2, P3]
38P389[P3]
49NoneN/AN/A[]
💡 All processes completed; queue is empty.
State Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
Current Time05899
Queue[P1][P2, P3][P3][][]
Process SelectedNoneP1P2P3None
Key Insights - 2 Insights
Why does the CPU wait if the next process hasn't arrived yet?
In FCFS, the CPU is idle if no process has arrived by the current time. For example, if the next process arrives after the current time, the CPU waits until that arrival.
Can a process be interrupted once it starts?
No, FCFS runs each process fully until it finishes before starting the next one, as shown by continuous start and end times in execution_table rows.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at Step 2. What is the current time when process P2 starts?
A2
B5
C8
D0
💡 Hint
Check the 'Process Start Time' column for Step 2 in execution_table.
At which step does the queue become empty?
AStep 3
BStep 2
CStep 4
DStep 1
💡 Hint
Look at the 'Queue State' column in execution_table to see when it becomes [].
If process P3 arrived earlier at time 3, how would that affect the queue at Step 2?
ANo change; queue stays the same
BP3 would be ahead of P2 in the queue
CP3 would run before P1
DP3 would be removed from the queue
💡 Hint
FCFS orders by arrival time; check variable_tracker for queue order changes.
Concept Snapshot
FCFS (First Come First Served):
- Processes run in order of arrival.
- Each process runs fully before next starts.
- Simple, non-preemptive scheduling.
- Can cause waiting if early processes are long.
- Easy to understand and implement.
Full Transcript
FCFS scheduling runs processes in the order they arrive. The CPU picks the first process in the queue and runs it fully before moving to the next. If no process has arrived, the CPU waits. This method is simple but can cause delays if early processes take long. The execution table shows how current time advances as each process runs, and the queue shrinks until empty.