Inconsistent timing results of multithreaded program on an SMP machine.

From: Marcel Zalmanovici
Date: Sun Nov 20 2005 - 04:26:15 EST






Hi,

I am trying, as part of my thesis, to make some improvement to the linux
scheduler.
Therefore I've written a small multithreaded application and tested how
long on average it takes for it to complete.

The results were very surprising. I expected to see the completion time
vary 1 to 2 seconds at most.
Instead what I've got was an oscillation where the maximum time was twice
and more than the minimum!! For a short test results ranged ~7sec to ~16
sec, and the same happened to longer tests where the min was ~1min and the
max ~2:30min.

Does anyone have any clue as to what might happen ?
Is there anything I can do to get stable results ?

Here is a small test case program:

(See attached file: sched_test.c)

The test was always done on a pretty much empty machine. I've tried both
kernel 2.6.4-52 and 2.6.13.4 but the results were the same.

I'm working on a Xeon Intel machine, dual processor, hyperthreaded.
Below is the info from /proc/cpuinfo

(See attached file: cpuinfo.log)

The machine's configuration is as follows: (filtered with grep "=[y|m]" )

(See attached file: conf_filtered)

Please respond to either:
marcel@xxxxxxxxxx
or
marcel.mz@xxxxxxxxx
as I am not subscribed to the mailing list.

Thank you for your help,
Marcel

Attachment: sched_test.c
Description: Binary data

Attachment: cpuinfo.log
Description: Binary data

Attachment: conf_filtered
Description: Binary data