[ntp:hackers] [Gpsd-dev] Single-writer/many-reader consistency: Test program written & verified

Dave Hart davehart_gmail_exchange_tee at davehart.net
Mon Mar 28 19:56:08 UTC 2011


On Mon, Mar 28, 2011 at 19:21 UTC, Gary E. Miller <gem at rellim.com> wrote:
> On Mon, 28 Mar 2011, Terje Mathisen wrote:
>
>> Dave Hart & I have banged quite a bit against the (fixed) version of the test
>> program, and the conclusion is quite nice:
>
> Good result, but missing the most crucial detail on the tests: what CPU
> architecture?
>
> As we have seen x86 has the strongest rules on reordering.  What about on
> another CPU, like ARM with weaker rules?

There's some porting work to be done.  So far just x86 using threads
on Windows.  Still, I did include a dual-proc Pentium II 400MHz, which
predates Intel's strictest guarantees.  Below are the hour-long runs I
did.  Note the output is misleading, it still says 10 seconds when it
was in fact 3600.  Also despite the mention of debug\test_shm the
binary was fully optimized, including link-time code generation and
non-debug C runtime.  The source file is test-shm.c, the test_shm.exe
name is a result of quirk in how I set up the build here.

Dual Pentium II 400 MHz (dell poweredge 2300) two sockets:

counts[] = {1013285801,23545049282,53651425935,23533216365}

All threads done!
Thread 0 did 1013285801 iterations
Thread 1 did 23545049282 iterations
Thread 2 did 53651425935 iterations
Thread 3 did 23533216365 iterations
counter_update = 524233674, counter_retry = 150581, timestamps_inconsistent = 0

I figured that was an interesting machine because Intel made certain
claims about the arch of Pentium III and later.

Dell Inspiron 9400 with Core2 T7200 2.0 GHz 1 socket:

C:\ntp\ntp-dev-shm-ringtest\ports\winnt\vs2008>debug\shm_test
counts[] = {0,1,2,3}
Writer affinity = 1, old = 3
Reader 1 affinity = fffffffe, old = 3
Reader 2 affinity = fffffffe, old = 3
Reader 3 affinity = fffffffe, old = 3
Done waiting 10 seconds
counts[] = {1252798093,27888462205,27886570150,27668895725}

All threads done!
Thread 0 did 1252798093 iterations
Thread 1 did 27888462205 iterations
Thread 2 did 27886570150 iterations
Thread 3 did 27668895725 iterations
counter_update = 433190983, counter_retry = 807480, timestamps_inconsistent = 0

P4 2.8 GHz Stepping 1 (hyperthreaded to 2 "cpus", 1 socket).  Dell
Poweredge 830:

C:\bin>shm_test
counts[] = {0,1,2,3}
Writer affinity = 1, old = 3
Reader 1 affinity = fffffffe, old = 0
Reader 2 affinity = fffffffe, old = 0
Reader 3 affinity = fffffffe, old = 0
Done waiting 10 seconds
counts[] = {2573620693,80836862874,214678563292,81073590367}

All threads done!
Thread 0 did 2573620693 iterations
Thread 1 did 80836862874 iterations
Thread 2 did 214678563292 iterations
Thread 3 did 81073590367 iterations
counter_update = 1362112910, counter_retry = 129953, timestamps_inconsistent = 0


Nowhere near as interesting as Alpha or ARM, granted, and hard to
interpret without the source, which will have to wait for Terje.

Cheers,
Dave Hart


More information about the hackers mailing list