lkml.org 
[lkml]   [2010]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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


\
 
 \ /
  Last update: 2010-04-09 15:35    [W:0.031 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site