FCFS Scheduling Examples

In the FCFS (First-Come, First-Served) scheduling algorithm, the CPU executes the processes in the order of their arrival time. We can say that the process that comes first to the CPU will be served first.

In FCFS scheduling

  • A process that comes first in the ready queue will get the CPU first
  • If more than one process arrives at the same time, then the process that contains a smaller process ID or order number will be executed first.
  • FCFS is a non-preemptive scheduling; it means once a process starts its execution, it will continue until it completes or goes for some I/O

In this lecture, we will see multiple examples of FCFS scheduling with their Gantt charts, completion time (CT), waiting time (CT), turnaround time (TAT), Average Waiting Time (AWT), and Average Turnaround Time (ATAT). We will see various categories of FCFS, which involve I/O time, same arrival time, different arrival time, and many more

Formulas that will be used in this lecture are given below

  • Completion Time (CT) = Time at which a process completes its execution or exits. We can see in gantt chart.
  • Turnaround Time (TAT) = Completion Time (CT) − Arrival Time (AT)
  • Waiting Time (WT) = Turnaround Time (TAT) − Burst Time (BT)
  • Average Waiting Time (AWT) = Sum of all Waiting Times (WT) ÷ Total Number of Processes
  • Average Turnaround Time (ATAT) = Sum of all Turnaround Times (TAT) ÷ Total Number of Processes

Note: Completion time is also called exit time; similarly, execution time is also called Burst time.

FCFS Scheduling Example: 01

Consider there are 4 processes (P1, P2, P3, and P4) with their arrival and burst times, which are given in the following diagram

FCFS Scheduling Example - 1

By using FCFS scheduling, calculate completion time (CT), waiting time (WT), turnaround time (TAT), average waiting time (AWT), and average turnaround time (ATAT).

Solution

 

FCFS Scheduling Example 1 - Gantt Chart