Operating
System
CSE-3107
MD.SHAHRIAR PERVEZ EFTI
Student of CSE Department
First Come First Serve (FCFS)
First Come First Serve (FCFS) is a type of scheduling algorithm used
by operating systems.
2
FCFS is a non-preemptive scheduling algorithm
Non-preemptive
Non-preemptive scheduling is a CPU scheduling technique that holds a process
until it finishes or is pushed into a waiting state. No process is interrupted until it
completes.
3
4
FCFS With Arrival Time
Here, the Arrival Time of P3 is 0.So, P3 Arrive first.
Process AT BT CT TAT WT
P1
P2
P3
P4
P5
3
4
0
3
5
1
5
2
7
5
5
P3
GanttChart:
0 2
Here, Due to the arrival time of p3 being 0, P3 sits first in the ganttchart and runs for
2s
Process AT BT CT TAT WT
P1
P2
P3
P4
P5
3
4
0
3
5
1
5
2
7
5
6
P3 P1
GanttChart:
0 2 3
Now we will check if any processor
has arrived in 2 units of time .
After checking we see that no
process arrived in 2 units of time but
again 2 new processes P1 and P4
both arrive in 3 units of time.
Here, According to the sequence P1
is located before P4 .So before P1
arrives. And from 2 units of time to 3
unit of time the CPU will be idle.
Proces
s
AT BT CT TAT WT
P1
P2
P3
P4
P5
3
4
0
3
5
1
5
2
7
5
7
7
Proces
s
AT BT CT TAT WT
P1
P2
P3
P4
P5
3
4
0
3
5
1
5
2
7
5
P3 P1 P4 P2 P5
GanttChart:
0 2 3 4 11 16 21
Now we will check if any processor
has arrived in 3 units of time .
After checking we see that P1 & P4
arrive in 3 units of time. But P1
arrive first and then P4 because of
their sequence of order whose
finishing time are 4 & 11.
Then we will check in same way.
After checking we see that P2 will sit
and then P5 will sit whose finishing
time are 16 & 21.
8
Proces
s
AT BT CT TAT WT
P1
P2
P3
P4
P5
3
4
0
3
5
1
5
2
7
5
4
6
2
11
21
1
12
2
8
16
0
7
0
1
11
P3 P1 P4 P2 P5
GanttChart:
0 2 3 4 11 16 21
Completion time(CT) of Process is
collected from Gantt chart.
Trun around time is calculated by
these TAT=CT-AT.
Waiting time is calculated by these
WT=TAT-BT.
9
FCFS Without Arrival Time
Here, Process will sits Gantt chart in according to their order.
Process BT CT TAT WT
P1
P2
P3
P4
P5
3
4
0
3
5
1
5
2
7
5
P1 P2 P3 P4 P5
0 1 6 8 15 20
Process BT CT TAT WT
P1
P2
P3
P4
P5
3
4
0
3
5
1
6
8
15
20
1
6
8
15
20
0
1
6
8
15
TAT=CT Due to
absence of AT
WT=TAT-BT.
10
Any
questions?
11
Thanks You!
12

First Come First Serve (FCFS).pptx

  • 1.
  • 2.
    First Come FirstServe (FCFS) First Come First Serve (FCFS) is a type of scheduling algorithm used by operating systems. 2 FCFS is a non-preemptive scheduling algorithm
  • 3.
    Non-preemptive Non-preemptive scheduling isa CPU scheduling technique that holds a process until it finishes or is pushed into a waiting state. No process is interrupted until it completes. 3
  • 4.
    4 FCFS With ArrivalTime Here, the Arrival Time of P3 is 0.So, P3 Arrive first. Process AT BT CT TAT WT P1 P2 P3 P4 P5 3 4 0 3 5 1 5 2 7 5
  • 5.
    5 P3 GanttChart: 0 2 Here, Dueto the arrival time of p3 being 0, P3 sits first in the ganttchart and runs for 2s Process AT BT CT TAT WT P1 P2 P3 P4 P5 3 4 0 3 5 1 5 2 7 5
  • 6.
    6 P3 P1 GanttChart: 0 23 Now we will check if any processor has arrived in 2 units of time . After checking we see that no process arrived in 2 units of time but again 2 new processes P1 and P4 both arrive in 3 units of time. Here, According to the sequence P1 is located before P4 .So before P1 arrives. And from 2 units of time to 3 unit of time the CPU will be idle. Proces s AT BT CT TAT WT P1 P2 P3 P4 P5 3 4 0 3 5 1 5 2 7 5
  • 7.
    7 7 Proces s AT BT CTTAT WT P1 P2 P3 P4 P5 3 4 0 3 5 1 5 2 7 5 P3 P1 P4 P2 P5 GanttChart: 0 2 3 4 11 16 21 Now we will check if any processor has arrived in 3 units of time . After checking we see that P1 & P4 arrive in 3 units of time. But P1 arrive first and then P4 because of their sequence of order whose finishing time are 4 & 11. Then we will check in same way. After checking we see that P2 will sit and then P5 will sit whose finishing time are 16 & 21.
  • 8.
    8 Proces s AT BT CTTAT WT P1 P2 P3 P4 P5 3 4 0 3 5 1 5 2 7 5 4 6 2 11 21 1 12 2 8 16 0 7 0 1 11 P3 P1 P4 P2 P5 GanttChart: 0 2 3 4 11 16 21 Completion time(CT) of Process is collected from Gantt chart. Trun around time is calculated by these TAT=CT-AT. Waiting time is calculated by these WT=TAT-BT.
  • 9.
    9 FCFS Without ArrivalTime Here, Process will sits Gantt chart in according to their order. Process BT CT TAT WT P1 P2 P3 P4 P5 3 4 0 3 5 1 5 2 7 5
  • 10.
    P1 P2 P3P4 P5 0 1 6 8 15 20 Process BT CT TAT WT P1 P2 P3 P4 P5 3 4 0 3 5 1 6 8 15 20 1 6 8 15 20 0 1 6 8 15 TAT=CT Due to absence of AT WT=TAT-BT. 10
  • 11.
  • 12.