By: Linus Torvalds (torvalds.delete@this.osdl.org), October 28, 2006 8:02 pm
Room: Moderated Discussions
Ray (a@b.c) on 10/28/06 wrote:
>
>The nifty thing about some lock-free abstractions
>is that they make it impossible to deadlock.
I agree. I also very much agree with your second point:
if the locking (or rather, absense there-of) is done by
the compiler or JIT environment, the fact that most
programmers don't necessarily understand all the subtleties
and that getting it wrong is a pain to debug is much
less of an issue.
Lock-free algorithms also tend to work much better if
the memory management is hidden from the programmer, because
a lot of them depend on things like "free()" freeing the
data structures only after all threads have gone through
a sequence point (eg RCU).
That memory mnagement is something that tends to be handled
anyway in many languages and fits with the whole garbage
collection model, so if the language writer (that also
controls said garbage collector) does all the lock-free
algorithms, the two may work very well together.
So yes, the fact that I tend to be nervous about lock-
free algorithms is probably a result of working in an
area where having somebody else do it for you isn't
an option ;)
Linus
>
>The nifty thing about some lock-free abstractions
>is that they make it impossible to deadlock.
I agree. I also very much agree with your second point:
if the locking (or rather, absense there-of) is done by
the compiler or JIT environment, the fact that most
programmers don't necessarily understand all the subtleties
and that getting it wrong is a pain to debug is much
less of an issue.
Lock-free algorithms also tend to work much better if
the memory management is hidden from the programmer, because
a lot of them depend on things like "free()" freeing the
data structures only after all threads have gone through
a sequence point (eg RCU).
That memory mnagement is something that tends to be handled
anyway in many languages and fits with the whole garbage
collection model, so if the language writer (that also
controls said garbage collector) does all the lock-free
algorithms, the two may work very well together.
So yes, the fact that I tend to be nervous about lock-
free algorithms is probably a result of working in an
area where having somebody else do it for you isn't
an option ;)
Linus