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

From: Chris Wedgwood (cw@f00f.org)
Date: Fri Jan 19 2001 - 18:31:39 EST


            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/



This archive was generated by hypermail 2b29 : Tue Jan 23 2001 - 21:00:21 EST