Professional Documents
Culture Documents
Round Robin CPU Process Scheduling
Round Robin CPU Process Scheduling
Abstract: CPU scheduling is a process which Experimentally, the proposed approach has
allows one process to use the CPU while the proven to It is simple, easy to implement, and
execution of another process is on hold (in waiting starvation-free as all processes get fair share of
for state) due to the unavailability of any resource CPU. One of the most commonly used technique
like I/O etc, thereby making full use of CPU. CPU in CPU scheduling as a core. perform better than
scheduling aims to make the system efficient, fast, other algorithms. It is preemptive as processes are
and fair. Process Scheduling, which is an assigned CPU only for a fixed slice of time at
important part in any operating systems, allocates most. Scheduling the process of allocating
processes to the CPU in specific order to optimize processes to the CPU to maximize a specific
some objective functions. The efficiency of any purpose function. There are many algorithms used
operating system relies strongly on the scheduling to process processes. Round Robin (RR) CPU
algorithms used. A number of scheduling algorithm editing algorithm is one of those apps
algorithms exists. Among them, Round Robin that work with time sharing and real-time
(RR) is the most widely utilized algorithm. RR applications. It gives the right time to respond.
has proved to be effective in several types of But it has a number of shortcomings such as high
operating systems, such as time sharing systems. turnover time, high waiting time and many
This is due to the reasonable response time it contextual changes. There are a large number of
gives. However, it suffers from some proposed algorithms to expand the standard
shortcomings such as high average turnaround Round Robin algorithm. In this paper we present
time, high average waiting time as well as many a study on outcome analysis that concludes the
context switches. Recently, several algorithms recommendations of the Enriched Round Robin
have been proposed to improve its efficiency, algorithm that improves the performance of the
however, few studies were conducted to compare average waiting time and turnaround time
their efficiency when applied to dataset with
different characteristics. The aim of this paper is Keywords: Round Robin scheduling algorithm (RR),
three-fold: (1) presenting a survey of various RR Adaptive Round Robin Scheduling algorithm, Time
Quantum (TQ), Dynamic TQ, Round Robin Remaining time
based scheduling algorithms proposed and found algorithm (RRRT), (IRR) improved Round Robin CPU
in literature, (2) proposing a new RR based Scheduling Algorithm, (AAAIRR) an improvement on the
approach named, the Eighty-Five Percentile improved Round Robin CPU scheduling algorithm, (ERR)
Round-Robin algorithm (EFPRR), to overcome An Enhanced Round Robin CPU Scheduling Algorithm,
the aforementioned issues, and (3) Conducting (MMRR) Min-Max Dispersion Measure, (IRRVQ) The
improved Round Robin CPU scheduling algorithm with
comparisons between eight RR based algorithms varying time quantum, (AMRR) Average Max Round Robin
and the proposed approach using datasets with Scheduling Algorithm, Average waiting time, Average
different characteristics. Extensive experiments turnaround time. average waiting time, average
have been done to test the proposed approach.
turnaround time, average response time, context quantum (TQ) for each ready process waiting for
switches. execution, equally and in circular fashion, treating
all processes fairly without priority. The newly
Nomenclature
RR Round Robin
created process is add to end of ready queue. It is
TQ Time Quantum highly preferred in time-sharing and real-time
IRR Improved Round Robin OSs [3]. Each process get a chance to reschedule
AAAIRR An improvement on the improved Round after a particular quantum time in this scheduling.
Robin This is because it allocates for each process the
ERR An Enhanced Round Robin CPU
Scheduling
same amount of time to use the CPU which results
RRRT Round Robin Remaining time algorithm in low response time [4]. A particular time
MMRR Min-Max Dispersion Measure quantum (TQ) is allocated to different tasks.
IRRVQ The improved Round Robin CPU However, in spite of its advantages, it suffers from
scheduling algorithm with varying time high average turnaround time (ATT) [5], high
quantum
AMRR Average Max Round Robin
average waiting time (AWT) [5], high average
AWT Average waiting time response time (ART) [5], and many context
ATT Average turnaround time. switches (CS) [4]. Time quantum (TQ) plays a
CPU Central processing unit critical role in the behavior of the RR approach [1]
ERR Enriched Round Robin [2]. Throughput (output) depends on quantum
time (TQ). If we want to give some or many
process priority, we cannot do it. Using a small
I. INTRODUCTION value of time quantum (TQ) produces a lot of CSs
which reduces the system performance [7] [8],
CPU or process Scheduling [1] [2] allocates while, using larger value of TQ affects negatively
processes to the CPU in specific order to optimize the ARS [6] [7]. RR has Larger waiting time(WT)
some objective functions. Whenever the CPU and Response time(RT).
becomes idle, the operating system must select
one of the processes in the ready queue to be In recent years, several CPU scheduling
executed. The selection process is carried out by algorithms have been introduced for improving
the short-term scheduler. The scheduler selects system performance. A fixed time quantum (TQ)
from among the processes in memory that are is allocated to the process waiting in the ready
ready to execute, and allocates the CPU to one of queue, only in the first cycle and then SJF is used
them. It is considered one of the most significant to select the next process in An Improved Round
parts in any operating system (OS). The Robin Scheduling Algorithm for CPU
scheduling algorithm used affects the efficiency Scheduling. Time quantum (TQ) is continuously
of the system. Several CPU scheduling adjusted according to the burst time of the
algorithms have been implemented to meet processes in Self-Adjustment Time Quantum
various Oss requirements [1] [2], such as Round (TQ) in the Round Robin Algorithm. The job mix
Robin (RR), Shortest Job First (SJF), Priority, order for the algorithm is used in Dynamic
First Come First Served (FCFS), and Quantum with Readjusted Round Robin
Shortest Remaining Time First (SRTF). In this Scheduling Algorithm. The robust quantum time
work, we focus on RR, which is one of the most value has been proposed after arranging the
widely used algorithm among others. process in the ascending order and taking the
average of minimum and maximum burst time of
RR is a preemptive algorithm which is the processes in the ready queue. a number of
fairness since every process gets equal share of attempts were made to improve the classical RR
CPU, allocates a small amount of time called time algorithm. All these attempts used traditional
approaches and focuses around the core part of the can be also implemented. But, due to time
algorithm, which is the time quantum (TQ). Some limitation, the author was not able to implement
of these algorithms used static TQ and others used them. On the other hand, many other
dynamic TQ. In addition to that, few attempts algorithms are existing in the literature, but
using machine learning approaches [8, 9] were unfortunately their steps are not clear or not
made to improve the efficiency of RR algorithm understandable. It is impossible to implement
via predicting the proper value of TQ. them. Therefore, these algorithms were not
included in this section.
In this paper, we survey various traditional
improved RR based scheduling algorithms found This algorithm makes little progress in the
in literature and various RR related research paper IRR algorithm. Selects the first-line process ready
and propose a new improved approach named the to give the CPU up to 1 time. It then looks at the
Eighty-Five Percentile Round-Robin algorithm remaining burst time of the currently active
(EFPRR), to further improve the performance of process, if the remaining burst time is less than or
RR based algorithms. Extensive experiments have equal to 1 time, the current process is redistributed
been made to examine the performance of the to the CPU. Upon completion of the process, this
proposed approach. Finally, this paper presents process is removed from the appropriate line. If
comprehensive comparisons between the the remaining burst time of the currently active
proposed approach and eight RR based algorithms process is longer than the 1st quantum time, the
using ten synthetic datasets of different process will be added at the end of the ready line.
characteristics. To facilitate this work, a new
simulator named, RR scheduling simulator, has The authors in [10] suggested an
been developed. The simulator implementation improvement to the RR algorithm. Their approach
supports all RR based approaches presented in tests the remaining time of the process under
this paper. execution, if it is not greater than one TQ, the
processor is re-assigned to the process for the
This paper is structured as follows: remaining time. The authors in [11] proposed
Section 2 presents in brief previous work, Section another improvement to the RR algorithm similar
3 presents the tools used, Section 4 presents the to the previous one except that the currently
datasets used, Section 5 presents the proposed running process will again allocate the processor
approach, Section 6 introduces the performance if its remaining CPU time is not equal or
measures utilized, Section 7 explains the exceeding one TQ. Jayanti Khatri [12] proposed
simulation results and ameliorations analysis, and in his paper a little improvement on the
finally, Section 8 concludes the paper. algorithm suggested by [11]. His improvement
considers checking the remaining CPU time of the
II. LITERATURE SURVEY process whether it is not greater than one TQ. If it
is, then the process is re-allocated the processor
This section provides a short review of the
for the remaining CPU time. In their paper [13],
improved RR approaches found in the literature.
the authors proposed an improved approach to
This introduction is limited only to those
enhance RR algorithm. Their approach decides
algorithms that have been considered for
the TQ based on the number of processes. If it is
comparisons in this work. The reason behind
even, then the TQ equals the averages of all burst
choosing these algorithms is that they are clearly
times of processes, otherwise, the TQ takes the
presented and explained by the authors, so that
value of the CPU time of the middle process.
they can be implemented correctly for the
Arpita Sharma1 and Gaurav Kakhani [14]
purpose of comparisons. Besides, there exist some
introduced an improved approach that calculates
other RR based algorithms in the literature which
the TQ at the beginning of the algorithm which is functions includes: (1) creating a graphical
equal to the summation of all processes’ representation of Gantt chart showing the start
CPU time divided by the number of processes time and end time for each executed processes.
multiplied by two. In their paper [15], the authors The maximum width size of Gantt chart that can
proposed an improved approach that calculate the be displayed on the screen is 100 time units. The
TQ dynamically at every cycle based on the Gantt chart is created for all algorithms under
difference between the maximum and minimum comparisons, (2) displaying the results of five
values of the processes’ CPU times. If the performance measures used to compare the
calculated TQ below 25, then the TQ is set to 25, algorithms. These measures are the AWT, ATT,
else it is set to the new calculated TQ. In [16], ART, throughput, and CPU utilization.
Manish Kumar Mishra, Faizur Rashid suggested Furthermore, it displays the WT, TT and RT for
that at each iteration the value of the TQ is set to each executed process, and (3) displaying the
the same value of the CPU time of the first process results in more interesting and readable format
in the ready queue. Another introduced approach using charts.
developed by [17] calculates the TQ based on the
maximum value of the CPU times as well as the IV. DATASETS USED
average CPU times. The TQ equal to the
sum of average CPU times of processes and the For the purpose of fair comparisons, ten synthetic
maximum burst time divided by 2. This datasets were generated and used to assess the
calculation is performed in each iteration to obtain performance of the algorithms. The order of the
the new TQ. Sabrina, F.C.D, Nguyen, S.Jha, processes affects the results of the RR algorithm
D.Platt, and F Safaei suggested that Scheduling is as the processes are performed in sequence, while
the work of a functioning basic program. Almost in some algorithms the time of the burst time of
all computer resources are scheduled before use. processes is arranged in a progressive manner in
CPU is one of the main resources. Its planning is all cases. The datasets differ in the number of
therefore central to the construction of the processes they contain. Number of processes
operating system. CPU configuration determines ranges from 50 to 200. Each process has three
which process is run when there are multiple properties: ProcessID, arrival time and burst time.
operating processes CPU configuration is The datasets contain no noisy data. The zero
important because it can have a significant impact arrival times and non-zero arrival times are
on resource utilization and overall system considered. The datasets differ in their
performance. characteristics as shown in Table 1. The CPU
scheduling simulator described in previous
III. TOOLS USED section was used to create the datasets. The
randomness and distribution of these datasets are
The goal of this work is to compare the taken into consideration in order to avoid
performance of the proposed approach with any bias in the datasets.
several RR-based scheduling algorithms over
different types of datasets. In order to achieve TABLE I. CHARACTERISTICS OF DATASETS
this goal, a new scheduling simulator, named RR Dataset No. of Min and Min and
processes Max Max
scheduling simulator, was developed. This new CPU arrival
simulator is advanced version of the CPU Burst time
scheduling simulator developed by [18]. The (sec.) (sec)
1 Dataset-50Z 50 1, 14 0, 10
simulator is provided with a number of handy
2 Dataset-50NZ 50 1, 12 0, 10
functions which facilitate a comprehensive 3 Dataset-70Z 70 1, 8 0, 15
analysis of the results obtained. Examples of these 4 Dataset-70NZ 70 1, 10 0, 15
5 Dataset-100Z 100 1, 8 0, 30 came after performing a large number of
6 Dataset-100NZ 100 1, 13 0, 30 experiments with the aim of obtaining a suitable
7 Dataset-150Z 150 1, 7 0, 60
8 Dataset-150NZ 150 1, 9 0, 60 constant that can be multiplied by the average
9 Dataset-200Z 200 1, 8 0, 75 burst times in order to decrease the value of the
10 Dataset-200NZ 200 1, 10 0, 75 average burst times, which leads to obtaining the
optimal TQ.
V. THE PROPOSED APPROACH Pseudo code of the proposed approach
The proposed algorithm further improves the VI. PERFORMANCE MEASURES USED
other previously published RR based algorithms
via calculating the TQ at the beginning of each The algorithms were compared in terms of the
step using the 85 percentile of the processes’ burst following four performance measures [1, 2, 3].
time. After arranging the processes in an
increasing order based on their CPU time, the TQ 1) Waiting Time (WT): Waiting time (WT) is
is computed via multiplying the mean of all the amount of time spent by a process waiting in
processes’ time with the 85 percentile constant the ready queue for getting the processing unit. On
(85%*mean). Then, it checks the remaining time other side waiting time (WT) is the total time
of the process. If it is lesser than or equal to spent by the process in the ready state waiting for
the calculated TQ, the processor executes the processing unit (CPU). Refers to the entire time
running process until completion. Or else, the the process has to wait before its’ running starts
process will be send to the tail of the ready queue. and is calculated utilizing Equation 1 . W1, W2,
…., Wn are the WTs for processes P1, P2, ….,
1. Assign new process to the ready queue.
PN, while N is the count of processes in the
2. Rearrange all processes in increasing order of their
burst time system. The performance of the algorithm
3. while ready queue is not empty increases as the value of the AWT decreases.
Sum_process_burst=sum of all processes burst time
//N is number of processes in the system 𝑊1 + 𝑊2 +⋯+ 𝑊𝑁
Average_burst=Sum_processes_bursts/N AWT = (1)
𝑁
TQ=0.85* Average_burst
Execute the first process in the ready queue for the 2) Turnaround Time (TT): Turnaround time (TT)
calculated TQ. Calculated the remaining time of the
is the total amount of time spent by a tasks process
current process.
If remaining_time<=TQ then
in the system. Refers to the entire time from the
Re-allocate the CPU to the current process for the process’ submission to its accomplishment and is
remaining time calculated utilizing Equation 2. TT1, TT2, ….,
Else TTn are the TTs for P1, P2, …., Pn processes, and
Send the current processes to the end of ready N represents the count of processes in the system.
Queue When a task present in the system, a process is
Go to step 3
either waiting in the ready queue for getting the
End if
processing unit (CPU) or it is executing on the
If new process arrived them
Go to step 1 processing unit. The efficiency of the algorithm
End if increases as the value of the ATT decreases.
End while
4. Calculate AWT, ATT, ART and #CS. 𝑇𝑇1 + 𝑇𝑇2 +⋯+ 𝑇𝑇𝑁
5. END ATT = (2)
𝑁
Figure 1 illustrated the pseudocode of the
3) Response Time (RT): Response time (RT) is
proposed algorithm. Our choice to the use of 85%
the amount of time after which a process gets the
processing unit for the first time after entering the remaining CPU burst time of the current operating
ready queue. On othe side The time interval process is less than the time limit, the CPU is
between a user's task request and the system redistributed to the current operating time of the
response and is calculated utilizing Equation 3. remaining CPU burst. improved the time quantum
RT1, RT2, …., RTn are the RTs for P1, P2, …., that achieves stability in terms of the average WT
Pn processes. The efficiency of the algorithm and the average TT.
increases as the value of the ART decreases.
Employing all datasets, the final performance of
𝑅𝑇1 + 𝑅𝑇2 +⋯+ 𝑅𝑇𝑁 the algorithms was determined by measuring
ART = (3)
𝑁 AWT, ATT, ARS and #CS performance measures
presented in section 6. These measures were
4) Context Switches (CS): refers to the procedure computed for each process and the mean of
of switching the CPU from one process to each measure was calculated utilizing Equations
another. Context Switching (CS) involves storing 1, 2 and 3.
the context or state of a process so that it can be
reloaded when required and execution can be Table 3 illustrates the results using dataset 1. It is
resumed from the same point as earlier. This is a clear from the results that the proposed algorithm
feature of a multitasking operating system and achieved better results in three criterions than
allows a single CPU to be shared by multiple other algorithms. It was able to produce the least
processes. values, which are 9.38, 15.25 and 7, for AWT,
ATT and #CS (evenly with three other
VII. EXPERIMENTAL RESULTS algorithms). Concerning the ART, it produced a
higher value than other algorithms did. It got the
In this section, the performance of the eight RR-
sixth place among other algorithms.
based scheduling approach presented in section 2
are investigated utilizing the ten datasets
TABLE II. PROCESSES DATASET 1
described in section 4. We took into consideration Process Name Arrival Time CPU Time
three cases for arranging the incoming processes, (sec.) (sec.)
based on their CPU times: ascending order, P1 7 9
descending order, and random order. Extensive P2 0 4
P3 4 8
experiments were performed according to these P4 8 1
orders, but, due to limited space we considered P5 5 2
only the random order for experiments and results P6 4 2
analysis. To give the reader an idea of how these P7 6 5
P8 2 4
algorithms operate, we ran all algorithms over
another dataset, named dataset 1, shown in Table
TABLE III. RESULTS ON DATASET 1
2. This synthetic dataset contains only eight Algorithm AWT ATT ART #CS
processes which can be easily traced. The (sec.) (sec.) (sec.)
processes have different arrival times (min = 0, RR 14.25 20.12 14.25 7
max = 8) and the CPU times ranges from 1 to 9. IRR 14.25 20.12 14.25 7
AAIRR 11.62 17.5 5.25 11
ERR 14.25 20.12 14.25 7
This RR based algorithm improved the Round ARR 13.88 19.75 7.5 11
Robin Remaining time algorithm. If all the RRRT 11.62 17.5 5.25 11
processes arrive simultaneously on the ready line, IRRVQ 16.62 22.5 2.88 25
AMRR 12.38 18.25 9 10
then all the processes are arranged in ascending
Yosef RR 9.38 15.25 9.38 7
order according to their burst time. If the
Table 4 shows the simulation results of four fifth place over two datasets (Dataset-50Z,
performance measures for each scheduling Dataset-200NZ) and the sixth place over other
algorithms over all datasets. Figure 2 shows the datasets. From Figure 2, we observe the
results graphically for all algorithms over all following:
datasets. The results in table 4 point out that the
suggested approach achieved better results in two 1) IRRVQ produced the least value for ART over
criterions over all datasets than other algorithms. all datasets, however, it produced the highest
It produced the least values for AWT and ATT. value of CS over all datasets,
Concerning the number of CCs, it was able to 2) RR, IRR, and ERR algorithms had the same
produce the least number of CS evenly with three behavior regarding CS. They produced the same
other algorithms which are RR, IRR and ERR values of CS over all datasets.
over six datasets which are Dataset-50NZ,
Dataset-70NZ, Dataset-100NZ, Dataset-150Z, 3) IRRVQ produced the highest value for ATT
Dataset-150NZ AND Dataset-200NZ. In addition over all datasets. In general, the proposed
to that, it was able to obtain the second place over algorithm proved to be the best RR based
the remaining datasets which are Dataset-50Z, algorithm among the various algorithms applied
Dataset-70Z, Dataset-100Z, Dataset-200Z, while, in this paper.
RR, IRR, and ERR got evenly the first place. With
respect to the ARS, the proposed approach got the
This algorithm has improved the Round Robin CPU burst time for the current operating system
Scheduling algorithm. It assumes that all is less than the TQ, the CPU is redistributed to the
processes occur simultaneously in a precise line, current operating time of the remaining CPU
and are then arranged in ascending order burst. Otherwise, the process will be added to the
according to their burst time. If the remaining end of the ready process queue.
Fig. 2. Results of executing all algorithms on six datasets