OS Process Scheduling Q & A #2


Advertisements

Question: Explain time slicing? How its duration affects the overall working of the system?

Answer: Time slicing is a scheduling mechanism/way used in time sharing systems. It is also termed as Round Robin scheduling. The aim of Round Robin scheduling or time slicing scheduling is to give all processes an equal opportunity to use CPU. In this type of scheduling, CPU time is divided into slices that are to be allocated to ready processes. Short processes may be executed within a single time quantum. Long processes may require several quanta.

The Duration of time slice or Quantum

The performance of time slicing policy is heavily dependent on the size/duration of the time quantum. When the time quantum is very large, the Round Robin policy becomes a FCFS policy. Too short quantum causes too many process/context switches and reduces CPU efficiency. So the choice of time quanta is a very important design decision. Switching from one process to another requires a certain amount of time to save and load registers, update various tables and lists etc.

Consider, as an example, process switch or context switch takes 5 m sec and time slice duration be 20 m sec. Thus CPU has to spend 5 m sec on process switching again and again wasting 20% of CPU time. Let the time slice size be set to say 500 m sec and 10 processes are in the ready queue. If P1 starts executing for first time slice then P2 will have to wait for 1/2 sec; and waiting time for other processes will increase. The unlucky last (P10) will have to wait for 5 sec, assuming that all others use their full time slices. To conclude setting the time slice.

  • Too short will cause too many process switches and will lower CPU efficiency.

  • Setting too long will cause poor response to short interactive processes.

  • A quantum around 100 m sec is usually reasonable.

os_exams_questions_answers.htm
Advertisements