round robin 44
TRANSCRIPT
-
8/2/2019 Round Robin 44
1/15
ROUND ROBINCPU
SCHEDULING
ALGORITHM
-
8/2/2019 Round Robin 44
2/15
WHAT IS ROUND ROBIN SCHEDULING?
The round-robin (RR) scheduling algorithm is designed especially for timesharingsystems. It is similar to FCFS scheduling, but preemption is added to
switch between processes. A small unit of time, called a time quantum or time
slice, is defined. A time quantum is generally from 10 to 100 milliseconds. The
ready queue is treated as a circular queue. The CPU scheduler goes around the
ready queue, allocating the CPU to each process for a time interval of up to 1
time quantum.
To implement RR scheduling, we keep the ready queue as a FIFO queue of
processes. New processes are added to the tail of the ready queue. The CPU
scheduler picks the first process from the ready queue, sets a timer to interrupt
after 1 time quantum, and dispatches the process.
One of two things will then happen. The process may have a CPU burst of
less than 1 time quantum. In this case, the process itself will release the CPUvoluntarily. The scheduler will then proceed to the next process in the ready
queue. Otherwise, if the CPU burst of the currently running process is longer
than 1 time quantum, the timer will go off and will cause an interrupt to the
operating system. A context switch will be executed, and the process will be
put at the tail of the ready queue. The CPU scheduler will then select the nextprocess in the ready queue.
PROS OF ROUND ROBIN Starvation can never occur, since no priority is given. Order of time unit allocation
is based upon process arrival time, similar to FCFS. Balanced throughput between FCFS and SJF, shorter jobs are completed faster
than in FCFS and longer processes are completed faster than in SJF.
CONS OF ROUND ROBIN
Poor average response time, waiting time is dependent on number of processes,and not average process length.
Because of high waiting times, deadlines are rarely met in a pure RR system.
-
8/2/2019 Round Robin 44
3/15
Table depicting various
scheduling algorithms and
their corresponding
parameters.
Scheduling algorithm CPUOverhead Throughput Turnaround time Response time
First In First Out Low Low High Low
Shortest Job First Medium High Medium Medium
Priority based scheduling Medium Low High High
Round-robin scheduling High Medium Medium High
Multilevel Queue scheduling High High Medium Medium
http://en.wikipedia.org/wiki/Scheduling_algorithmhttp://en.wikipedia.org/wiki/Scheduling_algorithmhttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/Throughputhttp://en.wikipedia.org/wiki/Response_timehttp://en.wikipedia.org/wiki/Response_timehttp://en.wikipedia.org/wiki/First_In_First_Outhttp://en.wikipedia.org/wiki/Shortest_Job_Firsthttp://en.wikipedia.org/wiki/Fixed_priority_pre-emptive_schedulinghttp://en.wikipedia.org/wiki/Fixed_priority_pre-emptive_schedulinghttp://en.wikipedia.org/wiki/Round-robin_schedulinghttp://en.wikipedia.org/wiki/Multilevel_feedback_queuehttp://en.wikipedia.org/wiki/Multilevel_feedback_queuehttp://en.wikipedia.org/wiki/Multilevel_feedback_queuehttp://en.wikipedia.org/wiki/Round-robin_schedulinghttp://en.wikipedia.org/wiki/Fixed_priority_pre-emptive_schedulinghttp://en.wikipedia.org/wiki/Shortest_Job_Firsthttp://en.wikipedia.org/wiki/First_In_First_Outhttp://en.wikipedia.org/wiki/Response_timehttp://en.wikipedia.org/wiki/Throughputhttp://en.wikipedia.org/wiki/CPUhttp://en.wikipedia.org/wiki/Scheduling_algorithm -
8/2/2019 Round Robin 44
4/15
IMPROved ROUND ROBIN(Context switch
method)1.1 In this improvement we try to decrease the turnaround time by decreasing the number of the switching
operations between one process and the other. This operation is done by checking the remain time of the
execution process, if the remain time is less than the time quantum then the process will stay in the processor
(CPU) until it complete its execution, so there will be no switching operation and this will eliminate the switch that
needed by the context switch.
Consider the following example.
Process no Burst time
1 350
2 125
3 4754 250
5 75
Taking time quantum of 60 units.
Context switch shown with simple ROUND ROBIN algorithm
-
8/2/2019 Round Robin 44
5/15
Context switches shown with improved round robin
Conclusion
We observe that using this algorithm turnaround time andwaiting time decreases.
-
8/2/2019 Round Robin 44
6/15
-
8/2/2019 Round Robin 44
7/15
Lets consider a suitable example to evaluate this algorithm.
Example:Consider 5 processes with burst times 30,62,74,88,34(take time
quanta=25).
According to algorithm we need to arrange these bursttimes in ascending order.
-
8/2/2019 Round Robin 44
8/15
Gantt chart for simple round robin scheduling.
By improvising the algorithm we get.
N=5Median=Y(n+2)/2=62
New time quanta= 62+88/2=75
Using above time quanta Improved Gantt chart is:-
Result
Table showing comparison between the variousparameters for the following data.
Qt=quantum time
Cs=context switch
Awt=average waiting time
Att=average turn around time
We can use this for processes with or without arrival
times.
-
8/2/2019 Round Robin 44
9/15
Conclusion:We observe that the proposed algorithm
gives increased time quanta but reduces others parameters
significantly ie its more efficient than existing RR
-
8/2/2019 Round Robin 44
10/15
TERMINOLOGIES USED IN
CPU scheduling
CPU Utilization. We want to keep the CPU asbusy as possible.
Throughput. If the CPU is busy executing
processes, then work is being done. One
measure of work is the number of processes
that are completed per time unit, called
throughput. For long processes, this rate maybe one process per hour; for short transactions,
it may be 10 processes per second.
Turnaround time. From the point of view of a
particular process, the important criterion is
how long it takes to execute that process. The
interval from the time of submission of a
process to the time of completion is theturnaround time. Turnaround time is the sum
of the periods spent waiting to get into
memory, waiting in the ready queue, executing
on the CPU, and doing I/O.
Waiting time. The CPU scheduling algorithm
does not affect the amount of the time during
which a process executes or does I/O; it affectsonly the amount of time that a process spends
waiting in the ready queue. Waiting time is the
sum of periods spend waiting in the ready
queue.
-
8/2/2019 Round Robin 44
11/15
Response time. In an interactive system,
turnaround time may not be the best criterion.
Often, a process can produce some output
fairly early and can continue computing newresults while previous results are being output.
PROCESS STATE DIAGRAM
Various Scheduling Algorithms Used are:-
FCFS(First Come First Serve)
SJF(shortest job first)
Round Robin
Priority scheduling
Multilevel Queue Scheduling
Multilevel Feedback Queue,Multilevel Queue Scheduling among Queues
-
8/2/2019 Round Robin 44
12/15
Typical example of Round robin
-
8/2/2019 Round Robin 44
13/15
Improved round robin(combining sjf andround robin)In our Proposed RR scheduling algorithm we
have
combined the working of SJF (shortest job
first)
scheduling algorithm along with
contemporary RR
scheduling algorithmProposed algorithm1. Allocate all processes to the CPU only one
time as like present Round Robin scheduling
algorithm.
2. After first time we select shortest job from the
waiting queue and it shortest job assign to the
CPU.3. After that we select next shortest job and do
step 2
4. Till the complete execution of all processes we
repeat steps 2 and 3 that means while all the
processes has not been finished(executed).
Example
-
8/2/2019 Round Robin 44
14/15
-
8/2/2019 Round Robin 44
15/15