![FCFS Arrival Time](/wp-content/uploads/2022/11/FCFS-Arrival-1.png)
FCFS scheduling algorithm simply execute the process according to their arrival time based on FIFO Queue. The process which comes first in the ready queue will get the CPU first.
For FCFS Example 1 and Example 2, Refer FCFS Scheduling Algorithm
Example: 3
Criteria: Non-Preemptive
Mode: Arrival Time
Let’s take an example of The FCFS scheduling algorithm with Arrival Time. The processes and their respective Arrival and Burst time are given in the following table.
Process | Arrival Time | Burst Time |
---|---|---|
P1 | 2 | 6 |
P2 | 5 | 3 |
P3 | 1 | 8 |
P4 | 0 | 3 |
P5 | 4 | 4 |
Solution
Step 1: Sort the process based on arrival time from min to max. (0,1,2,4,5) => (P4,P3,P1,P5,P2)
Step 2: Lets draw the Gantt Chart with above sorted process based on arrival time
(Gantt chart)
Process | Arrival Time (AT) | Burst Time (BT) | Completion Time (CT) | Turn Around Time TAT = CT-AT | Waiting Time WT = TAT-BT | Response Time RT = ST-AT (Start Time-Arrival Time) |
---|---|---|---|---|---|---|
P1 | 2 | 6 | 17 | 15 | 9 | 9 |
P2 | 5 | 3 | 24 | 19 | 16 | 16 |
P3 | 1 | 8 | 11 | 10 | 2 | 2 |
P4 | 0 | 3 | 3 | 3 | 0 | 0 |
P5 | 4 | 4 | 21 | 17 | 13 | 13 |
In the above table, we can find the waiting time for the process P1, P2,P3,P4 and P5.
Waiting Time for P1 => 9
Waiting Time for P2 => 16
Waiting Time for P3 => 2
Waiting Time for P4 => 0
Waiting Time for P5 => 13
Average Waiting Time(AWT) =(9+16+2+0+13)/5
= 40/5
= 8
#arrival time #cpu scheduling algorithm #fcfs #operating system #os #scheduling algorithm #TAT #waiting time