Desktop Experience Only

This interactive CPU Scheduling simulation requires a larger screen to display complex animations and Gantt charts properly.

Please open this link on a Laptop or Desktop computer for the best learning experience.

FCFS Algorithm

First-Come, First-Serve

First Come, First Serve (FCFS)

BACK
FRONT
Click Play to watch Enqueue & Dequeue operations.

Scenario 1

P1
P2
P3
P4
Arrival Time (ms)
CPU Burst Time (ms)
I/O Burst Time (ms)

Note: CPU Burst Time values must be between 1 and 20 ms. * This restriction is purely to keep the simulation visually clear and manageable. Real-world operating systems have no such arbitrary limits.

READY QUEUE
CPU
EXIT
P1
P2
P3
P4

Gantt Chart

Turnaround Time (TAT)

is the total time from arrival to completion

TAT = Completion Time - Arrival Time

Waiting Time (WT)

is the sum of the periods spent waiting in the ready queue.

WT = Turnaround Time - CPU Burst Time
Process
Completion Time
Turnaround Time
Waiting Time
P1
-
-
-
P2
-
-
-
P3
-
-
-
P4
-
-
-

Average Turnaround Time:

Measures how long processes take to finish overall
➔ Used to evaluate system responsiveness

= ∑ TAT / Number of processes
= ?? / 4 = ?? ms

Average Waiting Time:

Shows how long processes stay in the ready queue
➔ Used to evaluate scheduling efficiency

= ∑ WT / Number of processes
= ?? / 4 = ?? ms

Makespan:

Total time required to complete all processes
➔ Used to measure total execution duration

= Last Completion Time
= ?? ms

Throughput:

Number of processes completed per unit time
➔ Used to measure system productivity

= Number of processes / Makespan
= 4 / ?? = ?? processes / ms

These metrics are used to evaluate the performance and efficiency of scheduling algorithms.

🎯 How to evaluate scheduling efficiency?:

  • Minimize (Lower is better): Average Waiting Time, Average Turnaround Time, and Makespan.
  • Maximize (Higher is better): Throughput.

Scenario 2

P1
P2
P3
P4
Arrival Time (ms)
CPU Burst Time (ms)
I/O Burst Time (ms)

Notes:

  • Arrival Time values must be between 0 and 20 ms.
  • CPU Burst Time values must be between 1 and 20 ms.
READY QUEUE
CPU
EXIT
P1
P2
P3
P4

Gantt Chart

If 2 processes arrive at the same time, the process with the smaller ID is scheduled first.

Process
Completion Time
Turnaround Time
Waiting Time
P1
-
-
-
P2
-
-
-
P3
-
-
-
P4
-
-
-

Average Turnaround Time

= ∑ TAT / Number of processes
= ?? / 4 = ?? ms

Average Waiting Time

= ∑ WT / Number of processes
= ?? / 4 = ?? ms

Makespan

= Last Completion Time
= ?? ms

Throughput

= Number of processes / Makespan
= 4 / ?? = ?? processes / ms

Scenario 3

P1
P2
P3
P4
Arrival Time (ms)
CPU Burst Time (ms)
I/O Burst Time (ms)

Notes:

  • Arrival Time values must be between 0 and 20 ms.
  • CPU Burst Time values must be between 1 and 20 ms.
  • I/O Burst Time values must be between 0 and 20 ms, where 0 indicates no I/O.
  • When I/O is involved, the CPU Burst is divided into two phases: one executes before the I/O, and the other finishes after it.
READY QUEUE
CPU
I/O WAITING QUEUE
I/O Device
EXIT
P1
P2
P3
P4

Gantt Chart

Process
Completion Time
Turnaround Time
Waiting Time
P1
-
-
-
P2
-
-
-
P3
-
-
-
P4
-
-
-

Average Turnaround Time

= ∑ TAT / Number of processes
= ?? / 4 = ?? ms

Average Waiting Time

= ∑ WT / Number of processes
= ?? / 4 = ?? ms

Makespan

= Last Completion Time
= ?? ms

Throughput

= Number of processes / Makespan
= 4 / ?? = ?? processes / ms

Advantages & Disadvantages

Classify each statement as an Advantage or a Disadvantage of FCFS.