(IJCSIS) International Journal of Computer Science and Information Security,Vol. 8, No. 2, 2010
Scheduling algorithms do not affect the amount of timeduring which a process executes or does I/O, it affects only theamount of time spend by the process in the ready queue .That is, the amount of time spent in the ready queue by theprocess a waiting CPU execution.
While turnaround time includes total time taken by theprocess from the time of its submission until the time of itscompletion, response time is the measure of time from thesubmission of requests until the first response is produced .This response time does not include the time taken to outputthat response.III.
CPU scheduling algorithms aim at deciding whichprocesses in the ready queue are to be allotted to the CPU.Discussed in this section are some common CPU schedulingalgorithms
First Come First Served (FCFS) Scheduling
FCFS employs the simplest scheduling technique on thebasis of first come first served. The work load is processed inthe order of arrival, with no preemption . Once a process hasbeen submitted to the CPU, it runs into completion withoutbeing interrupted. Such a technique is fair in the case of smallerprocesses but is quite unfair for long an unimportant job .Since FCFS does not involve context switching therefore it hasminimal overhead. It has low throughput since long processescan keep processor occupied for a long time making smallprocesses suffer. As a result waiting time, turnaround time andresponse time can be low .
Shortest Job First (SJF) Scheduling
Shortest Job First is non-preemptive in nature in whichprocess with smallest estimated run time to completion isexecuted next. SJF reduces average waiting time of processesas compared to FCFS. SJF favors shorter processes over longerones which is an overhead as compared to FCFS . It selectsthe job with the smallest burst time ensuing CPU availabilityfor other processes as soon as the current process reaches itscompletion.This prevents smaller processes from suffering behindlarger processes in the ready queue for a long time  .
Round Robin (RR) Scheduling
Round Robin is preemptive in nature. It employs FCFS forprocess execution by assigning a quantum or time slice to eachprocess . As soon as the quantum expires control isforcefully taken from the current process under execution andis transferred to the next in the queue for the same period of time slice . The outcome of RR algorithm in term of performance depends entirely on the size of time quantum. If the quantum is very large, RR algorithm works the same as theFCFS algorithm. If the quantum is very small, RR algorithmmakes the user feels processor sharing between multipleprocesses very fast. Average waiting time is high because of FCFS policy and context switching .
Priority Based Scheduling
Priority scheduling executes processes based on theirpriority which may be assigned by the system or by the userhimself . Processes with the high priority are executed firstand those with low priorities are executed next . Processeswith equal priority values are executed using FCFS approach.
Multilevel Queues (MLQ) Scheduling
It is a complex scheduling technique in which workload isdivided among multiple queues employing different schedulerson different queues. Division of workload might be classifiedas system processes, interactive programs, batch jobs etc .Each high priority queue contains foreground processes whichhave priority over lower priority queues which containbackground processes. Processes keep moving between thesequeues depending on the scheduler employed on the particularqueue .IV.
Shortest Job Round Robin (SJRR) is preemptive in nature.It sorts all incoming processes based on their burst time inascending order in the ready queue. Next it uses the timequantum to execute processes. If time quantum expires beforethe process execution then CPU is preempted and given to thenext shorter waiting process in the queue. The preemptedprocess is then placed at the end of the ready queue. Theaverage waiting time and average turnaround time obtainedfrom SJRR is better than existing CPU scheduling algorithms.SJRR is fair in scheduling and effective in time sharingenvironment. In SJRR scheduling, CPU is given to eachprocess for equal time period, no process has to wait for longtime for the CPU. The explicit working of the SJRR algorithmis discussed below:
Take list of processes, their burst time, arrival time andtime quantum.
Arrange processes and their relative burst time inascending order using any sorting technique.
Iterate through the given list of processes to find theprocesses having maximum burst time and initializewaiting time of each process with zero.
If number of processes are odd then
Take burst time of the middle process andassign this value to the time quantum
Take the average of burst time of two middlemost processes and assign this value to thetime quantum