Re: fixed time slices?
- From: "Alexander Grigoriev" <alegr@xxxxxxxxxxxxx>
- Date: Tue, 26 Jun 2007 21:10:29 -0700
Hardware timer interrupts can be programmed by the HAL for different
frequency, depending on ExSetTimerResolution. But dispatcher (thread
scheduler) "tick" stays the same. This means that ready-to-run threads of
_equal_ current priority will always be switched at the same intervals.
NEVERTHELESS, as soon as a higher priority thread becomes ready to run, it
will preempt any lower priority thread. Preemption doesn't have to wait
until thread time slice ends. Scheduler "ticks" (relatively constant) only
mean to do time-slicing among same priority threads. Hardware timer
interrupts is what actually fires any scheduled timers and tracks Sleep()
and WFSO() timeouts, and they may have higher (variable) frequency. Some
systems may also provide high-resolition interval timer, spec designed by
Intel around 2002(?).
"m" <m@xxx> wrote in message news:uw328w$tHHA.1768@xxxxxxxxxxxxxxxxxxxxxxx
AFAIK the scheduler does not behave this way but if the scheduler planed a
timer interrupt for a specific delay for the purpose of changing tasks
pre-emptivly, then that is just the end of the low-priority thread's time
slice. In this case, the scheduler would not detect that a higher
priority thread was ready to run, but would _know_ that said thread would
be ready to run and adjusted the time slices of other threads accordingly.
This example only makes sense in the case of simple Sleep(n) calls because
the scheduler can only _know_ when a thread will become ready to run if
there is a fixed or known delay. Since even the relatively simple call
SleepEx(n, true) does not have a fixed or known delay, the scheduler
cannot make any assumptions about how best to optimize the timer
interrupts. Combine this complexity with thousands of threads using tens
of thousands of wait objects in much more complex ways than sleep (like
WFMO and Semaphores, GQCS & IOCP, or Timer Queues) and it is easy to see
why a fixed timer interrupt interval would be the implementation of
choice.
.
- Follow-Ups:
- Re: fixed time slices?
- From: Jan Bruns
- Re: fixed time slices?
- References:
- fixed time slices?
- From: Jan Bruns
- Re: fixed time slices?
- From: Don Burn
- Re: fixed time slices?
- From: m
- Re: fixed time slices?
- From: Jan Bruns
- Re: fixed time slices?
- From: Jan Bruns
- Re: fixed time slices?
- From: m
- Re: fixed time slices?
- From: Jan Bruns
- Re: fixed time slices?
- From: m
- Re: fixed time slices?
- From: Jan Bruns
- Re: fixed time slices?
- From: m
- fixed time slices?
- Prev by Date: Re: fixed time slices?
- Next by Date: Re: fixed time slices?
- Previous by thread: Re: fixed time slices?
- Next by thread: Re: fixed time slices?
- Index(es):
Relevant Pages
|