13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Policies 372.2 Round robin (RR)Our next example, round robin, is a vast improvement over FCFS. The intent of roundrobin is to provide good response ratios for short processes as well as long processes. Infact, it provides identical average response ratio for all processes, unlike FCFS, whichprovides identical average response time.The round robin policy services a process only for a single quantum q of time.Typical values of q range between 1/60 and 1 second. If the process has not finishedwithin its quantum, it is interrupted at the end of the quantum and placed at the rear of theready queue. It will wait there for its turn to come around again and then run for anotherquantum. This periodic interruption continues until the process departs. Each process istherefore serviced in bursts until it finishes. New arrivals enter the ready queue at therear.Round robin can be tuned by adjusting the parameter q . Ifwesetq so high that itexceeds the service requirement for all processes, RR becomes just like FCFS. As qapproaches 0, RR becomes like processor sharing (PS), which means that every processthinks it is getting constant service from a processor that is slower proportionally to thenumber of competing processes. The Hysteresis Principle tells us that we should resistsuch frequent switching. In fact, PS is only theoretically interesting, because as qapproaches 0, process switching happens more frequently, and kernel time rises toward100 percent. The trick is to set q small enough so that RR is fair but high enough so thatkernel time is reasonable.Figure 2.8 shows how RR schedules our sample processes for both q = 1 andq = 4. If a process finishes during its quantum, another process is started immediatelyand is given a full quantum. Newly arrived processes are put at the end of the ready list.If a process arrives at the same time as a quantum finishes, we assume that the arrivaloccurs slightly before the quantum actually expires.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!