There are different parameters which are measured in
CPU Scheduling and on behalf of these parameters one
can say which algorithm is better as compare to other,
these parameters are as given here.
CPU Utilization: It is the average fraction of time, during
which the processor is busy.
Throughput: It refers to the amount of work completed
in a unit of time. The number of processes the system can
execute in a period of time. The higher the number, the
more work is done by the system.
Waiting Time: The average period of time a process
spends waiting. Waiting time may be expressed as
turnaround time less the actual execution time.
Turnaround time: The interval from the time of
submission of a process to the time of completion is the
turnaround time.
Response time: Response time is the time from
submission of a request until the first response is
produced.
3. EXISTING CPU SCHEDULING
ALGORITHMS
There are many CPU Scheduling algorithms but some of
them which are commonly used are explained below.
First-Come, First-Served (FCFS): This algorithm
allocates the CPU to the process that requests the CPU
first. This algorithm is easily managed with a FIFO
queue. New process enters the queue through the tail of
the queue and leaves through the head of the queue (when
the process is allocated to the CPU) (1). The processes are
allocated to the CPU on the basis of their arrival at the
queue. Once a process is allocated to the CPU, it is
removed from the queue. A process does not give up CPU
until it either terminates or performs IO.
Shortest-Job-First (SJF): The SJF algorithm associates
the length of the next CPU burst w ith each processes
such that that the process that have the smallest next CPU
burst is allocated to the CPU. The SJF uses the FCFS to
break tie (a situation where two processes have the same
length next CPU burst). The SJF algorithm may be
implemented as either a preemptive or non-preemptive
algorithms. When the execution of a process that is
currently running is interrupted in order to give the CPU
to a new process with a shorter next CPU burst, it is
called a preemptive SJF. On the other hand, the nonpreemptive
SJF will allow the currently running process
to finish its CPU burst before a new process is allocated to
the CPU.
Priority Scheduling (PS): The PS algorithm associates
with each process a priority and the CPU is allocated to
the process based on their priorities. Usually, lower
numbers are used to represent higher priorities. The
process with the highest priority is allocated first. If there
are multiple processes with same priority, typically the
FCFS is used to break tie.