In: Computer Science
For First Come First Served (FCFS),
First Come First Serve(FCFS):
-->FCFS is a simplest CPU scheduling algorithm .
-->it uses the Queue data structure to store the processes and to execute. what ever the process first comes into the queue that will execute first that's why it is called as First Come First Serve(FCFS).
-->a real life example of FCFS is forming a queue in the ration shop or in vote polling to station,there who will first enters into the queue ,they will do their job first.
Arrival Time(AT): the time when the process need to come into the CPU for its execution.
Completion Time(CT): the time when the process completes its full execution.
Burst time(BT): the actual time that needed for the process execution in CPU.
Turn Around Time(TAT): the total time that the process spends in the CPU.whether it may be in waiting or execution state.
TAT=CT - AT
Waiting Time(WT):the amount of time that process spends outside of the CPU util its complete execution from its arrival time.
WT=TAT - BT
-->If the average waiting time(WT) is low it means that each process only needs to wait for some time only so, this this algorithm is considered as one of the best scheduled algorithm.
-->FCFS is a Non_pre-emptive ,which means once that CPU is allocated to a particular process then until its complete execution the process holds the CPU.
-->Resource utilization is not parallel means no two processes can execute at a time.so,one process needs to wait until another process completes its execution.This is called CONVOY EFFECT.
Pros of FCFS:
-->it is non pre-emptive so, it is easy to implement the logic in system.
-->First Come First Serve is the simple real world process so, everyone can easily understand.
Cons of FCFS:
-->it is not pre-emptive so, once the process is allocated CPU it executes until it finishes,mean while other process have to wait to get CPU.
-->the average waiting time is not optimal means other scheduling types like SJF(Shortest Job First),Round Robin gives the less waiting time.