On Fri, 8 Mar 2002, george anzinger wrote:
>
> Uh, just the pid would do. Maybe reserve a bit to indicate
> contention, but surly one word would be enough.
Not really.
The pid would mean that anybody who gets a lock would have to have its pid
available (remember the fast-path is what we really care about), but
there's also a fundamental race between getting the lock and writing the
pid to the second word of the lock that you just won't avoid.
And that's assuming you only use the semaphores for pure mutual exclusion.
That is the normal behaviour, but some people use semaphores for other
things (ie "N people can be active inside this region" where N != 1).
And then you have to realize that doing the same for readers in a rwlock
is even worse.
In short, it just cannot be done quickly and simply, and for many cases it
cannot be done at all.
Linus
-
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/
This archive was generated by hypermail 2b29 : Fri Mar 15 2002 - 22:00:11 EST