in reply to OT How fast a cpu to overwhelm Time::HiRes
With some changes to your code I got the difference down to two microseconds:
#!/usr/bin/perl use Time::HiRes qw(gettimeofday); my ($secs1,$sec2,$micro1,$micro2); #discard once gettimeofday(); ($secs1, $micro1) = gettimeofday(); ($secs2, $micro2) = gettimeofday(); print "$secs1$micro1\n"; print "$secs2$micro2\n"; __OUTPUT__ 1133355471176848 1133355471176850
This is on a dual-2.8GHz Xeon, so I suspect you'll have trouble getting it to display identical values on a "normal" current system.
As for whether it's theoretically possible, I am pretty sure it'd be possible on SMP machines.
Update: after thinking about this some more, I'm pretty sure this is also possible on uniprocessor machines if you're running an operating system with a preemptible kernel.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: OT How fast a cpu to overwhelm Time::HiRes
by Anonymous Monk on Nov 30, 2005 at 15:27 UTC | |
by snowhare (Friar) on Nov 30, 2005 at 16:18 UTC | |
by BrowserUk (Patriarch) on Nov 30, 2005 at 18:01 UTC | |
by snowhare (Friar) on Nov 30, 2005 at 22:35 UTC | |
by BrowserUk (Patriarch) on Dec 01, 2005 at 00:23 UTC | |
by tirwhan (Abbot) on Dec 01, 2005 at 00:54 UTC |