Jim Donelson wrote:
> All that is really required is an atomic exchange.
> Suppose 1 means taken, 0 means free. I do an exchange with a 1. If I got
> back a zero, it's mine.

True with a Mutex, not true with a Futex. Here you need a second bit in
user-space that tells the releaser that it is to wake up a sleeping
waiter. Otherwise, any release would need a system call.

Seemingly the best instruction to handle these bits is "atomic compare
and exchange" (e.g. provided by the X86 CPU).

OTOH with a load-store-architecture CPU it's not that simple to add a
memory read-modify write instruction to the ISA, while it's no big
problem to have such an instruction do with the data whatever is
appropriate.

-Michael
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to