Explain first come first served (FCFS) algorithm. Give one example. State any one advantages and one disadvantage. | Operating System Question & Answer

 First-Come - First-Served (FCFS) Scheduling FCFS scheduling is non preemptive algorithm.  
 Once the CPU is allocated to a process, it keeps the CPU until it releases the CPU, either by terminating or by requesting I/O.  
 In this algorithm, a process, that a request the CPU first, is allocated the CPU first. FCFS scheduling is implemented 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 available, it is allocated to the process at the head of the queue. Once the CPU is allocated to a process, that process is removed from the queue.  
 The process releases the CPU by its own.

Example: 

Suppose that the processes arrive in the order: P1, P2, P3
Gantt Chart: 


Average waiting time: (0 + 24 + 27)/3 = 17
Average turn around time: (24 + 27 + 30)/3 = 27

Advantage:
It is simple to implement.

Disadvantage: 
 This scheduling method is non preemptive, that is, the process will run until it finishes. Because of this non preemptive scheduling, short processes which are at the back of the queue have to wait for the long process at the front to finish. 
 It is not suitable for real time systems.
 Average waiting time and average turnaround time is more comparatively.

Post a Comment

0 Comments