No.
> Wouldn't one expect the dual CPU to run twice as fast instead of
> ten times slower?
Not necessarily. The code doesn't do much other than modified shared data
without a lock. Not only does this invoke undefined behavior, but it
penalizes SMP machines because only they are subject to cache ping-ponging.
> As you can see from the timing user time increases by a factor of
> 4 and system time by a factor of 10.
> I seem to remember something about gettimeofday() possibly being
> a problem but couldn't find a reference to it.
> Anybody have an explanation/fix for this?
The program doesn't seem to measure anything useful and invokes undefined
behavior.
If you would like a fix, try this:
#define sched_yield() while(false)
DS
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/