Table Of ContentInternational Journal of Computational and Applied Mathematics.
ISSN 1819-4966 Volume 12, Number 1 (2017), pp. 65-80
© Research India Publications
http://www.ripublication.com
An Optimal Mathematical Approach for CPU
Scheduling – OMDRRS vs. RR
Neetu Goel
Research Scholar
Department of Computer Science, TMU, India
Dr. Abhinav Saxena
Assistant Professor
Department of Mathematics, TMU, India.
Dr. R. B. Garg
Ex- Professor,
Delhi Universty, India.
Abstract
Prime objective of this paper is to estimate turnaround time, waiting time and
context switch of any process in CPU scheduling mathematically. CPU
scheduling has an esteemed impact on utilization of resources and total quality
of the system. The management of processes in the scheduling of CPU is
based on various algorithms. The Round Robin scheduling algorithm is
relatively better than other existing CPU scheduling algorithm. In this paper
CPU Scheduling Algorithms and an optimal mathematical approach using
“Optimum Dynamic Round Robin Scheduling” (OMDRRS) has been
presented. Based on the experiments executed and results generated by the
simulator on a data set of 50 processes, it has been proved that in comparison
to the conventional round robin algorithm, OMDRRS algorithm increases
efficiency of average waiting time by 36%; that of the average turnaround
time 35% and that of context switch by 35%.The mathematical approach of
Round Robin and OMDRRS algorithm is transparent enough; it provides, for
each process, the actual order of shifting of a process and also the order of
execution.
Keywords: CPU Scheduling, Ready Queue, Burst Time, Turnaround time,
Mathematical formulation, Waiting Time and Context Switch
66 Neetu Goel, Dr. Abhinav Saxena and Dr. R.B. Garg
I. INTRODUCTION
The primary objective in multiprogramming time-sharing systems is to provide
reasonably good response time and equitably sharing of system resources to all
existing users and hence improving the uni-processor performance. CPU scheduling is
one of the root structures for multi-programming to increase the performance of uni-
processor and implement multitasking concept. Scheduling is a set of policies and
mechanisms, so as to govern the order of work to be carried out by a system. The
scheduling policy determines at what instant a process is to be removed from the CPU
and which process should be allocated to the CPU, waiting in ready queue. According
to the advantages and disadvantages of an existing CPU scheduling algorithms RR is
identified to be the best one [2][5][6]. Round Robin scheduling algorithm is classified
into the preemptive discipline category and is one of the most popular in time slicing
known till now. RR distributes the processing time equally among all processes that
are requesting for the processor. Basically the processor time is divided into slices or
quanta, which are allocated to the requestor. The scheduler then removes this
currently running process from the CPU and selects the next ready job from the ready
list on an FCFS basis. The scheduler only needs to maintain a list of ready processes.
If there is need of more time by the process to complete its execution after it has
exhausted its specified time slice, the CPU is preempted and switched over to another
process.
Response time of RR scheduling algorithm is relatively better, although its
performance is very sensitive to time-slice. If quantum is very short, then the short
processes will move through the system quickly and nicely. But if this quantum is so
selected that it is not very large in comparison to process switching, then this will
invite more overhead of dispatching operations including process switches. To
overcome all such drawbacks which hinder the better performance of CPU
scheduling, new algorithm named OMDRRS “Optimum Multilevel Dynamic Round
Robin Scheduling Algorithm” is proposed [11].This is a preemptive scheduling
algorithm. OMDRRS algorithm calculates dynamic time slice after every round of
execution. The results display robustness of this algorithm. It is an improvement of
popularly implemented RR scheduling algorithm.
In this paper turnaround time, waiting time and context switch of Round Robin
algorithm has been formulated mathematically. It also made an attempt to formulate
the turnaround time and waiting time of the improved algorithm ÓMDRRS. There are
five sections in this paper. Section I projects a brief introduction on the various
aspects of the scheduling algorithm. In section II, we analytically examine the
components of the existing Round Robin algorithm for CPU bound processes. Section
III presents the mathematical approach of improved algorithm. The Section IV,
presents the simulation results of Round Robin and OMDRRS algorithm by
comparison of results obtained by working on different data sets with conventional
Round Robin followed by conclusion and future scope.
An Optimal Mathematical Approach for CPU Scheduling – OMDRRS vs. RR 67
II. MATHEMATICAL FORMULATION OF CPU SCHEDULING
ALGORITHMS
A. First Come First Serve Algorithm
Let 𝑃 𝑃 …… 𝑃 be n-processes arranged in FCFS manner in a ready queue (to be
1, 2, 𝑛,
referred as RQ), having 𝐵𝑇 ;i=1,2,3, …,n, as their expected CPU bursts for
𝑖
completion respectively.
1). Formulation of Total Turnaround Time
Total turnaround time for a process 𝑃 can be calculated by summing up the total time
𝑖
spent by the process 𝑃 in RQ.
𝑖
Turnaround Time of P = 𝐵𝑇
1 1
Turnaround Time of P =𝐵𝑇 + 𝐵𝑇
2 𝐼 2
Also,
Turnaround Time of P =𝐵𝑇 + 𝐵𝑇 +⋯……+𝐵𝑇
i 𝐼 2 𝑖
Hence, the following expression is obtained for P(TAT)
i
𝑃(𝑇𝐴𝑇) = ∑𝑖 𝐵𝑇 − 𝐴𝑇 (1)
𝑖 𝑘=1 𝑘 𝑖
Average Turnaround Time of a process P can be calculated with the help of following
i
expression:
∑𝑛 𝑃 (𝑇𝐴𝑇)
Average Turnaround Time= 𝑘=1 𝑘 (2)
𝑛
2). Formulation of Total Waiting Time
Total waiting time for a process 𝑃 (P(TWT)) can be calculated by summing up total
𝑖 i
time devote the process P in the RQ.
i
Waiting Time of P = 0
1
Waiting Time of P = 𝐵𝑇
2 1
Waiting Time of P = 𝐵𝑇 + 𝐵𝑇
3 1 2
Hence, in general for i process, we have
Waiting Time of P = 𝐵𝑇 + 𝐵𝑇 +⋯…… 𝐵𝑇
i 𝑖−1 𝑖−2 1
Hence, the following expression is obtained for P(TWT)
i
𝑃(𝑇𝑊𝑇) = ∑𝑖−1 𝐵𝑇 − 𝐴𝑇 (3)
𝑖 𝑘=1 𝑘 𝑖
Average Waiting Time of a process P can be calculated with the help of following
i
expression:
∑𝑛 𝑃 (𝑇𝑊𝑇)
Average Waiting Time = 𝑘=1 𝑘 (4)
𝑛
\
68 Neetu Goel, Dr. Abhinav Saxena and Dr. R.B. Garg
B. Shortest Job First Algorithm
Let 𝑃 𝑃 …… 𝑃 be n-processes which have been arranged in FCFS manner in a
1, 2, 𝑛,
temporary queue (this is referred to as TQ), having 𝐵𝑇 ; i =1,2,3,…, n as their
𝑖
expected CPU bursts for completion respectively. Depending upon the burst time
corresponding to each process, the submitted processes are ordered in the ready queue
(referred as RQ). Ready queue is maintained for all process, where n-processes are
arranged in ascending manner () as per their burst time.
𝑅𝑄 = (𝑃 ), (𝑃 ),…… (𝑃 )
𝑛 1 2 𝑛
1). Formulation of Total Turnaround Time
Total Turnaround Time for a process 𝑃 can be calculated by summing up by its total
𝑖
time devote in the RQ.
Turnaround Time of P = 𝐵𝑇
1 1
Turnaround Time of P =𝐵𝑇 + 𝐵𝑇
2 𝐼 2
Also,
Turnaround Time of P =𝐵𝑇 + 𝐵𝑇 +⋯……+𝐵𝑇
i 𝐼 2 𝑖
Hence, the following expression is obtained for P(TAT)
i
𝑃(𝑇𝐴𝑇) = ∑𝑖 𝐵𝑇 − 𝐴𝑇 (5)
𝑖 𝑘=1 𝑘 𝑖
Average Turnaround Time of a process P can be calculated with the help of following
i
expression:
∑𝑛 𝑃 (𝑇𝐴𝑇)
Average Turnaround Time= 𝑘=1 𝑘 (6)
𝑛
2). Formulation of Total Waiting Time
Total waiting time for a process 𝑃 (P(TWT)) can be calculated by summing up the
𝑖 i
total time devote by the process P in the RQ.
i
Waiting Time of P = 0
1
Waiting Time of P = 𝐵𝑇
2 1
Waiting Time of P = 𝐵𝑇 + 𝐵𝑇
3 1 2
Hence, in general for i process, we have
Waiting Time of P = 𝐵𝑇 + 𝐵𝑇 +⋯…… 𝐵𝑇
i 𝑖−1 𝑖−2 1
Hence, the following expression is obtained for P(TWT)
i
𝑃(𝑇𝑊𝑇) = ∑𝑖−1 𝐵𝑇 − 𝐴𝑇 (7)
𝑖 𝑘=1 𝑘 𝑖
An Optimal Mathematical Approach for CPU Scheduling – OMDRRS vs. RR 69
Average Waiting Time of a process P can be calculated as follows:
i
∑𝑛 𝑃 (𝑇𝑊𝑇)
Average Waiting Time = 𝑘=1 𝑘 (8)
𝑛
C. Priority Scheduling Algorithm
Let 𝑃 𝑃 …… 𝑃 be n-processes arranged in FCFS manner in a temporary queue
1, 2, 𝑛,
(referred to as TQ), having 𝐵𝑇and𝑃𝑟; i=1,2,3,…, n, as their expected CPU burst time
𝑖 𝑖
and priority of a process, respectively. Depending upon the priority of a process, the
submitted processes are ordered in the ready queue (referred as RQ). Ready queue is
maintained for all process, where n-processes arranged in ascending manner () as per
their priority.
𝑅𝑄 = (𝑃 ), (𝑃 ),…… (𝑃 )
𝑛 1 2 𝑛
1). Formulation of Total Turnaround Time
Total Turnaround Time for a process 𝑃 can be calculated by summing up the total
𝑖
time devote by a process P in the RQ.
i
Turnaround Time of P = 𝐵𝑇
1 1
Turnaround Time of P =𝐵𝑇 + 𝐵𝑇
2 𝐼 2
Also,
Turnaround Time of P =𝐵𝑇 + 𝐵𝑇 +⋯……+𝐵𝑇
i 𝐼 2 𝑖
Hence, the following expression is obtained for P(TAT)
i
𝑃(𝑇𝐴𝑇) = ∑𝑖 𝐵𝑇 − 𝐴𝑇 (9)
𝑖 𝑘=1 𝑘 𝑖
Average Turnaround Time of a process P can be calculated by the following
i
expression:
∑𝑛 𝑃 (𝑇𝐴𝑇)
Average Turnaround Time= 𝑘=1 𝑘 (10)
𝑛
2). Formulation of Total Waiting Time
Total waiting time for a process 𝑃 (P(TWT)) can be calculated by summing up the
𝑖 i
total time devoted by the process P in the RQ.
i
Waiting Time of P = 0
1
Waiting Time of P = 𝐵𝑇
2 1
Waiting Time of P = 𝐵𝑇 + 𝐵𝑇
3 1 2
Hence, in general for i process, we have
Waiting Time of P = 𝐵𝑇 + 𝐵𝑇 +⋯…… 𝐵𝑇
i 𝑖−1 𝑖−2 1
\
70 Neetu Goel, Dr. Abhinav Saxena and Dr. R.B. Garg
Hence, the following expression is obtained for evaluating P(TWT)
i
𝑃(𝑇𝑊𝑇) = ∑𝑖−1 𝐵𝑇 − 𝐴𝑇 (10)
𝑖 𝑘=1 𝑘 𝑖
Average Waiting Time of a process P can be calculated by the following expression:
i
∑𝒏 𝑷 (𝑻𝑾𝑻)
Average Waiting Time = 𝒌=𝟏 𝒌 (11)
𝒏
D. Round Robin Scheduling Algorithm
Let 𝑃 𝑃 …… 𝑃 be n-processes arranged in FCFS manner in a ready queue (referred
1, 2, 𝑛,
as RQ), having 𝐵𝑇 and 𝑘 ; i=1,2,3, …, n, as their expected CPU bursts and number of
𝑖 𝑖
cycles required for completion, respectively[1]. Further, let TS denote a fixed time
slice in Round Robin scheduling algorithm. 𝑘 may be calculated using the following
𝑖
expression.
𝐵𝑇
𝑖⁄ , 𝑖𝑓 𝐵𝑇%𝑇𝑆 = 0
𝑇𝑆 𝑖
𝑘 ={
𝑖 (𝐵𝑇
𝑖⁄ +1), 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
𝑇𝑆
Remaining CPU burst-time is updated after every cycle. Let 𝐵𝑇 and 𝑇𝑆 denote
𝑖,𝑗 𝑖,𝑗
the remaining CPU burst and executed portion of CPU burst, respectively, for the ith
process in jth cycle. Hence, following expression can be used to evaluate the
remaining CPU time requirement of a process P in the kth cycle:
i
𝐵𝑇 = 𝐵𝑇 - 𝑇𝑆
𝑖,𝑘 𝑖,𝑘−1 𝑖,𝑘−1
Where 𝑇𝑆 can be obtained from the following:
𝑖,𝑘−1
𝑇𝑆 𝑖𝑓 𝐵𝑇 < 𝑇𝑆
𝑖 𝑖,𝑘−1
𝑇𝑆 ={
𝑖,𝑘−1 𝑇𝑆, 𝑖𝑓 𝐵𝑇 ≥ 𝑇𝑆
𝑖,𝑘−1
1). Formulation of Total Turnaround Time
Total Turnaround Time for a process 𝑃 that terminates in kth cycle (P(TAT)) can be
𝑖 i
calculated by summing the total time it devotes in the RQ from first to kth cycle.
Turnaround Time of P in cycle 1 = (𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 ) (12)
i 1,1 2,1 𝑖,1
Turnaround Time of P in cycle 2 = (𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 )+
i 𝑖+1,1 𝑖+2,1 𝑛,1
(𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 ) (13)
1,2 2,2 𝑖,2
Turnaround Time of P in cycle 3 = (𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 )+
i 𝑖+1,2 𝑖+2,2 𝑛,2
(𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 ) (14)
1,3 2,3 𝑖,3
An Optimal Mathematical Approach for CPU Scheduling – OMDRRS vs. RR 71
Hence, in general for k cycles, we have
Turnaround Time of P in cycles k= (𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 )
i 𝑖+1,𝑘−1 𝑖+2,𝑘−1 𝑛,𝑘−1
+ (𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 ) (15)
1,𝑘 2,𝑘 𝑖,𝑘
Summing upequations12 to 15the required expression is given as:
𝑖 𝑛 𝑖 𝑛 𝑖
(𝑃((𝑇𝐴𝑇))) = ∑𝑇𝑆 + [ ∑ 𝑇𝑆 + ∑𝑇𝑆 ]+[ ∑ 𝑇𝑆 + ∑𝑇𝑆 ]
𝑖 𝑘,1 𝑘,1 𝑘,2 𝑘,2 𝑘,3
𝑘=1 𝑘=𝑖+1 𝑘=1 𝑘=𝑖+1 𝑘=1
𝑛 𝑖
+⋯…+ [ ∑ 𝑇𝑆 + ∑𝑇𝑆 ]
𝑘,𝑗−1 𝑘,𝑗
𝑘=𝑖+1 𝑘=1
𝑛 𝑛 𝑛 𝑖−1
= ∑𝑇𝑆 +∑𝑇𝑆 +…….+ ∑𝑇𝑆 + ∑𝑇𝑆 − 𝐴𝑇
𝑘,1 𝑘,2 𝑘,𝑗−1 𝑘,𝑗 𝑖
𝑘=1 𝑘=1 𝑘=1 𝑘=1
Hence, the following expression is obtained for P(TAT)
i
𝑃(𝑇𝐴𝑇) = ∑𝑗−1[∑𝑛 [𝑇𝑆 ]]+ ∑𝑖 𝑇𝑆 − 𝐴𝑇 (16)
𝑖 𝑙=1 𝑘=1 𝑘,𝑙 𝑘=1 𝑘,𝑗 𝑖
Average Turnaround Time of a process P can be calculated by the following
i
expression:
∑𝑛 𝑃 (𝑇𝐴𝑇)
Average Turnaround Time= 𝑘=1 𝑘 (17)
𝑛
2). Formulation of Total Waiting Time
Total waiting time for a process 𝑃 that terminated in kth cycle (P(TWT)) can be
𝑖 i
calculated by summing up the total time devote it in the RQ [1] from first to kth cycle.
Waiting Time of P in 1st cycle = (𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 ) (18)
i 1,1 2,1 𝑖−1,1
Waiting Time of P in 2nd cycle = (𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 )+
i 𝑖+1,1 𝑖+2,1 𝑛,1
(𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 ) (19)
1,2 2,2 𝑖−1,2
Waiting Time of P in 3rd cycle = (𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 )+
i 𝑖+1,2 𝑖+2,2 𝑛,2
(𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 ) (20)
1,3 2,3 𝑖−1,3
Hence, in general for kth cycle, we have
Waiting Time of P in kth cycle= (𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 )
i 𝑖+1,𝑘−1 𝑖+2,𝑘−1 𝑛,𝑘−1
+ (𝑇𝑆 + 𝑇𝑆 + …….+𝑇𝑆 ) (21)
1,𝑘 2,𝑘 𝑖−1,𝑘
\
72 Neetu Goel, Dr. Abhinav Saxena and Dr. R.B. Garg
Summing up equations 18 to 21these will give us required expression:
𝑖−1 𝑛 𝑖−1 𝑛 𝑖−1
(𝑃(𝑇𝑊𝑇)) = ∑𝑇𝑆 + [ ∑ 𝑇𝑆 + ∑𝑇𝑆 ]+[ ∑ 𝑇𝑆 + ∑𝑇𝑆 ]
𝑖 𝑘,1 𝑘,1 𝑘,2 𝑘,2 𝑘,3
𝑘=1 𝑘=𝑖+1 𝑘=1 𝑘=𝑖+1 𝑘=1
𝑛 𝑖−1
+⋯…+ [ ∑ 𝑇𝑆 + ∑𝑇𝑆 ] − 𝐴𝑇
𝑘,𝑗−1 𝑘,𝑗 𝑖
𝑘=𝑖+1 𝑘=1
𝑛 𝑛 𝑛
= [∑𝑇𝑆 − 𝑄𝑇 ]+[∑𝑇𝑆 − 𝑇𝑆 ]+⋯…+ [∑𝑇𝑆 − 𝑇𝑆 ]
𝑘,1 𝑖,1 𝑘,2 𝑖,2 𝑘,𝑗−1 𝑖,𝑗−1
𝑘=1 𝑘=1 𝑘=1
𝑖−1
+ ∑𝑇𝑆 − 𝐴𝑇
𝑘,𝑗 𝑖
𝑘=1
Hence, the following expression is obtained for P(TWT) (22)
i
𝑗−1 𝑛 𝑖−1
𝑃(𝑇𝑊𝑇) = ∑[∑[𝑇𝑆 ]− 𝑇𝑆 ]+ ∑𝑇𝑆 − 𝐴𝑇
𝑖 𝑘,𝑙 𝑖,𝑙 𝑘,𝑗 𝑖
𝑙=1 𝑘=1 𝑘=1
Average Waiting Time of a process Pmay be calculated by the following expression:
i
∑𝑛 𝑃 (𝑇𝑊𝑇)
Average Waiting Time = 𝑘=1 𝑘 (23)
𝑛
3). Formulation of Context Switch
Estimation of total number of context switching has been done with the help of ceiling
function⌈⌉. Ceiling function is used to map a real number to the smallest integer that
follows it. In RR approach quantum time is always static and process enters the queue
with their requirement of CPU time. Total number of cycles required for completion
of a particular process is generated by dividing the burst time of a process by quantum
time [2]. Total number of context switch required in Round Robin scheduling may be
evaluated with the help of following equation:
Number of switching of P Process = ⌈𝐵𝑇1⌉
1
𝑇𝑆
Number of switching of P Process = ⌈𝐵𝑇2⌉
2
𝑇𝑆
Hence, in general for n process, we have
Number of switching of P Process = ⌈𝐵𝑇𝑛⌉
n
𝑇𝑆
Total number of Context Switches = ⌈𝐵𝑇1⌉+ ⌈𝐵𝑇2⌉+⋯..+ ⌈𝐵𝑇𝑛⌉
𝑇𝑆 𝑇𝑆 𝑇𝑆
An Optimal Mathematical Approach for CPU Scheduling – OMDRRS vs. RR 73
Hence, following expression is obtained for total number of Context Switches
= ∑𝑛 ⌈𝐵𝑇𝑖⌉ (24)
𝑖=1
𝑇𝑆
III. MATHEMATICAL FORMULATION OF PROPOSED ALGORITHM
(OMDRRS)
Let 𝑃 𝑃 …… 𝑃 be n-processes arranged in FCFS manner in a temporary queue
1, 2, 𝑛,
(referred as TPQ), having 𝐵𝑇, 𝐴𝑇 and 𝑃𝑇; i=1,2,3, …, n as their burst time, arrival
𝑖 𝑖 𝑖
time and priority. These shall form the components of the Factor (FT). The relation
i
between all these parameters is defined as -
FT = 0.2 X BT + 0.3 X AT + 0.5 X PT (25)
i i i i
Depending upon the evaluated value of factor (FT) corresponding to each process, the
i
submitted processes are ordered in the ready queue. The processes are arranged in
ascending manner () as per their factor value in the Ready Queue.
𝑅𝑄 = (𝑃 ), (𝑃 ),…… (𝑃 ) (26)
𝑖 1 2 𝑛
Let 𝐵𝑇 , 𝑅𝑇 and 𝑄𝑇 denote the actual burst time, remaining CPU burst time
𝑖,𝑗 𝑖,𝑗 𝑖,𝑗
and actual execution time slice for ith process in jth cycle. The expression used to find
out the Dynamic Quantum Time (DQT) in the jth cycle can be given by:
j
𝐷𝑄𝑇 =(𝑅𝑇 +𝑅𝑇 )/2 ; if 𝑅𝑇 > 0, i=1,2………n (27)
𝑗 1,𝑗 𝑛,𝑗 𝑖,𝑗
Where 𝑄𝑇 can be obtained for a process P in the jth cycle from the following
𝑖,𝑗 i
equation:
𝑅𝑇 𝑖𝑓 𝑅𝑇 < 𝐷𝑄𝑇
𝑖 𝑖,𝑗−1 𝑗
𝑄𝑇 ={ (28)
𝑖,𝑗 𝐷𝑄𝑇 , 𝑖𝑓 𝑅𝑇 ≥ 𝐷𝑄𝑇
𝑗 𝑖,𝑗−1 𝑗
After executing portion of CPU time of a process P in the jth cycle, requirement of
i
remaining CPU burst time (𝑅𝑇 ) of the process is evaluated for the same cycle. This
𝑖,𝑗
may be done as given below:
𝑅𝑇 = 𝑅𝑇 - 𝑄𝑇 (29)
𝑖,𝑗 𝑖,𝑗 𝑖,𝑗
If RT is 0 for the current process P, then it is sent to Output Queue. Otherwise
i,j i
decision is to be taken whether the current process is to be added into the equation 26
or it is to be executed by the CPU again in the same cycle. This can be evaluated as
given below:
𝑄𝑇 = {𝑅𝑇 𝑖𝑓 𝑅𝑇 ≤ 𝐷𝑄𝑇 /2 ;𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 𝑎𝑑𝑑 𝑖𝑛𝑡𝑜 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 26
𝑖,𝑗 𝑖 𝑖,𝑗 𝑗
Hence, equations from 26 to 29are executed till there is a process remaining in the
ready queue. In the first cycle all n processes will be executed by the CPU, so total
number of processes remaining in the ready queue =n
𝑅𝑄 = n
1
\
74 Neetu Goel, Dr. Abhinav Saxena and Dr. R.B. Garg
Total number of processes remaining in the ready queue in second cycle = n - number
of processes terminated up to first cycle
𝑅𝑄 =n-𝑡
2 1
also,
Total number of processes remaining to be executed in (j-2) cycle = n- number of
processes terminated up to (j-3) cycle.
𝑅𝑄 = n -(𝑡 + 𝑡 +⋯….+ 𝑡 )
𝑗−2 1 2 𝑗−3
Hence, in general for number of processes available in the ready queue in jth cycle,
we have
∑𝑗 𝑅𝑄 = n + (n- (𝑡 + 𝑡 )) + (n-- (𝑡 + 𝑡 + 𝑡 )) + …….. +
𝑘=1 𝑘 1 2 1 2 3
(n- (𝑡 + 𝑡 +⋯..+ 𝑡 )
1 2 𝑗−1
𝑅𝑄 = 𝑛− ∑𝑗−1𝑡 (30)
𝑗 𝑖=1 𝑖
1). Formulation of Turnaround Time of OMDRRS Algorithm
The turnaround around time of a process T(P) determines the number of time slices
i
during which CPU was in use from when the process entered into the ready queue till
the time of termination of process P for the ith process in jth cycle. These time slices
i,j
may include the following:
1. All time slices consumed by the Process P for the ith process in jth cycle.
i,j
2. Number of time slices of full quantum consumed for processes other than P
i,j-
for the ith process in (j-1)th cycle [P ; l=1(1)n, l≠i and m=1(1) j-1]
1 l,m
3. Number of time slices of full or part quantum consumed in the last cycle of the
processes terminated before P
i , j
In the determination of total turnaround time for the process P, we need to identify
i
the time slices of each of the above category and compute their number. The
expression to calculate total turnaround time of a process is as follows:
P(TAT) = CPU time consumed till the termination of P – Arrival time of P
i i i
For category 1: All time slices consumed for the Process P that terminated in jth cycle
i
Turnaround Time of P in cycle 1 = 𝑄𝑇
i 𝑖,1
Turnaround Time of P in cycle 2 = 𝑄𝑇
i 𝑖,2
Hence, in general for cycle j, we have
Turnaround Time of P in cycle j =𝑄𝑇 + 𝑄𝑇 + …. + 𝑄𝑇
i 𝑖,1 𝑖,2 𝑖,𝑗
C1= ∑𝑗 𝑄𝑇 (31)
𝑘=1 𝑖,𝑘
Description:Neetu Goel, Dr. Abhinav Saxena and Dr. R.B. Garg .. Basic 6.0 Professional [3]. For the visual perception of the difference in performance of.