Re: PROBLEM: select() on TCP socket sleeps for 1 tick even if data available

Chris Wedgwood (cw@f00f.org)
Sat, 20 Jan 2001 12:31:39 +1300


main()
{
for (int i = 0; i < 1000; i++) {
struct timeval to;
to.tv_sec = 0;
to.tv_usec = 1000;
select(0, 0, 0, 0, &to);
}
return 0;
}

ia32 with HZ=100 means sleep will sleep for 10ms each time, no less.
The time passed to slect is a _minimum_ the kernel make no guarantee
it will be less, but assures it will be more (10ms is the default
timer interval for the intel platform, others (e.g. alpha) differ)

run your conde with strace -t to see what i mean

--cw
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/