Re: select & gettimeofday

From: Moritz Franosch (mail_at_Franosch.org)
Date: 02/14/04

  • Next message: P.T. Breuer: "Re: strncpy and __strncpy_from_user"
    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
    

  • Next message: P.T. Breuer: "Re: strncpy and __strncpy_from_user"

    Relevant Pages

    • Re: select & gettimeofday
      ... >> There is no bug, and in fact you cannot tell, in a user process, ... timeout is the approximate amount ... The measured delay was 1.00 milliseconds ...
      (comp.os.linux.development.system)
    • Re: Causing File Download on Page Load
      ... or Windows Mail (which are infamous for this bug), ... you had suggested that isMethod was shown "above" ... but before the timeout occurs. ... The timeout triggers the download. ...
      (comp.lang.javascript)
    • Re: Racoon(8) Deleting SPD Entries
      ... It appears to be a bug in Racoon; ... security policy it gives it a timeout equal to the timeout on the SA. ... tunnelling to/from only particular networks but with the remote tunnel ...
      (freebsd-net)
    • [PATCH 2.4] tipar char driver: wront timeout value
      ... The formula used to calculate jiffies from timeout was wrong. ... The new formula is ok and takes care of integer computation/rounding. ... This bug has already been fixed in the 2.6 kernel. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Timeout on recordset retrieval/Opening recordset passing comma
      ... I wish I did have a version with the bug - my problem is that the query times out when I don't want it to. ... However the article hints that there is a dynamic property of a recordset to set the timeout, so maybe I should try setting that to zero, or a very large value. ... >> Set oCmd = New ADODB.Command ...
      (microsoft.public.data.ado)