Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #7446

Re: most portable way to compare file times

From Bernd Paysan <bernd.paysan@gmx.de>
Newsgroups comp.lang.forth
Subject Re: most portable way to compare file times
Date 2011-11-24 15:48 +0100
Organization 1&1 Internet AG
Message-ID <jallg5$joe$1@online.de> (permalink)
References (8 earlier) <1107cc00-d6f2-499e-82cb-ce06e7008dcf@14g2000yqo.googlegroups.com> <pxlj12jnax7e$.jmq5y68zggcc.dlg@40tude.net> <b4a48e74-a668-4aa6-9568-3a9d5eaab0c1@f29g2000yqa.googlegroups.com> <jaeaqv$v4p$1@online.de> <f23a7f40-ca69-4a72-9193-39fdf53b4b60@d17g2000yql.googlegroups.com>

Show all headers | View raw


Krishna Myneni wrote:
> Oh yes, if you include the possibility of a GPS receiver providing a 1
> pulse per second directly input to the computer, or other stratum 1
> source, the long term time accuracy can probably achieve somewhere in
> the tens of ns. The OS will have to support nanosecond timer
> resolution, i.e. have a nanokernel. The short term accuracy will be
> defined by the accuracy and stability of the local oscillator
> (computer clock), Most computer clocks don't have very high
> performance.

Long term accuracy is not really important.  It's a nanosecond 
resolution clock, not a nanosecond accuracy clock.  It's easy to have a 
millisecond latency within two computers in one LAN.  You don't need a 
clock more accurate than the latency, for having truely ordered time 
stamps on your network - what's in the space-like part of the space-time 
diagram doesn't matter.  The resolution is important to order time 
stamps within one computer, time stamps that can be very close together.

The way Linux does clock_gettime is not really useful.  It's a kernel 
call, it's expensive.  It should use rdtsc, and a memory mapped per-core 
clock resolution and offset variable, and not do any expensive context 
switching.  The time between two consecutive clock_gettime() on my 
computer is half a microsecond, two consecutive rdtsc take 90 clock 
cycles.  The effort to get nanoseconds since the epoch is one 
multiplication and one add - at least on any machine with a clock faster 
than 1GHz.  That's a few cycles.  And if rdtsc would be more relaxed, it 
would not serialize the CPU completely - all you need is a source-
source-dependency (i.e. each rdtsc needs to wait for all previously 
scheduled rdtsc, but no more than that, and then would be a single cycle 
operation).

> I'm all for it. Eventually, chip scale sources with both high
> precision and high accuracy will be available. But I think your
> estimate of 20 years for obsolescence of nanosecond timing in ordinary
> computers is a bit optimistic.

In the 20 years between the 68000 and the Pentium 4, there were three 
orders of magnitude between the clock cycles of those two - the 68k had 
a two-cycle ALU at 8 MHz, the Pentium 4 a double-pumped ALU at 4 GHz 
(which means effectively 4 MHz vs. 8 GHz ALU speed).  The Pentium 4 was 
a design mistake, they backed off.  And since then, clock speed 
improvement essentially stopped.  So a nanosecond resolution for 
internal stuff is good enough for the next 20 years, even when we by 
then have some 10 cylces instead a few cycles.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-18 00:43 -0800
  Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-18 02:33 -0800
    Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-18 05:26 -0800
      Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-18 09:14 -0800
        Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-18 20:10 +0100
          Re: most portable way to compare file times Andrew Haley <andrew29@littlepinkcloud.invalid> - 2011-11-18 15:10 -0600
            Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-18 13:32 -0800
              Re: most portable way to compare file times anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-21 10:22 +0000
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-21 08:51 -0800
            Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-19 00:57 +0100
        Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-18 14:45 -0800
  Re: most portable way to compare file times "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2011-11-18 05:44 -0500
    Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-18 05:31 -0800
      Re: most portable way to compare file times anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-18 16:22 +0000
        Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-19 13:59 -0800
          Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-20 02:06 -0800
            Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-20 02:44 -0800
              Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-20 14:58 +0100
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-20 06:48 -0800
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-20 08:05 -0800
                Re: most portable way to compare file times Coos Haak <chforth@hccnet.nl> - 2011-11-20 20:53 +0100
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-20 12:21 -0800
                Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-21 21:03 +0100
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-21 17:32 -0800
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-21 17:45 -0800
                Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-24 15:48 +0100
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-24 09:34 -0800
                Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-24 11:58 -0800
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-24 17:25 -0800
                Re: most portable way to compare file times "Elizabeth D. Rather" <erather@forth.com> - 2011-11-24 20:56 -1000
                Re: most portable way to compare file times Andrew Haley <andrew29@littlepinkcloud.invalid> - 2011-11-25 04:15 -0600
                Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-25 04:17 -0800
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-25 05:47 -0800
                Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-25 08:58 -0800
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-25 11:43 -0800
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-25 11:12 -0800
                Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-25 05:39 -0800
                Re: most portable way to compare file times anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-27 14:34 +0000
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-27 08:46 -0800
                Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-25 04:32 -0800
                Re: most portable way to compare file times Alex McDonald <blog@rivadpm.com> - 2011-11-25 04:51 -0800
                Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-25 16:46 +0100
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-25 08:33 -0800
                Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-26 01:11 +0100
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-26 12:18 -0800
                Re: most portable way to compare file times Bernd Paysan <bernd.paysan@gmx.de> - 2011-11-26 21:44 +0100
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-26 13:18 -0800
                Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-20 12:45 -0800
            Re: most portable way to compare file times Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-11-20 07:49 -0800
        Re: most portable way to compare file times mhx@iae.nl (Marcel Hendrix) - 2011-11-20 09:45 +0200
      Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-18 10:42 -0800
  Re: most portable way to compare file times BruceMcF <agila61@netscape.net> - 2011-11-20 13:05 -0800

csiph-web