Re: select & gettimeofday
From: Moritz Franosch (mail_at_Franosch.org)
Date: 02/14/04
- Previous message: Måns Rullgård: "Re: Is RH 7.2 schedule policy different of RH 9 ???"
- In reply to: Floyd Davidson: "Re: select & gettimeofday"
- Next in thread: Qasim Zaidi: "Re: select & gettimeofday"
- Reply: Qasim Zaidi: "Re: select & gettimeofday"
- Reply: David Schwartz: "Re: select & gettimeofday"
- Reply: Floyd Davidson: "Re: select & gettimeofday"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 14 Feb 2004 13:46:06 +0100
Floyd Davidson <floyd@barrow.com> writes:
> Moritz Franosch <mail@Franosch.org> wrote:
> >
> >As TIMEOUT specifies the _maximum_ time to wait, select should
> >_always_ return _before_ the timeout, i.e. before 10 ms or before 3
> >ms, respectively. It does not in the case TIMEOUT=3 ms (in this case
> >it returns after about 10 ms). Cases where select returns after
> >TIMEOUT are a kernel and/or glibc bug.
>
> There is no bug, and in fact you cannot tell, in a user process,
> exactly when select() returns!
In this case the documentation should say so, e.g. "Select can return
before timeout, in any case. Else, timeout is the approximate amount
of time elapsed before select returns." and not "timeout is an upper
bound on the amount of time elapsed before select returns."
The function select does not work as described. If something does not
work as described there is a bug, either in the documentation or
elsewhere.
> The traditional UNIX scheduler has a 10ms granularity, which
> made sense with slow processors. The 2.6.x kernel changed that,
> and the program will demonstrate finer granularity with the
> program you showed.
No, surprisingly it does not. Why?!
I've set tm.tv_usec=3000 (3 ms) in the example run below.
jfranosc@koma:~/tmp/test> cat /proc/version
Linux version 2.6.1 (jfranosc@cell2) (gcc version 3.2.2) #1 SMP Tue Feb 3 20:04:16 CET 2004
jfranosc@koma:~/tmp/test> g++ ./select.cpp
jfranosc@koma:~/tmp/test> ./a.out
2.97
10.238
9.799
10.727
10.578
9.835
9.966
Moritz
-- Dipl.-Phys. Moritz Franosch http://Franosch.org
- Previous message: Måns Rullgård: "Re: Is RH 7.2 schedule policy different of RH 9 ???"
- In reply to: Floyd Davidson: "Re: select & gettimeofday"
- Next in thread: Qasim Zaidi: "Re: select & gettimeofday"
- Reply: Qasim Zaidi: "Re: select & gettimeofday"
- Reply: David Schwartz: "Re: select & gettimeofday"
- Reply: Floyd Davidson: "Re: select & gettimeofday"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|