However, the lock instruction can take forever to execute (the actual delay depends on the system architecture)
So it's not really simply one more instruction.
/ Per Hedbor ()
Previous text:
2004-02-03 11:42: Subject: Re: Default backend and thread backends?
On Tue, Feb 03, 2004 at 11:25:03AM +0100, Niels Möller (vässar rödpennan) @ Pike (-) developers forum wrote:
Really, mutex op is quite fast (I guess max 3 instructions on most CPUs), so - is it really _so_ bad?
Is that true for multi-cpu machines also?
At least on Intel platform - yes, just adds one more instruction (lock).
I guess on every platform where SMP is supported it should be fast enough, otherwise it would make SMP pretty useless.
A pthreads mutex operation does not only affect the mutex structure itself, but also issue any needed instruction to get the caches of the
This is left to the CPU. At least looking into the code doesn't reveal anything but two-three instructions (including similar ops in kernel code).
Regards, /Al
/ Brevbäraren