increase select/poll timeout granularity on linux

Bas Denissen b.denissen at triple-it.nl
Mon Sep 28 12:24:07 CEST 2009


Thanks for your reply.

Using a ubuntu real-time kernel, I found the same (500) value, so it 
seems it doesn't get much better than that with 'stock' kernels.

I'll go dig around the kernel source to find where the limit (probably 2 
msec in this case) is set, perhaps there's a (standard) way to lower it 
even more..

Regards,

   Bas Denissen



Marc Lehmann wrote:
> On Wed, Sep 23, 2009 at 09:00:51PM +0200, Bas Denissen <b.denissen at triple-it.nl> wrote:
>> Does anyone on this mailinglist know how to increase the select and/or  
>> poll timeout granularity on a linux system? It seems on all the linux  
>> boxes I have access to, to be 4 msec. Below is my small test program to  
>> test the granularity.
> 
> Increase your HZ.
> 
>> It probably has something to do with the HZ* settings of the linux  
>> kernel, but as far as I can see the standard fedora 11 kernel, which has  
>> HZ set to 1000, also has the 4 msec granularity...
> 
> It most likely has HZ=250 or something like that, or is a tickless system
> with interesting effects.
> 
> On my kernel (with HZ=1000), I get 500 from your test program.
> 
> Note that AnyEvent cannot give you better accuracy than the underlying
> event loop, some of which are limited to 0.01s granularity (and the perl
> backend adds almost 1ms to every timeout on typical linux systems).
> 
> In general, you should not expect better than 2-4ms, even with event loops
> that do not artificially limit the resolution.
> 




More information about the anyevent mailing list