Skip to main content

Round-Robin Scheduling in operating system-computer world

 Round-Robin Scheduling in operating system-computer world

Round-Robin Scheduling 

The round-robin(R-R Scheduling) Scheduling algorithm is designed for time sharing operating system. Round-Robin is similar to FCFS Scheduling, but preemption is added to enable the system to switch between processes. In Round-Robin Scheduling a small unit of time is used which is called a time quantum or time slice. A time quantum is generally from 10 to 100 millisecond. The CPU Scheduler goes around the ready queue, allocate the CPU to every process for a time interval of up to 1 time quantum. In this scheduling new processes are added to the tail of the ready queue. The CPU scheduler picks the first process from ready queue, set a timer after one time slice and dispatch the process. One of two things will happens. When a process have CPU burst of less the 1 time quantum. In this case the process itself release the CPU. If the CPU burst time of the currently running process is longer then one time quantum, the will go off . A context will executed, and the process will be put at the tail of the ready queue. The CPU scheduler will the select the next process in the ready queue. The average waiting time under the R-R scheduling is long.  The performance of R-R scheduling is depends on the size the time quantum. In R-R scheduling algorithm, the operating system defines a time quantum. All the process will executed in the cyclic way each process will get the CPU for a small amount of time and then get back to the ready queue to wait for its next turn. The new process is added to the ready queue. Context switching is used to save the processes in PCB. Consider the following set of processes that arrive time 0, with the length of the CPU burst given in milliseconds.

Process                                    Burst Time

 P1                                                             24

 P3                                                              3

 P3                                                              3

In this case we use time quantum of 4 milliseconds, the process p1 gets the first 4 millisecond. Since it require another 20 milliseconds, it is permitted after the first time quantum, and the CPU is given to the next process ,process p2. Process p2 does not need 4 milliseconds, so it quits before it's time quantum expires. The CPU is given to the next process , process p3 once each process received 1 time quantum, the CPU return to the process p1. 

Let's calculate the average waiting time for this schedule. P1 wait for 6 millisecond (10-4), P2 wait for 4 millisecond, p3 wait for 7 millisecond. The average waiting time is 17/3 = 5.66 millisecond.



Comments

Post a Comment

Popular posts from this blog

Deadlock in operating system-computer world

  Deadlock in operating system-computer world Deadlock :  In a multi-programming environment, many process may complete for a minute number of resources. A process make a request for a resource and if the resource is not available at that time, the process enter In a waiting state. A waiting state process is never again-able to change state because the resource it has requested is held by other waiting process. This situation is called deadlock. So we can say that a process is said to be deadlock when it is waiting for an event or resources which will never occurs.   so we can say that in this situation none of the process gets executed  since the resource it needs, is held by some other process which is also waits for some other resource to be released.  Let's assume that there are three process P1, P2, p3 and three different resources R1, R2 and R3. R1 is assigned to p1, R2 is assigned to P2 and R3 is assigned to P3.   After sometime P1 demands for R1 which is being used by  P2.

CPU scheduling in operating system-computer world

  CPU scheduling in operating system CPU scheduling :  Whenever the CPU becomes idle, the operating system must select one of the processes. The selection process is carried by the short-term scheduler. The scheduler selects a process from the processes in memory that that are ready to execute and allocate the CPU to that process. The objective of time sharing is to skip the CPU among processes that user interact with each program while the program is in running position. As we discuss above the process scheduler selects an process for execution on the CPU. There will never more then one running process for a single processor system. If there are many processes, the process will have to wait until the CPU is free CPU Scheduling is basis of multi-programming operating system. In CPU scheduling many processes are kept in memory at a time. The CPU scheduler select a process from the many processes. The process scheduler scheduled different processes to be assigned to the CPU based on part

Single partition allocation, Multiple-partition allocation and Fixed Equal-size partitions in operating system-computer world

  Single partition allocation, Multiple-partition allocation and Fixed Equal-size partitions in operating system Single partition allocation In this scheme operating system is residing in law memory and user process are executing in higher memory. Advantages It is simple  It is easy to understand and use Disadvantages User job is limited to the size of available memory. It leads to poor Utilization of processor and memory. Multiple-partition allocation  It is the simplest method for allocating  memory is divided memory into several fixed size partitions. Fixed Equal-size partitions It divides the main memory Into equal number of fixed sized partitions, operating system occupies some fixed portion and remaining portion of main memory is available for user processes. Advantages It supports multi programming. A process whose size is less then or equal to the partitions size can be loaded into any available partition. Disadvantages If a program is big to fit into a partition use overlay te