Re: fixed time slices?
- From: "m" <m@xxx>
- Date: Fri, 22 Jun 2007 09:38:39 -0400
There is a significant performance cost to increasing the timer frequency.
No the behaviour is not reliable. There is no deterministic timing on
Windows. Your Sleep(1) is only guaranteed to return after _at least_ 1 ms.
It might not return for hours if the system has something better to do than
run your code. You cannot create a reliable 1 ms sleep with a spin wait
loop either because you may be pre-empted at any time and your code may not
run again for hours.
BTW: MSDN says (Sleep function [Base])
"This function causes a thread to relinquish the remainder of its time slice
and become unrunnable for at least the specified number of milliseconds,
after which the thread is ready to run. In particular, if you specify zero
milliseconds, the thread will relinquish the remainder of its time slice but
remain ready. Note that a ready thread is not guaranteed to run immediately.
Consequently, the thread may not run until some time after the specified
interval elapses."
"Jan Bruns" <testzugang_janbruns@xxxxxxxx> wrote in message
news:467b082d$0$14875$9b4e6d93@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"Jan Bruns":
From within the callback-procedure, a loop like
for i := 1 to n do sleep(s); // s>0
takes about n*(s+1) ms. What's difrent with this thread?
This is also true for the main thread that called timeBeginPeriod(1).
Is this relyable behaviour? Why does my application need
to call timeBeginPeriod(1) to make the kernel behave as parts of
the SDK define?
Gruss
Jan Bruns
.
- 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
- fixed time slices?
- Prev by Date: WTSSendMessage fail with error Access Denied
- Next by Date: Re: About memory allocation..
- Previous by thread: Re: fixed time slices?
- Next by thread: Re: fixed time slices?
- Index(es):
Relevant Pages
|
Loading