# First Come First Serve Scheduling Algorithm

First Come First Serve Scheduling is the simplest CPU scheduling algorithm. The criteria of First Come First Serve Scheduling algorithm are the process that requests the CPU first is holds the CPU or which process enters the ready queue first is served first. The operating system maintains a data structure that is a ready queue. If a process request the CPU then it is loaded into the ready queue which process is the head of the ready queue, connect the CPU to that process.

 Process Burst Time (ms) P1 5 P2 24 P3 16 P4 10 P5 3

Consider the following set of processes that arrive at time o, the length of the CPU burst time is given in milliseconds (ms).

## Burst time:

The burst time is the time required the CPU to execute that job, generally, it’s unit milliseconds (ms). If the processes arrive in the order P!, P2, P3, P4, P5 and it served in FCFS order.
Now, We have to calculate the average waiting time, average response time. • Average Turn Around Time:
• ```Turn Around Time = Finished time - Arrival time
Turn Around Time for P1 = 5 - 0 = 5
Turn Around Time for P2 = 29 - 0 = 29
Turn Around Time for P3 = 45 - 0 = 45
Turn Around Time for P4 = 55 - 0 = 55
Turn Around Time for P5 = 58 - 0 = 58
```

Average Turn Around Time =(5+29+45+55+58)/5 = 38.4 ms

• Average Waiting Time:
• ```Waiting Time = Starting time - Arrival time
Waiting Time for P1 = 0
Waiting Time for P2 = 5 - 0
Waiting Time for P3 = 29 - 0
Waiting Time for P4 = 45 - 0
Waiting Time for P5 = 55 - 0
```

Average Turn Waiting Time =(0+5+29+45+55)/5 = 26.8 ms

• Average Response Time:
• ```Response Time = First response - Arrival time
Response Time for P1 = 0
Response Time for P2 = 5 - 0
Response Time for P3 = 29 - 0
Response Time for P4 = 45 - 0
Response Time for P5 = 55 - 0
```

Average Response Time =(0+5+29+45+55)/5 = 26.8 ms