Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
10Activity
0 of .
Results for:
No results containing your search query
P. 1
An Efficient SJRR CPU Scheduling Algorithm

An Efficient SJRR CPU Scheduling Algorithm

Ratings: (0)|Views: 642 |Likes:
Published by ijcsis
CPU Scheduling is a vital discipline which helps us gain deep insight into the complex set of policies and mechanisms used to govern the order in which tasks are executed by the processor. This article proposes an efficient Shortest Job Round Robin (SJRR) CPU Scheduling algorithm having better average waiting time (AWT) and average turnaround time (ATT) as compared to other CPU Scheduling techniques. The primary objective of this algorithm is to optimize system performance according to the criteria deemed most important by system designers. Included in this work, is a simulation that compares the proposed algorithms with some well known practices to CPU scheduling.
CPU Scheduling is a vital discipline which helps us gain deep insight into the complex set of policies and mechanisms used to govern the order in which tasks are executed by the processor. This article proposes an efficient Shortest Job Round Robin (SJRR) CPU Scheduling algorithm having better average waiting time (AWT) and average turnaround time (ATT) as compared to other CPU Scheduling techniques. The primary objective of this algorithm is to optimize system performance according to the criteria deemed most important by system designers. Included in this work, is a simulation that compares the proposed algorithms with some well known practices to CPU scheduling.

More info:

Published by: ijcsis on Jun 12, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

11/26/2012

pdf

text

original

 
(IJCSIS) International Journal of Computer Science and Information Security,Vol. 8, No. 2, 2010
An Efficient SJRR CPU Scheduling Algorithm
Saeeda Bibi
1
, Farooque Azam
1
,
 
Sameera Amjad
1
,
 
Wasi Haider Butt
1
,Hina Gull
1
,
 
Rashid Ahmed
1
,YasirChaudhry
2
 
1
Department of Computer Engineering
College of Electrical and Mechanical Engineering, NUSTRawalpindi, Pakistan
2
Department of Computer Science
Maharishi University of ManagementFairfield,Iowa USA{saeedabb, sameerashaheen, butt.wasi, hinagull03, yasiryc }@gmail.com, farooq {farooq , rashid}@ceme.nust.edu.pk  
 Abstract
— CPU Scheduling is a vital discipline which helps usgain deep insight into the complex set of policies and mechanismsused to govern the order in which tasks are executed by theprocessor. This article proposes an efficient Shortest Job RoundRobin (SJRR) CPU Scheduling algorithm having better averagewaiting time (AWT) and average turnaround time (ATT) ascompared to other CPU Scheduling techniques. The primaryobjective of this algorithm is to optimize system performanceaccording to the criteria deemed most important by systemdesigners. Included in this work, is a simulation that comparesthe proposed algorithms with some well known practices to CPUscheduling.
 Keywords-component; First Come First Serve Algorithm,Shortest Job First Algorithm, Round Robin Algorithm, Priority Algorithm, Average Waiting Time, Turnaround Time, ResponseTime, Throughput
I.
 
I
NTRODUCTION
Scheduling is a technique which involves complex set of policies and mechanisms working at the back of a processor,instructing it the order in which it should execute a given set of processes. Process is a smallest work unit of a program whichrequires a set of resources for its execution that are allotted to itby the CPU. These processes are many in number and keepcoming in the queue one after the other. In order to executethem in a particular fashion, different scheduling techniques areemployed that enable faster and efficient process executionthereby reducing the waiting time faced by each process andincreasing CPU utilization. A process has five basic statesnamely New, Ready, Running, Waiting and Terminate [1] [5].Throughout its lifetime a process migrates between variousscheduling queues by different schedulers until it getsterminated. These queues mainly contain the ready queuewhich contains set of processes ready for CPU response. Thesecond queue is the device or the I/O queue which contains allthe processes that are waiting for I/O response [1]. Theoperating system must select processes for scheduling fromthese queues in a specific manner. This selection process usinga particular scheduling technique is carried out by schedulers.Schedulers in general try to maximize the average performanceof a system according to the given criterion [2].Scheduling Algorithms can be broadly classified intopreemptive and non-preemptive scheduling disciplines. Thealgorithm proposed in this article is preemptive in nature andattempts to give fair CPU execution time by focusing onaverage waiting time and turnaround time of a process. Thisarticle comprises of the following sections: Section 2 presentsscheduling parameters which will decide against whichparameters the new CPU scheduling algorithm will be tested.Section 3 introduces existing scheduling algorithm. Section 4explains the SJRR scheduling algorithm. Section 5 containspseudocode of the algorithm. Section 6 explains the two basicelements that make up the simulation and provide aninteractive user interface. Section 7 presents a graphicalcomparison of the new algorithm with existing techniques. Lastbut not the least Section 8 will provide conclusion of thework...II.
 
S
CHEDULING
P
ARAMETERS
Different scheduling algorithms have differentcharacteristics which decide selection of processes usingdifferent criteria for execution by CPU. The criteria whichdecide how one algorithm differs from the other have beenlisted below:
 A.
 
Processor utilization
It is the average fraction of time during which the processoris busy [2]. Being busy means the processor is not idle.
 B.
 
Throughput 
It refers to the amount of work completed in a unit of time[2]. That is, the number of user jobs executed in a unit of time.The more the number of jobs, the more work is done by thesystem.
 C.
 
Turnaround Time
It is defined as the time taken to execute a given process[1]. That is, it is the time spends by the process in the systemfrom the time of its submission until its completion by thesystem.
222http://sites.google.com/site/ijcsis/ISSN 1947-5500
 
(IJCSIS) International Journal of Computer Science and Information Security,Vol. 8, No. 2, 2010
 D.
 
Waiting Time
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 [1].That is, the amount of time spent in the ready queue by theprocess a waiting CPU execution.
  E.
 
 Response Time:
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 [1].This response time does not include the time taken to outputthat response.III.
 
O
VERVIEW
O
F
E
XISTING
CPU
 
S
CHEDULING
A
LGORITHMS
 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
 A.
 
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 [2]. 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 [3].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 [4].
 B.
 
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 [6]. 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 [3] [7].
C.
 
 Round Robin (RR) Scheduling
Round Robin is preemptive in nature. It employs FCFS forprocess execution by assigning a quantum or time slice to eachprocess [7]. 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 [3]. 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 [1].
 D.
 
Priority Based Scheduling
Priority scheduling executes processes based on theirpriority which may be assigned by the system or by the userhimself [3]. Processes with the high priority are executed firstand those with low priorities are executed next [6]. Processeswith equal priority values are executed using FCFS approach[1].
 E.
 
 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 [2].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 [1].IV.
 
SJRR
 
CPU
 
S
CHEDULING
A
LGORITHM
 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
o
 
Take burst time of the middle process andassign this value to the time quantum
 
Else
o
 
Take the average of burst time of two middlemost processes and assign this value to thetime quantum
223http://sites.google.com/site/ijcsis/ISSN 1947-5500
 
(IJCSIS) International Journal of Computer Science and Information Security,Vol. 8, No. 2, 2010
 
Find maximum number of time each process willexecute by dividing maximum burst time with timequantum then add one in the result.
 
Initialize an array with zero that is used for storing theburst time that has been completed.
 
Iterate through the given list of processes.
o
 
Initialize a variable with zero that is used as acounter.
o
 
Iterate until the burst time of the process isgreater than zero.
o
 
If burst time is greater than or equal to timequantum then
 
Store remaining burst time
 
Store completed burst time
 
Increment counter
o
 
Else
 
Store completed burst time
 
Assign zero to burst time variable
 
Increment counter
o
 
Assign value of counter minus one in counterarray
 
Iterate through the list of processes
o
 
Iterate through the length of counter array
 
If value of variable used for counteris equal to the counter of processesthen
 
Iterate through the processcoming from the list of processes
 
If value of that process isnot equal to the upcomingprocess then
o
 
Add the waitingtime of theupcoming processwith the burst timecompleted.
 
Else
 
Iterate through the list of processes
 
If that process is not equalto the upcoming processthen
o
 
Add waiting timeof the upcomingprocess with theburst timecompleted.
 
Iterate through the list of processes
o
 
Add total waiting time with waiting time of each process to find total waiting time
o
 
Add burst time and waiting time of eachprocess to find turnaround time
o
 
Add total turnaround time and turnaroundtime of each process to find total turnaroundtime
 
Average waiting time is calculated by diving totalwaiting time with total number of processes.
 
Average turnaround time is calculated by dividing totalturnaround time with total number of processes.V.
 
P
SEUDO
C
ODE
 burst
0max
0temp
0total_tatime
0.0tw_time
0.0avg_wt
0.0avg_tatime
0.0For i
process-1 to 0For j
1 to processIF btime[j-1] > btime[j]temp
btime[j-1]btime[j-1]
btime[j]btime[j]
tempptemp
proname[j-1]proname[j-1]
proname [j]proname[j]
ptempFor i
0 to processbtime[i]
bu[i]proname[i]
pname[i]IF max < btime[i]max
btime[i]b[i]
btime[iwtime[i]
0IF process%2!=0mid
(process+1)/2t
btime[mid]ELSEmid
process/2t
(btime[mid]+btime[mid+1])/2dim
max/t + 1For i
0 to processFor j
0 to dimr [i,j]
0
224http://sites.google.com/site/ijcsis/ISSN 1947-5500

Activity (10)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Hafizah Meor liked this
Peter Olima liked this
Abhishek Mishra liked this
Mudassir Hussain liked this
niks27 liked this
lekhaperumal liked this
zumarkhalid liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->