CPU scheduling is the basis of all systems that supportmultiprogramming, is obtained by giving each process runningtotal control of the CPU at any given time. Due to a scheduling ofprocesses / threads can efficiently obtain optimal performance.
In a uniprocessor system can perform at most one process at a time, while other processes are running must be stored in a queue, waiting their turn. To provide the most efficient system isnecessary to make the most of waiting time, so it is not "lost time".
The scheduling is based on the analysis of behavioral processes.The execution of a process is based on a processing cycle, consisting of a sequence of operations, followed by a sequence of requests for I / O (much more expensive in terms of time, but not involving the use of the CPU) .
The programs can be divided into two categories:
-CPU bound, which require mainly of calculation operations for the CPU
-I / O bound, which require mainly of I / O
has the purpose of actually pass control of the CPU to the processes selected by the scheduler. This module performs the following operations:
-perform context switching.
-switches to user mode.
-restart the process from the right operation.
Because the dispatcher is used very infrequently, these operationsmust be performed quickly.
-in order of arrival (FCFS) the queue is to be FIFO type. Theaverage waiting time is quite long and varies depending on the arrival process. The algorithm is FCFS without preemption and due to the effect convoy, in which all processes waiting for theslower processes. With SJF algorithm (another one), the CPU is allocated to the process that will perform fewer operations on the CPU, before coming back down or stop. In the case where two or more processes should execute the same number of operations, using the FCFS algorithm.
- priority, the CPU is allocated to trial with the highest priority. The SJF is a special case of this class of algorithms.
-circular (Round Robin for istance), the CPU is assigned in turn to each process for a certain amount of time.
-multiple queues, each queue can have its own scheduling algorithm. It's necessary to establish a scheduling between queus.
-mulitple queus with feedback, in this kind of scheduling, the processed can move from one queue to another. In this way you can move the processes that use too much CPU processing time of queued low priority.