Exercise with solution on FCFS – First Come, First Served Process Scheduling

By: Prof. Dr. Fazal Rehman | Last updated: July 28, 2024

Question 1:

Given the following processes with their arrival times and burst times, calculate the turnaround time and waiting time for each process using FCFS scheduling.

Process ID Arrival Time Burst Time
P1 0 5
P2 1 3
P3 2 8
P4 3 6

Answer :

FCFS Scheduling executes processes in the order they arrive.

  1. Completion Times:
    • P1: Completes at 0 + 5 = 5
    • P2: Completes at 5 + 3 = 8
    • P3: Completes at 8 + 8 = 16
    • P4: Completes at 16 + 6 = 22
  2. Turnaround Times (TAT):
    • P1: TAT = 5 – 0 = 5
    • P2: TAT = 8 – 1 = 7
    • P3: TAT = 16 – 2 = 14
    • P4: TAT = 22 – 3 = 19
  3. Waiting Times (WT):
    • P1: WT = 0
    • P2: WT = 5 – 1 = 4
    • P3: WT = 8 – 2 = 6
    • P4: WT = 16 – 3 = 13
Process ID Arrival Time Burst Time Completion Time Turnaround Time Waiting Time
P1 0 5 5 5 0
P2 1 3 8 7 4
P3 2 8 16 14 6
P4 3 6 22 19 13

Average Turnaround Time = (5 + 7 + 14 + 19) / 4 = 11.25
Average Waiting Time = (0 + 4 + 6 + 13) / 4 = 5.75


Question 2:

Consider the following processes that arrive at different times. Calculate the completion time, turnaround time, and waiting time for each process using FCFS scheduling.

Process ID Arrival Time Burst Time
P1 2 6
P2 5 2
P3 1 8
P4 0 3

Answer 2:

FCFS Scheduling executes processes in the order they arrive.

  1. Order of Execution: P4 -> P3 -> P1 -> P2
  2. Completion Times:
    • P4: Completes at 0 + 3 = 3
    • P3: Completes at 3 + 8 = 11
    • P1: Completes at 11 + 6 = 17
    • P2: Completes at 17 + 2 = 19
  3. Turnaround Times (TAT):
    • P4: TAT = 3 – 0 = 3
    • P3: TAT = 11 – 1 = 10
    • P1: TAT = 17 – 2 = 15
    • P2: TAT = 19 – 5 = 14
  4. Waiting Times (WT):
    • P4: WT = 0
    • P3: WT = 3 – 1 = 2
    • P1: WT = 11 – 2 = 9
    • P2: WT = 17 – 5 = 12
Process ID Arrival Time Burst Time Completion Time Turnaround Time Waiting Time
P4 0 3 3 3 0
P3 1 8 11 10 2
P1 2 6 17 15 9
P2 5 2 19 14 12

Average Turnaround Time = (3 + 10 + 15 + 14) / 4 = 10.5
Average Waiting Time = (0 + 2 + 9 + 12) / 4 = 5.75

Gantt Chart


Question 3:

Given the following processes with their arrival times and burst times, determine the Gantt chart, and calculate the average turnaround time and average waiting time using FCFS scheduling.

Process ID Arrival Time Burst Time
P1 0 4
P2 1 5
P3 2 3
P4 3 2
P5 4 4

Answer 3:

FCFS Scheduling executes processes in the order they arrive.

  1. Completion Times:
    • P1: Completes at 0 + 4 = 4
    • P2: Completes at 4 + 5 = 9
    • P3: Completes at 9 + 3 = 12
    • P4: Completes at 12 + 2 = 14
    • P5: Completes at 14 + 4 = 18
  2. Turnaround Times (TAT):
    • P1: TAT = 4 – 0 = 4
    • P2: TAT = 9 – 1 = 8
    • P3: TAT = 12 – 2 = 10
    • P4: TAT = 14 – 3 = 11
    • P5: TAT = 18 – 4 = 14
  3. Waiting Times (WT):
    • P1: WT = 0
    • P2: WT = 4 – 1 = 3
    • P3: WT = 9 – 2 = 7
    • P4: WT = 12 – 3 = 9
    • P5: WT = 14 – 4 = 10
Process ID Arrival Time Burst Time Completion Time Turnaround Time Waiting Time
P1 0 4 4 4 0
P2 1 5 9 8 3
P3 2 3 12 10 7
P4 3 2 14 11 9
P5 4 4 18 14 10

Average Turnaround Time = (4 + 8 + 10 + 11 + 14) / 5 = 47 / 5 = 9.4
Average Waiting Time = (0 + 3 + 7 + 9 + 10) / 5 = 29 / 5 = 5.8

Gantt Chart

Tutorial on First Come First Served Process Scheduling

All Copyrights Reserved 2025 Reserved by T4Tutorials