Extended RR-scheduling algorithm
Shared by: ijcsiseditor
Categories
Tags
IJCSIS, call for paper, journal computer science, research, google scholar, IEEE, Scirus, download, ArXiV, library, information security, internet, peer review, scribd, docstoc, cornell university, archive, Journal of Computing, DOAJ, Open Access, May 2011, Volume 9, No. 5, Impact Factor, engineering, international, proQuest, computing, computer, technology
-
Stats
- views:
- 137
- posted:
- 6/5/2011
- language:
- English
- pages:
- 5
Document Sample


(IJCSIS) International Journal of Computer Science and Information Security,
Vol. 9, No. 5, May 2011
Extended RR-scheduling algorithm
Prof. Sunita Chand, Ms. Teshu Chaudhary, Mr. Manoj Kumar
Krishna Engineeering College,
95-Loni Road, Near Mohan Nagar,U.P-201007, India
e-mail: sunitamk@gmail.com,
teshuchaudhary@gmail.com
kumarmanoj1989.kumar@gmail.com,
Abstract: RR-scheduling algorithm was designed for the i. The processes are evaluated on the grounds of
time-sharing system or interactive systems. The first process expected CPU burst time and are arranged in the ready
in the queue run until it expires its quantum (i.e. runs for as queue in the increasing order of CPU time
long as the time quantum), then the next process in the queue ii. The ready queue is maintained as a circular queue.
runs and so on. RR scheduling is implemented with timer iii. The processes may be considered to arrive at the same
interrupts. When a process is scheduled, the timer is set to go time. In such a case arrival time for all process is
off after the time quantum amount of time expires. When
considered to be zero.
process expire its quantum, a context switch takes place. The
state of the running process is saved and context of next iv. There may be cases when arrival time of the processes
process in the ready queue is loaded in CPU registers. it gives are different. In that case the ready queue needs to be
good response time, but can give bad waiting time. refreshed every time a new process arrives in the
system according to the shortest CPU burst time of all
We propose here a modification to round robin scheduling the processes in ready queue along with the newly
algorithm which not only gives good response time but also entered process.
shows reduction in waiting time. If the processes in the ready v. No process can hold the CPU forever. Each process
queue are arranged in the increasing order of the expected executes for the a period of time slice.
CPU burst time instead of first come first serve manner, the vi. Time Sharing is implemented by a hardware timer. On
waiting time of the processes will decrease in addition to fast each context switch, the system loads the timer with
response time. the duration of time slice and hands control over to the
[[
new process. The preempted process is re- queued at
the end of the ready queue. When the timer times out,
I. INTRODUCTION: it interrupts the CPU which then steps in and switches
to the next process.
In this approach, the ready queue is assumed to be a vii. Concept of priority is used to resolve the contentions
circular queue. Extended RR-scheduling algorithm is also that may result when two or more processes have the
designed for the time-sharing system. This algorithm may same burst time (execution time), in that case the CPU
prove to be better than RR-scheduling algorithm in is allocated to that process which needed the CPU
following ways: quickly and want to finish in short time or we can say
has higher priority.
It reduces waiting time viii. When short processes keep entering in system, long
It reduces turn around time process will suffer starvation as every time a short
It reduces response time process enters the system, the ready queue will be
In some case, context switching time can be refreshed and the longer process will be shifted to the
reduced. tail of ready queue. Although starvation cannot be
If two or more process has same burst time then a removed completely, it can be minimized by using
process that has highest priority will get the CPU AGING. Whenever a process is put to the tail of ready
first. The highest priority process will has to no queue without execution, the priority of this process
longer wait in ready queue. should be increased by one i.e., numerically it should
be decreased as low number represent high priority.
This way the process will get priority and gets a
II. EXTENDED ROUND ROBIN SCHEDULING chance to execute.
ALGORITHM
The Extended round robin algorithm works in the III. EVALUATION OF EXTENDED RR-SCHEDULING
following way : ALGORITHM:
109 http://sites.google.com/site/ijcsis/
ISSN 1947-5500
(IJCSIS) International Journal of Computer Science and Information Security,
Vol. 9, No. 5, May 2011
We evaluate the new “Extended RR Scheduling
Algorithm” using deterministic modeling approach of In the above solution Context switch takes place 4 times
“analytic evaluation” method [1]. It takes a particular pre- while in the previous solution context switch took place only
defined workload and evaluate the performance of each 3 times
algorithm for that workload. Here we determine the
behavior of normal round robin and extended round robin EXAMPLE 2:
algorithm presented here, for the same work load. Also we For the same set of processes, consider that the arrival time for
check the response of these algorithms for different set of each process is 0, whereas Time slice is 1 ms.
workload. We consider them as different cases. Each case
is explained separately to compare the performances of the Figure 3 below shows the behavior of “Extended RR
two algorithms. scheduling algorithm” whereas figure 4 shows the behavior
of normal RR algorithm.
Also the performance of the Extended RR scheduling has SOLUTION USING EXTENDED RR SCHEDULING
been proved to be far better as compared to normal RR ALGORITHM:
Scheduling algorithm through the C-Code implementation.
The code written in C language executed for a variety of P2 P3 P1 P2 P3 P1 P2 P3 P1 P3 P1
sets of workload for different number of processes, thus
proving the above fact . 0 1 2 3 4 5 6 7 8 9 10 27
CASE 1: Fig. 3
Waiting time:
IF an arrival time of all the processes is assumed to be P1 : 2+2+2+1 = 6
same and their burst times are different. P2 : 0+2+2 = 4
THEN Extended RR Scheduling algorithm sort the P3 :1+2+2+1 = 6
processes in increasing order and allocate these processes
to CPU in the same order. (No need of priority in this case) Average Waiting time: (6+4+6)/3 = 18/3;
EXAMPLE 1: Solution using Normal RR Scheduling Algorithm:
Process Burst time P1 P2 P3 P1 P2 P3 P1 P2 P3 P1 P3 P1
P1 20
P2 3 0 1 2 3 4 5 6 7 8 9 10 11 27
P3 4 Fig.4
Arrival time for each process is 0. Time slice is 4 ms. Waiting time:
Gantt Chart for extended RR Scheduling is as shown in P1 : 0+2+2+2+1= 7
Fig.1: P2 : 1+2+2 = 5
P3 : 2+2+2+1 = 7
P2 P3 P1 P1 P1 P1 P1 (According to RR scheduling Average Waiting time is =
(7+5+7)/3 = 19/3;
0 3 7 11 15 19 23 27
Fig. 1
Example 3:
Waiting time:
P1 : 7 Process Burst time
P2 : 0 P1 4
P3 : 3 P2 5
Average Waiting time: (7+0+3)/3 = 10/3; P3 3
SOLVED BY RR-SCHEDULING ALGORITHM : Arrival time for each process is 0. Time slice is 1 ms.
Gantt Chart for RR Scheduling is as shown below in Fig. 2. Gantt Chart for Extended RR Scheduling is as shown in
Fig.5:
P1 P2 P3 P1 P1 P1 P1 P3 P1 P2 P3 P1 P2 P3 P1 P2 P1 P2 P2
0 4 7 11 15 19 23 27 0 1 2 3 4 5 6 7 8 9 10 11 12
Fig. 2 Fig. 5
(According to RR scheduling Average Waiting time is Waiting time:
= ( 7+4+7)/3 =18/3
P1 : 1+2+2+1 = 6
NOTE: In some case context-switching time can be reducing. P2 : 2+2+2+1 = 7
110 http://sites.google.com/site/ijcsis/
ISSN 1947-5500
(IJCSIS) International Journal of Computer Science and Information Security,
Vol. 9, No. 5, May 2011
P3 : 0+2+2 =4 P3 P4 P2 P4 P2 P1 P1
0 3 6 9 10 11 14 17
Average Waiting time: (6+7+4)/3 = 17/3; Fig. 7
(According to RR scheduling Average Waiting time is = Waiting time:
19/3 P1 : 9+2 = 11
P2 : 6+4 = 10
P3 : 0 =0
CASE 2: P4 : 3+6 =6
IF an arrival time of all the processes is the same and the Average Waiting time using extended RR Scheduling :
burst time of some of these processes are also same. (11+7+0+6)/4 = 24/4.
THEN sort the processes in increasing order according the
burst time and sort those processes having same burst time (According to normal RR Scheduling, Average Waiting
according to their priority (highest priority process will get time is = 40/4.
the CPU first). we compare a new process to all process
excluding lastly executed process(example 2). CASE 3
IF an arrival time of all the processes is different i.e.,
processes in the system are arriving at different time which
. is quite obvious, and the CPU burst time of some of them
EXAMPLE 1: are same.
Process Burst time Priority THEN the processes need to be sorted in increasing order
P1 20 3 of the CPU burst time every time when a new process
P2 3 2 arrives in the system. and the processes having same burst
P3 3 1 time are sorted according to their priority (highest priority
process will get the CPU first).The CPU is allocated to
these processes in the round robin manner for a time period
Arrival time for each process is 0. Time slice is 4 ms.
equal to the “time slice” or “time quantum”.
We describe this algorithm as below:
Gantt Chart for extended RR Scheduling is as shown in
Fig.6:
IF the time of process completion (or partial completion) is
P3 P2 P1 P1 P1 P1 P1 equal to the time of a new process entering into the queue.
THEN compare burst time of new process to the remaining
0 3 6 10 14 18 22 26 burst time of processes excluding last executed process.
Fig. 6 IF burst time of new process is less than the remaining
Waiting time: processes
P1 : 6 THEN firstly, new process should be allocated to CPU
P2 : 3 then other remaining processes
P3 : 0 ELSE sorts all remaining process as per their remaining
burst time together with the new process and then allocate
Average Waiting time: (6+3+0)/3 = 9/3; the CPU to these processes in increasing order of their CPU
(According to RR scheduling Average Waiting time is = burst time.
17/3.
EXAMPLE 1.
EXAMPLE 2 : Process Arrival Burst Priority
time time
Process Burst time Priority
P1 0 10 1
P1 6
P2 1 5 3
P2 4 2
P3 2 5 2
P3 3
P4 4 1 Time slice is 3 ms.
Gantt Chart for Extended RR Scheduling is as shown in
Arrival time for each process is 0. Time slice is 3 ms. Fig.8:
Gantt Chart for extended RR Scheduling is as shown in P1 P3 P2 P3 P2 P1 P1 P1
Fig.7: 0 3 6 9 11 13 16 19 20
Fig.8
111 http://sites.google.com/site/ijcsis/
ISSN 1947-5500
(IJCSIS) International Journal of Computer Science and Information Security,
Vol. 9, No. 5, May 2011
Waiting time:
P1 : 0+ 10 -0 = 10 Time slice is 2 ms.
P2 : 6+2 -1 = 7
P3 : 3+3 -2 = 4 Gantt Chart for Extended RR Scheduling is as shown in
Fig.11:
Average Waiting time: (10+7+4)/3 = 21/3;
(According to RR scheduling Average Waiting time is = P1 P2 P4 P2 P1 P3 P1 P3
27/3. 0 2 4 5 6 8 10 12 14
Fig. 11
Waiting time:
EXAMPLE 2
P1 : 0+4+ 2 -0 = 6
Process Arrival Burst time Priority
P2 : 2 +1 -1 = 2
time
P3 : 8+2 -2 = 8
P1 0 7 1 P4 : 0 -4 = 0
P2 1 5 2
P3 2 3 4 Average Waiting time as per Extended Round Robin
P4 6 2 3 Scheduling : (6+2+8+0)/4 = 16/4
P5 12 3 5
Average Waiting time as per normal Round Robin
Time slice is 2 ms. Scheduling =22/4
Gantt Chart for Extended RR Scheduling is as shown in
Fig.9: EXAMPLE 4:
P1 P3 P2 P3 P4 P2 P1 P2 P1 P5 P1 P5
Process Arrival Burst time Priority
0 2 4 6 7 9 11 13 14 16 18 19 20 time
Fig. 9 P1 0 6 1
P2 1 4 2
Waiting time: P3 2 3 4
P1 : 0+9+1+2 -0 = 12 P4 2 3 3
P2 : 4+3+2 -1 = 8
P5 4 1 5
P3 : 2+2 -2 = 2
P4 : 7 -6 = 1
Time slice is 2 ms.
P5 : 16+1 -12 = 5
Gantt Chart for Extended RR Scheduling is as shown in
Average Waiting time as per Extended RR scheduling
Fig.12:
algorithm : (12+8+2+1+5)/5 = 28/5
P1 P4 P5 P4 P3 P1 P3 P1 P2 P2
Gantt Chart for normal RR Scheduling is as shown in Fig.10:
0 2 4 5 6 8 10 11 13 15 17
Fig. 12
P1 P2 P3 P4 P1 P2 P3 P1 P5 P2 P1 P5
0 2 4 6 8 10 12 13 15 17 18 19 20
Waiting time:
Fig.10
P1 : 0+6+1 -0 = 7
P2 : 13 -1 = 12
Average Waiting Time as per normal Round Robin Scheduling
P3 : 6+2 -2 = 6
Algorithm : (12+12+8+0+5)/5 = 37/5
P4 : 2+1 -2 = 1
P5 : 4 -4 = 0
EXAMPLE 3:
Average Waiting time using Extended RR scheduling:
Process Arrival Burst Priority (7+12+6+1+0)/5 = 26/5;
time time
P1 0 6 1 Average Waiting time using normal RR scheduling:
38/4.
P2 1 3 3
P3 2 4 4
P4 4 1 2
112 http://sites.google.com/site/ijcsis/
ISSN 1947-5500
(IJCSIS) International Journal of Computer Science and Information Security,
Vol. 9, No. 5, May 2011
IV. CONCLUSION AND FUTURE SCOPE
Extended RR-scheduling algorithm can reduce the Waiting
time, turnaround time and the response time. If two or more
processes have same burst time then a process that has
higher priority will get the CPU. The time sharing system
can become more effective from the point of view of
Average Waiting Time and Turnaround time.
Although there are chances of longer processes to be
starved when shorter processes keep entering the system. In
that case aging may prove to be helpful in providing the
solution.
There can be other solutions to this problem like
implementing a separate queue for those longer process
which reaches at the head of ready queue for execution but
CPU is not allocated to these process as some other short
process has entered the ready queue. We are leaving this
solution to be evaluated as our future scope.
V. REFERENCES
[1]. Operating System Concept, Silberschatz Galvin.
113 http://sites.google.com/site/ijcsis/
ISSN 1947-5500
Related docs
Other docs by ijcsiseditor
Digital Images Encryption in Spatial Domain Based on Singular Value Decomposition and Cellular Automata
Views: 0 | Downloads: 0
Agent Behavior in Multiagent Systems: Issues and Challenges in Design, Development and Implementation
Views: 1 | Downloads: 0
Optimizing Cost, Delay, Packet Loss and Network Load in AODV Routing Protocols
Views: 2 | Downloads: 0
Get documents about "