Sie sind auf Seite 1von 15

ROUND ROBIN CPU SCHEDULING ALGORITHM

WHAT IS ROUND ROBIN SCHEDULING?


The round-robin (RR) scheduling algorithm is designed especially for timesharing systems. 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 CPU voluntarily. 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 next process 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.

Scheduling algorithm

CPU Overhead Throughput Turnaround time Response time

First In First Out

Low

Low

High

Low

Shortest Job First

Medium

High

Medium

Medium

Table depicting various scheduling algorithms and their corresponding parameters.

Priority based scheduling

Medium

Low

High

High

Round-robin scheduling

High

Medium

Medium

High

Multilevel Queue scheduling High

High

Medium

Medium

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 1 2 3 4 5 Burst time 350 125 475 250 75

Taking time quantum of 60 units.

Context switch shown with simple ROUND ROBIN algorithm

Context switches shown with improved round robin

Conclusion

We observe that using this algorithm turnaround time and waiting time decreases.

Improved round robin(reducing time quantum method)

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 burst times in ascending order.

Gantt chart for simple round robin scheduling. By improvising the algorithm we get. N=5 Median=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 various parameters 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.

Conclusion:We observe that the proposed algorithm gives increased time quanta but reduces others parameters significantly ie its more efficient than existing RR

TERMINOLOGIES USED IN CPU scheduling


CPU Utilization. We want to keep the CPU as busy 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 may be 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 the turnaround 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 affects only 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.

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 new results 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

Typical example of Round robin

Improved round robin(combining sjf and round robin)


In our Proposed RR scheduling algorithm we have combined the working of SJF (shortest job first) scheduling algorithm along with contemporary RR scheduling algorithm
Proposed algorithm 1. 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

Das könnte Ihnen auch gefallen