Hi Bob,

>         What's the difference between Quantum and Timeslice ?
> Timeslice is used for thread scheduler. Then Quantum used for what ?

A new timeslice is allocated every time a thread is scheduled and (only)
serves to implement round-robin-scheduling: after at most "timeslice"
time, the thread is preempted and another thread can be scheduled. The
preempted thread may be scheduled again.

The (total) quantum was intended to limit the total time the thread may
spend executing on any CPU. It is decreased every time a timer interrupt
occurs (just like timeslices are, see schedule.cc,
handle_timer_interrupt()), but never reset automatically (only via a
schedule syscall). Once a thread runs out of time (no quantum left), it
will not be scheduled again (a preemption IPC should be sent to its
scheduler, but that's disabled due to major problems, see scheduler.cc,
total_quantum_expired()).

In short, the timeslice determines for how long a thread can
continuously occupy a CPU before being preempted, the quantum limits the
total time the thread may spend on the CPUs accumulated over all
occasions the thread was scheduled.

Regards,
Raphael

Reply via email to