Re: Need info on Windows Timers
From: Don Burn (burn_at_stopspam.acm.org)
Date: 07/08/04
- Next message: John Phillips: "Re: Detecting OS versions"
- Previous message: Brown Dwarf: "Need info on Windows Timers"
- In reply to: Brown Dwarf: "Need info on Windows Timers"
- Next in thread: Brown Dwarf: "Re: Need info on Windows Timers"
- Reply: Brown Dwarf: "Re: Need info on Windows Timers"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 8 Jul 2004 15:30:10 -0400
Answers inline:
"Brown Dwarf" <brown_drf@yahoo.com> wrote in message
news:eU5vh$RZEHA.644@tk2msftngp13.phx.gbl...
> Hello there.
> I am looking for some authentic links / articles which talks about
> windows (hi-precision) timers.
> I've been google'ing and found a handful, some of them were useful but
most
> of them were not.
>
> The specific things that I am looking for are :
>
> 1) How exactly Windows executes the timer callback.
> From the articles I read, this is what I know. There is a Timer kernel
> object which is associated to the
> timer interrupt (h/w). When the interrupt occur, the OS checks if
there
> are any timer callbacks requested
> and executes them.
>
> Fine! Simple. But how does that "execute" part work ?
> Does it create a thread for the user's call back function ?
> If yes, does it create a thread every time ? or is there a thread pool
?
> What is the priority of that thread ?
> Can I assume that such a thread will be executed "soon" or it just
goes
> to the thread READY queue ?
> OR this is not the way windows timer callback works ? :)
>
You've got the model wrong. When the interrupt occurs and the timer expires
the callback is a DPC. Now since you did know this some explanation. A DPC
is a routine described by an object placed on a queue, when the processor is
about to leave DISATCH_LEVEL IRQL the list is walked and each routine
described by an object is executed using the current thread to do the
execution. Now DISPATCH_LEVEL is a software concept that is part of the
OS'es interrupt request level (IRQL), some of these are relatedreal
interrupts, but DISPATCH_LEVEL is below this and is the level that scheduler
runs in. So the callback will run as soon as there are no interrupt, and
previously queued DPC's have run.
> 2) I read some where that the multi media timers were introduced in NT4.0
> itself.
> I also read that MM timers are 1 milli sec accurate. -- Woo!! great !!
> Then I read NT 4.0 timer had only 10 to 15 milli sec accuracy !!
> May be I read the wrong articles. But, what is the reality ?
Reality is by default you get the 10 to 15 ms accuracy. MM timers change
the update frequency (with an impact on performance) so you get the
increased accuracy.
> 3) A basic question :
> As we know the thread dispatcher/scheduler is the most critical part
of
> a multi-threaded OS.
> Does the dispatcher depend on h/w like 8254 chip to get the ticks OR
is
> it (somehow) using the CPU clock itself ?
>
It uses the 8254 for ticks.
-- Don Burn (MVP, Windows DDK) Windows 2k/XP/2k3 Filesystem and Driver Consulting Remove StopSpam from the email to reply
- Next message: John Phillips: "Re: Detecting OS versions"
- Previous message: Brown Dwarf: "Need info on Windows Timers"
- In reply to: Brown Dwarf: "Need info on Windows Timers"
- Next in thread: Brown Dwarf: "Re: Need info on Windows Timers"
- Reply: Brown Dwarf: "Re: Need info on Windows Timers"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|