Antw: Re: [linux-audio-dev] Big Qthread vs. pthread and usleep problem

Andreas DUNKE adunke at maku.de
Fri Nov 30 09:55:09 GMT 2001


Hi!

MfG,
Andreas Dunke


>>> Paul Davis <pbd at Op.Net> 30.11.2001  00.29 Uhr >>>

>>2) I am using pthread_create right now (everything works), but since the
>>loop within the thread is infinite, it poses as a serious resource hog.
>>So, what I decided to do is to add usleep(10000) value which would give
>>me 10ms sleep "sessions" in between the counting, since my timer only

>You can't "just sleep" for less than 20ms. The system timer has that
>resolution (at least, by default on x86; its different on other
>architectures and it can be changed at kernel compile time), and it is
>what is used to wakeup processes that call sleep/usleep/nanosleep. see
>below for more.

Some weeks ago I had the same problem (usleep() can not sleep less than 20ms on a x86).
To change this, you have some posibilities:
1) Change the #define HZ to a higher value. With a Kernel 2.4 it can not be greater than 1536 (I don't no why). With Kernel 2.2 yout can set it higher. With this change you can sleep for about 1 ms.
2) In the web I found a low-latancy patch for the kernel, wich do some changes in the kernel to solve the 'problem'
3) You can use KURT. It is change the kernel in that way, that you have a realtime kernel. http://www.ittc.ku.edu/kurt/ 






-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list