Question-1 Explain First Come First Serve – FCFS scheduling algorithms with illustration.
Selection criteria :
The process that request first is served first. It means that processes are served in the exact order of their arrival.
Decision Mode :
Non preemptive: Once a process is selected, it runs until it is blocked for an I/O or some event, or it is terminated.
This strategy can be easily implemented by using FIFO queue, FIFO means First In First Out. When CPU becomes free, a process from the first position in a queue is selected to run.
Consider the following set of four processes. Their arrival time and time required to complete the execution are given in following table. Consider all time values in milliseconds.
|Process||Arrival Time (T0)||Time required for completion (∆T)(CPU Burst Time)|
Gantt Chart :
Initially only process P0 is present and it is allowed to run. But, when P0 completes, all other processes are present. So, next process P1 from ready queue is selected and allowed to run till it completes. This procedure is repeated till all processes completed their execution.
|Process||Arrival Time(T0)||CPU Burst Time(∆T)||Finish Time(T1)||Turnaround Time(TAT=T1-T0)||Waiting Time (WT=TAT-∆T)|
Average Turnaround Time: (10+15+15+17)/4 = 57/4 = 14.25 ms.
Average Waiting Time: (0+9+13+13)/4 = 35/4 = 8.75 ms.
- Simple, fair, no starvation.
- Easy to understand, easy to implement.
- Not efficient. Average waiting time is too high.
- Convoy effect is possible. All small I/O bound processes wait for one big CPU bound process to acquire CPU.
- CPU utilization may be less efficient especially when a CPU bound process is running with many I/O bound processes.