Abstract— One of the core processes of an operating system is scheduling. There are 2 types of uni-processor operating system uni-programmed and multi- programmed. Uni-programming operating system execute single job at a given time while multiprogramming Operating system is capable of executing multiple jobs simultaneously. Maximize the resource utilization is the main aim of multiprogramming operating system. There are different scheduling Algorithms available for multi- programming operating system environment. But our work focuses on design and development aspect of a new and optimize scheduling algorithm for multi- programming operating system. In this paper we propose a new algorithm for CPU Scheduling. Also we made a concise study and comparison of some of the previously implemented algorithms with our proposed algorithm. The comparison chart is shown in the paper.
Index Terms— CPU Scheduling, CPU Utilization, ERR, IRR, FCFS, SJF.
I. INTRODUCTION
An Operating system is a software that act as an intermediary between the user computer and computer hardware. The aim of an operating system is to provide an environment in which a user can execute programs in efficient manner. Multiprogramming is one of the striking feature of operating systems. It requires several processes to be kept simultaneously in memory so that maximum CPU utilization can be made[9].
A. SCHEDULING:
Scheduling is most fundamental feature of an operating system. Almost all Computer devices and resources uses scheduling algorithms for their proper distribution and use.
As CPU is one of the primary resource allocator, thus its scheduling is center O.S designs. Scheduling is the plan by which the system decides which task have to bring in memory and execute at any given instance. Whenever the CPU became idle the O.S must select a process from the ready queue and execute it.
B. SCHEDULING CRITERIA:
CPU Utilization – This is a measure of how much CPU is busy. CPU utilization is the efficiency of the system which varies from 0 to 100 percent.
Throughput- Throughput is the number of processes completed in a unit time. Throughput depends upon the type of the processor.
Waiting time - Waiting time is the sum of periods when CPU is idle. CPU can only executes one process at a time.
Turnaround time - It is the total time taken by a process to complete. The difference between the arrival time of a process to the completion time is the turnaround time.
Response time - Response time is the time from the arrival of a request until the first response is produces to that request.
Context Switch – A Context switch is switching of CPU by one process or thread to another by storing the data, so that execution can be resumed from same point at a later time of the job.
C.BETTER CPUSCHEDULING CRITERIA ARE FOLLOWING:
•
Maximize Utilization of the CPU.•
Minimize the Turnaround Time, Response time, Waiting time and number of context Switches.D. Some Scheduling Algorithm:
FCFS –FCFS is the simplest scheduling algorithm. For this algorithm the ready queue is maintained as a first-in-first- out queue. The process which arrives first will be serve first.
SJF - In Shortest Job First (SJF) algorithm, the process in the queue which has the lowest burst time will be serve first.
In the case of same burst time the FCFS procedure will be followed. Starvation is possible in that algorithm.
Priority - Priority scheduling algorithm execute the process which has the highest priority.
Round Robin –In the round robin algorithms a fixed time quantum is decided and each process is allowed to execute for the given time time quantum. It is the strategy which gives equal chance to all the processes.
IRR - IRR picks the first job from the ready queue and allocate the CPU to it for a time interval of up to 1 time quantum. After completion of job time quantum, it checks the remaining CPU time of the currently running job. If the remaining CPU burst time of the currently running job is
Proposing a New Algorithm for CPU Scheduling
Vaibhav K. Singh1, Praveen Kumar2, Ajeet Gupta3
1
Department of Computer Science & Engineering, Institute of Technology,Guru
GhasidasVishwavidyalaya, Central University, Assistant Professor,Bilaspur, Chhattisgarh, India
2,3
Department of CSE, Institute of Technology, GGV, Student, Bilaspur, Chhattisgarh, India
[email protected]
less than 1 time quantum, the CPU again allocated to the currently running job for remaining CPU burst time.
ERR – ERR picks the first job from the ready queue and allocate the CPU to it for a time interval of up to 1 time quantum. After completion of job time quantum, it checks the remaining CPU time of the currently running job. If the remaining CPU burst time of the currently running job is less than avg. of burst time divided by time quantum (avgburst/tq) value, then CPU again allocated to the currently running job for remaining CPU burst time.
II. LITERATURESURVEY
In year 2009, Rami J. Matarneh [2] proposed a new type of round robin which calculate the dynamic time quantum by checking the remaining burst time of the processes.In year 2011, SarojHiranwal [3] in which firstly arrange all the processes in ascending order of their burst time, and the process with smallest burst time gets higher priority. The time slice is equal to the mid process burst time. In year 2011, H.S. Behera [4] proposes a new scheduling algorithm using dynamic time quantum along with weighted mean. In year 2013, LalitKishor& Dinesh Goyal [5] gives a median based time quantum scheduling algorithm.In year 2013, AashnaBisht [7] proposed Enhanced Round Robin(ERR), which modifies the time quantum for only those processes which require a slightly greater time than the allotted time .In year 2011, RakashMohanty&Manas Das [8] performed a work in which a new variant of Round Robin scheduling algorithms by calculating fit factor. In year 2012, P.SurendraVarma[10] performed a work, In this paper the time quantum is computed by median and highest burst time. In Year 2012, Manish Kumar Mishra [1] gives a new form of RR which, picks the first job from the ready queue and allocate the CPU to it for a time interval of up to 1 time quantum. After completion of the time slice, If the remaining CPU burst time of the currently running job is less than 1 time quantum, the CPU again allocated to the currently running process for remaining CPU time. In year 2014 RadheShyam and Sunil Kumar Nandal published a research paper on International Journal of advance research in computer science and software engineering with name
“Improved Mean Round Robin with Shortest Job First Scheduling”. They changed the time quantum according to the mean time (i.e. time quantum=mean time*highest burst time).
III. PROPOSEDWORK
CPU scheduling algorithms concentrate on maximizing throughput, CPU utilization and minimizing waiting time, response time, turnaround time and number of context switching for a set of requests. Some of the CPU scheduling algorithms are First-Come-First-Served (FCFS), Priority Scheduling, Shortest Job First (SJF) and Round Robin (RR).
FCFS is the simplest form of CPU scheduling algorithm.
These algorithms are very easy to implement, but it general they does not provide the best service. Round Robin being the most popular in time shared operating system, but it may not be suitable for real time operating systems because of high turnaround time, waiting time and large number of context switches. We have developed a new variety of round
robin algorithm which has dynamic time quantum. The time quantum depends on the jobs present in the ready queue.
Time quantum value is root mean square value of the present jobs remaining burst time. After evaluating the quantum value, the algorithm sort the jobs in ascending order of their burst time so that the turnaround time and waiting time can be reduced. Along with turnaround time and waiting time the response time is also get reduced to a large extent due to the Quantum value(i.e root mean square value).
Proposed Algorithm:
Step1: take the input of number of processes their arrival time and burst time.
Step2: arrange all the processes burst time according to their arrival time in the ascending order.
Step3: find all the processes whose arrival time is equal to the minimum arrival time of a process in the queue.
Step4: find the value of the time quantum as (quantum=(ceil)((sqrt)rms/count1) where rms= square of the burst time of count1 processes rms= √((1/count1) (A1*A1+
A2*A2 + …. + An*An), count1=whose arrival time is equal to the minimum arrival time of a process in the queue.
Step5: check if the arrival time of a process is less than the present time value then change the value of burst time according to time quantum value.
Step 6: repeat the process until the whole process is completed.
I. Arrange all the processes burst time according to their arrival time in the ascending order and count them.
II. If no process is in queue increase time quantum by 1 and repeat step6.
III. Find the value of the time quantum as (quantum=(ceil)((sqrt)rms/count) where rms= square of the burst time of count1 processes rms= √((1/count) (A1*A1+
A2*A2 + …. + An*An), count=whose arrival time is less than the present time.
IV. Change the value of burst time according to time quantum value.
V. If the sum of burst time of all the processes is zero then exit, else repeat step6.
ALGO:-
Step1 Initialization
set name true , nnumber of process, time0, sum0,rms0,arrivalsum0,
turnaroundsum0, burstsum0
,quantumtime quantum Step 2 Loop
Repeat for i0……n-1 Set arrival[i]arrival time
Set arrivalsumarrivalsum+arrival[i]
Step3 Loop
Repeat for i0……n-1
Set burst[i]burst time of process i Setburstsumburstsum+burst[i]
Step4 Loop
Repeat for i=0……..n-2 Repeat for j=0…….n-2
If(arrival[j]>arrival[j+1]) then Set temparrival[j]
Set arrival[j]arrival[j+1]
Set arrival[j+1]temp Set tempburst[j]
Set burst[j]burst[j+1]
Set burst[j+1]temp Step5
Quantumburst[0]*burst[0]
Loop
Repeat for i=1…..n-1 If(arrival[i]=arrival[i-1]) rms= rms+burst[i]*burst[i]
count1=count1+1 else
goto step 6
sort the processes according to their burst time whose arrival time is minimal arrival time.
quantum=(ceil)((sqrt)rms/count1)
Step6 loop
Repeat for i=0…….n-1
if(i=0 and burst[i]>quantum)then set response[i]time
set burst[i]burst[i]-quantum set timetime+quantum goto step5
if(i=0 and burst[i]<=quantum) set response[i]time
settimtime+burst[i]
set burst[i]0
set turnaround[i]time goto step5
if(arrival[i]<time and burst[i]>quantum) set response[i]=time
set burst[i]-=quantum set time=time+quantum goto step5
if(arrival[i]<time and burst[i]<quantum) set response[i]time
set timetime+burst[i]
set burst[i]0
set turnaround[i]time
Step7 Loop Repeat While(true) set count0 setrms0 set sum0
repeat for i=0…….n-1 set sumsum+burst[i]
if(sum=0)then goto step 8
repeat for i=0………..n-2 repeat for j=0………..n-2
if(((arrival[j]<=time)and(arrival[j+1]<=time))a nd(burst[j]>burst[j+1]))then
set temparrival[j]
set arrival[j]arrival[j+1]
set arrival[j+1]temp set tempburst[j]
set burst[j]burst[j+1]
set burst[j+1]temp repeat for i=0…….n-1
if(arrival[i]<=time and burst[i]!=0)then set count count+ 1
setrmsrms+burst[i]*burst[i]
set quantum(ceil)(sqrt(rms)/count) repeat for i=0………n-1
if(arrival[i]<time and burst[i]>quantum)then set response[i]time
set burst[i]= burst[i]-quantum set timetime+quantum
else if(arrival[i]<time and burst[i]<=quantum and burst[i]!=0)then
set response[i]time set timetime+burst[i]
set burst[i]0
set turnaround[i]time Step 8
Set TAT(turnaroundsum-arrivalsum)/n Set AWT(turnaroundsum-arrivalsum- burstsum)/n
Step9 Finish
IV. RESULTSANDCONCLUSION
In every case we compared the result of proposed DRRR with Round Robin, improved RR[1] ,enhanced RR[7]. The result of the following comparisons are as following.
CASE1:
Input set : 11,,52,35,22,80 and time quantum=20 and arrival time of all the processes is 0. Input set in random order.
Algorithm Average waiting time
Average burst time
DRRR 55.8 95.8
Round robin
85 125
ERR 74.4 114.4
IRR 61 101
FCFS 58.4 98.4
DRRR: firstly the time quantum value becomes 47 because the root mean square value of the burst time at arrival time 0 is 47. Then quantum value again changes to 24 then it again changes to 9.
P1(11) P4(22) P3(35) P2(47) P5(47) P2(5) P5(24) P5(9)
0 11 33 68 115 162 167 191 200
RR:
P1(11) P2(20) P3(20) P4(20) P5(20) P2(20) P3(15) P4(2) P5(20) P2(12) P5(20) P5(20)
0 11 31 51 71 91 111 126 128 148 160 180 200
IRR:
P1(11) P2(20) P3(20) P3(15) P4(20) P4(2) P5(20) P2(20) P2(12) P5(20) P5(20) P5(20)
0 11 31 51 66 86 88 108 128 140 160 180 200
ERR:
P1(11) P2(20) P3(20) P4(20) P2(2) P5(20) P2(20) P3(15) P5(20) P2(12) P5(20) P5(20)
0 11 31 51 71 73 93 113 128 148 160 180 200
FCFS:
P1(11) P2(52) P3(35) P4(22) P5(80)
0 11 63 98 120 200
CASE2:
Input set : 80,52,35,22,11 and time quantum =30and arrival time of all the processes is 0. Input set in increasing order.
Algorithm Average waiting time Average burst time
DRRR 55.8 95.8
Round robin 113 153
ERR 100.6 140.6
IRR 88 128
FCFS 113.6 153.6
DRRR: firstly the time quantum value becomes 47 because the root mean square value of the burst time at arrival time 0 is 47. Then quantum value again changes to 24 then it again changes to 9.
P5(11) P4(22) P3(35) P2(47) P1(47) P2(5) P1(24) P1(9)
0 11 33 68 115 162 167 191 200 RR:
P1(20) P2(20) P3(20) P4(20) P5(11) P1(20) P2(20) P3(15) P4(2) P1(20) P2(12) P1(20) 0 20 40 60 80 91 111 131 146 148 168 180 200 IRR:
P1(20) P2(20) P3(20) P3(15) P4(20) P4(2) P5(11) P1(20) P2(20) P2(12) P1(20) P1(20) 0 20 40 60 75 95 97 108 128 148 160 180 200 ERR:
P1(20) P2(20) P3(20) P4(20) P2(2) P5(11) P1(20) P2(20) P3(15) P1(20) P2(12) P1(20) 0 20 40 60 80 82 93 113 133 148 168 180 200 FCFS:
P1(80) P2(52) P3(35) P4(22) P5(11)
0 80 132 167 189 200
Figure1: Output of the First Implementation
Figure2: Output of the Second Implementation
Figure3: Output of the Third Implementation
Figure4: Output of the Fourth Implementation
ACKNOWLEDGMENT
The First Author want to thank his Mother Smt. Sushma Singh, Wife Shubhra Singh, Brothers Abhinav Kant Singh and Abhuday Kant Singh, Sister Priyamvada Singh, Daughter Akshi Singh and Son Aishwaryat Singh for their support in the work done. The First Author also want to thank his Uncles Dr. Vinay Kumar Singh and Shri Rishi Singh for their guidance. Last but the most important one the first author want to thank his Father Late Shaheed Shri Triveni Kant Singh without whose blessing’s the work was not possible.
REFERENCES
[1] M.K. Mishra, “Improved Round Robin CPU Scheduling Algorithm”,Journal of Global Research in Computer Science, ISSN- 2229-371X, vol. 3, no. 6, June 2012.
[2] R.J. Matarneh, “Self-Adjustment Time Quantum in Round Robin Algorithms Depending on Burst Time of the Now Running Processes,” American Journal of Applied Science, pp. 1831-1837, 2009.
[3] S. Hiranwal, “Adaptive Round Robin Scheduling using Shortest Burst Approach based on Smart Time Slice,” International Journal of Data Engineering, vol.2, 2011.
[4] H.S. Behera, “Weighted Mean Priority Based Scheduling for Interactive Systems,” Journal of Global Research in Computer Science, vol. 2, May 2011.
[5] L. Kishor and D. Goyal, “Time Quantum Based Improved Scheduling Algorithm,” International Journal of Advance Research in Computer Science and Software Engineering, vol. 3, April 2014.
[6] H.S. Behera, “Enhancing the CPU performance using a Modified mean-deviation Round Robin Scheduling Algorithm for Real Time Systems,” Journal of Global Research in Computer Science, vol. 3, March 2012.
[7] A. Bisht, “Enhanced Round Robin Algorithm for Process Scheduling using varying Quantum Precision,” International Conference Proceeding of ICRIEST, Pune, 29 Dec. 2013.
[8] R. Mohanty and M. Das, “Design and Performance Evaluation of A New Proposed Fittest Job First Dynamic Round Robin Scheduling Algorithms,” International Journal of Computer Information Systems, vol. 2, Feb. 2011.
[9] A.S. Tanenbaum, Modern Operating Systems, Prentice Hall, 2008.
[10] P.S. Varma, “A Best possible Time Quantum for Improving Shortest Remaining Burst Round Robin (SRBRR) Algorithms,” International Journal of Advanced Research in Computer Science and Software Engineering, vol. 2, 2011.
[11] V.K. Singh, “Evaluating the various CPU scheduling algorithms on the basis of Simulation made in C++,” Proceeding of International
Conference on Computers and Management (ICCM) 2015, Jaipur, Rajasthan, India, December 2015.