From: Doug Siebert <dsiebert@divms.uiowa.edu>
To: linux-kernel@vger.kernel.org
Subject: Re: strange nonmonotonic behavior of gettimeoftheday -- seen similar problem on PPC
Date: Fri, 2 Mar 2001 22:22:19 -0600 (CST) [thread overview]
Message-ID: <200103030422.WAA27608@server.divms.uiowa.edu> (raw)
"Richard B. Johnson" wrote:
>
>I think it's a math problem in the test code. Try this:
>
[code deleted]
>
>Note that two subsequent calls to gettimeofday() must not return the
>same time even if your CPU runs infinitely fast. I haven't seen any
>kernel in the past few years that fails this test.
I find that claim to be pretty ridiculous, I have never seen such a
thing in any standard. I was writing code allowing the for '='
condition five years ago, because I was assuming that it might live
long enough for this sort of thing to start happening. Simple defensive
programming (probably smart even if POSIX was to declare this to be
the case)
So then I was I was curious if I could find any systems fast enough to
violate this. I didn't have to look far, my new laptop with a 600MHz
Pentium III (running kernel 2.2.16, not that it matters) hits the "break"
in your program (i.e., same time from the two gettimeofday() calls) every
single time I run it. If I add another identical call to gettimeofday()
immediately after the second one, that makes the result of the (now)
third call 1us greater so the code loops as you intended.
What you claim may have been true due to the inability of CPUs to execute
two system calls within a microsecond, but that horse has now left the
barn. You will need to request a getnanotimeofday() be created if you
want to allow two consecutive calls to always return different values
(modulo SMP systems and ~13 more years of Moore's Law)
--
Douglas Siebert
douglas-siebert@uiowa.edu
A computer without Microsoft software is like chocolate cake without ketchup.
next reply other threads:[~2001-03-03 4:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-03 4:22 Doug Siebert [this message]
2001-03-03 13:18 ` strange nonmonotonic behavior of gettimeoftheday -- seen similar problem on PPC Alan Cox
-- strict thread matches above, loose matches on Subject: below --
2001-03-02 5:30 strange nonmonotonic behavior of gettimeoftheday John Being
2001-03-02 15:08 ` strange nonmonotonic behavior of gettimeoftheday -- seen similar problem on PPC Christopher Friesen
2001-03-02 15:40 ` Richard B. Johnson
2001-03-02 18:25 ` george anzinger
2001-03-02 19:14 ` Richard B. Johnson
2001-03-02 20:09 ` george anzinger
2001-03-03 7:42 ` Mike Galbraith
2001-03-03 22:40 ` dean gaudet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200103030422.WAA27608@server.divms.uiowa.edu \
--to=dsiebert@divms.uiowa.edu \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox