Re: Why Semaphore Hardware-Dependent?

Andi Kleen
2006-08-28T07:23:32Z

>
> I believe the reason for not doing something like this on x86 was the
> fact that we still support i386 processors, which don't have the
> cmpxchg instruction.

i386 emulates cmpxchg these days (other than that most likely 99.9+% of all
386s are already long beyond their MTBF, so they shouldn't be a major concern)

> That's fair enough, but I would be opposed to
> making semaphores bigger

If the code was out of lined bigger wouldn't make much difference
And if it worked for spinlocks I don't see why it shouldn't for semaphores.

> and slower on PowerPC because of that.

The question is if it really makes much difference. When semaphores
are congested in my experience the major overhead is in the scheduler
anyways.

That would leave the fast path, but does it help that much there
to have a more complicated implementation?
-Andi