Process execution consists of a cycle of CPU execution and I/O wait. Processes alternate between these two states. Process execution begins with a CPU burst. That is followed by an I/O burst, which is followed by another CPU burst, then another I/O burst, and so on. Eventually, the final CPU burst ends with a system request to terminate execution.
Whenever the CPU becomes idle, the operating system must select one of the processes in the ready queue to be executed. The selection process is carried out by the short-term scheduler, or CPU scheduler. The scheduler selects a process from the processes in memory that are ready to execute and allocates the CPU to that process.
The dispatcher is the module that gives control of the CPU to the process selected by the short-term scheduler. This function involves the following:
Switching context
Switching to user mode
Jumping to the proper location in the user program to restart that program
1.Average waiting time under FCFS policy is quite long.
2.A smaller process has to wait for a large amount of time before a bigger process that has been allocated CPU finishes its execution.
3.Not suitable for time sharing systems where each user gets a share of CPU at regular intervals.
1.It often cannot be implemented at the level of short-term CPU scheduling as there is no way to know the length of the next CPU burst.
2.The next CPU burst length is thereby approximated using statistical techniques like exponential average
1.The disadvantage with this algorithm is the total execution time of the process must be known before the execution.
There is a chance for starvation of processes which have lesser execution time when the longer processes are continually added.
1.Performance depends heavily on the time quantum. A very large time quantum will it make it effectively an FCFS algorithms and a very short time quantum will force a very large number of context switches.
2.A rule of thumb is that 80% of the CPU bursts must be shorter than the time quantum.
1.The response ratio of all the processes are calculated and the scheduler selects the process with the highest response ratio.
2.A process once selected will run till its completion.
3.Response ratio = (Waiting time so far + Burst Time)/Burst time.
4.Shortest processes are favoured.
As the waiting time increases, the response ratio increases and the longer jobs can get past short jobs.