Messages in this thread | | | Date | Fri, 09 Apr 2010 15:32:14 +0200 | From | Michael Schnell <> | Subject | Re: atomic RAM ? |
| |
On 04/09/2010 03:15 PM, Alan Cox wrote: > Lamport's Bakery Hmm. The code implements the lock as a busy spinning wait. This of course is not possible in real world, as the thread that has the lock will not get any CPU time (e.g. in a non-SMP system).
I understand that the main purpose of the FUTEX Kernel call(s) is doing a not-busy wait and having the "unlock" code wake the (next) waiting thread.
I did implement something like this in my testing program: enhanced by a sleep to allow for the thread that has the lock to proceed it's work, but this of course is not fast at all, as a short sleep() produces too much CPU load and a long sleep produces too much latency.
So maybe this algorithm can be used instead of the hardware stuff I suggested but it would need a FUTEX-like Kernel part, too.
-Michael
| |