[lkml]   [1996]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: why can't select() sleep for 1 jiffy?

[ Btw - I'm back in Finland, and you can forget about the temporary US
address (in fact, it may not even exist any more). ]

On Fri, 30 Aug 1996, Ingo Molnar wrote:
> from fs/select.c:
> timeout = ROUND_UP(get_user(&tvp->tv_usec),(1000000/HZ));
> timeout += get_user(&tvp->tv_sec) * (unsigned long) HZ;
> if (timeout)
> timeout += jiffies + 1;
> Thus timeout is at least jiffies+2 [or 0]. So we cant sleep until the
> next jiffy, we have to wait for two timer interrupts.
> Is this some POSIX.1 thing?

Yes. POSIX requires that we sleep at LEAST as long as the timeout

The reason we do the "timeout += jiffies+1" thing is that the next timer tick
might be very soon indeed, so if we timed out on the next jiffy we would end
up waiting for just 0.5 jiffies on average. That's why we have to wait for at
least 2 timer ticks to be safe...


 \ /
  Last update: 2005-03-22 13:37    [W:0.020 / U:7.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site