FCFS Scheduling Algorithm

FCFS Scheduling Algorithm:- There are many different CPU-scheduling algorithms. In this article, we provided FCFS Scheduling in OS in Realsubtitle.

 

FCFS Scheduling Algorithm

 

By far the simplest CPU-scheduling algorithm is the first-come, first-served (FCFS) scheduling algorithm. With this scheme, the process that requests the CPU first is allocated the CPU first. The implementation of the FCPS policy is easily managed with a FIFO queue. When a process enters the ready queue, its PCB is linked to the tail of the queue. When the CPU is free, it is allocated to the process at the head of the queue. The running process is then removed from the queue. The code for FCPS scheduling is simple to write and understand. On the negative side, the average waiting time under the FCFS policy is often quite long. Scheduling Algorithms

In addition, consider the performance of FCFS scheduling in a dynamic situation. Assume we have one CPU-bound process and many I/0-bound processes. As the processes flow around the system, the following scenario may result. The CPU-bound process will get and hold the CPU. During this time, all the other processes will finish their I/0 and will move into the ready queue, waiting for the CPU. While the processes wait in the ready queue, the 1/0 devices are idle. Eventually, the CPU-bound process finishes its CPU burst. and moves to an I/0 device. All the I/0-bound processes, which have short CPU bursts, execute quickly and move back to the 1/0 queues. At this point, the CPU sits idle. The CPU-bound process will then move back to the ready queue and be allocated to the CPU. Again, all the I/O processes end up waiting in the ready queue until the CPU-bound process is done. There is a convoy effect as all the other processes wait for the one big process to get off the CPU. This effect results in lower CPU and device utilization than might be possible if the shorter processes were allowed to go first.

Note also that the FCFS scheduling algorithm is non-preemptive. Once the CPU has been allocated to a process, that process keeps the CPU until it releases the CPU, either by terminating or by requesting I/O. The FCFS algorithm is thus particularly troublesome for time-sharing systems, where it is important that each user get a share of the CPU at regular intervals. It would be disastrous to allow one process to keep the CPU for an extended period.

Leave a Reply

Your email address will not be published.