FCFS is one of the simplest scheduling algorithms, following the principle of "first come, first served," where the task that enters the system first is executed first.
FCFS is generally implemented as a non-preemptive algorithm - once a process starts executing, it cannot be interrupted by the operating system until it finishes its CPU burst.
First Come First Served Scheduling
Example Jobs Table
In this example we have a number of different processes to be executed, each arriving at a specified time and with different requirements:
Job Number - Indicates the order in which the jobs arrive
Arrival Time - When the job was added to the queue
Duration / Burst Time - How long a job will take
Number of CPUs - How many CPUs will need to be allocated for the job to run.
In first come first served scheduling, the process that arrives first is given the priority.
FCFS Process Schedule
Each process waits its turn, only starting once previously waiting processes have started. This can potentially lead to underutilization of the processor resources.
Calculating Turnaround Time
Turnaround time is total time taken to execute a process from the moment it enters the system until it completes execution and exits the system.
Turnaround Time = Completion Time − Arrival Time
Reducing turnaround time is often a goal in system optimization, as it can lead to improved user experience, faster job completion, and better resource utilization.
The average waiting time of processes in first come first served scheduling can be calculated using the formula: Total waiting time / of processes.
Pros of First Come First Served Scheduling
Simplicity
FCFS is one of the simplest scheduling algorithms to implement. It doesn't require complex calculations or data structures.
Fairness
FCFS treats all processes equally in terms of priority, giving precedence to the first process that arrives.
No starvation
FCFS ensures that no process remains indefinitely in the ready queue without getting a chance to execute. Every process eventually gets CPU time, even if it's not immediately after arrival.
Disadvantages of First Come First Served Scheduling
Poor turnaround time
FCFS may lead to longer average turnaround times, especially if processes with shorter execution times are waiting behind longer processes.
Convoy effect
If a long process arrives first, shorter processes might get stuck waiting behind it, resulting in a convoy effect where short processes suffer from increased waiting times.
Non-preemptive
FCFS is a non-preemptive scheduling algorithm, meaning once a process starts execution, it continues until it completes or enters the waiting state voluntarily. This lack of preemption can lead to inefficiencies, especially in systems where certain processes are more time-sensitive or critical.
First come first served scheduling is a non-preemptive scheduling algorithm, which means that once a process starts running, it cannot be stopped until it its execution.
One of the main drawbacks of first come first served scheduling is the issue of effect, where short processes are held up behind longer processes.
Which of the following statement is true regarding First Come First Served Scheduling?