Subj : Re: Lock Free -- where to start To : comp.programming.threads From : David Butenhof Date : Wed Sep 28 2005 06:21 pm Joe Seigh wrote: > David Schwartz wrote: >> Let me just give you my general caveat about lock free code. >> First, lock free code is generally non-portable and extremely complex. >> Such code can easily contain bugs that are extremely difficult even >> for experts to spot. The complexity is almost always unnecessary. >> > [...] >> >> Lock free algorithms work great in kernels and low level threading >> libraries for a variety of reasons. Portability is not that important. >> The probability that there are other things to do is lower in core >> code (because everything passes through it). But for application code, >> or even most libraries on top of threading libraries, it's a pure loss. >> > > So Java isn't portable or they shouldn't have put support for lock-free in > Java or what? Java isn't just a language, or a compiler, or a runtime library. It's also the MACHINE -- or at least the portable definition of a Virtual Machine. It can specify its own rules, and the engineers who PORT the Java VM have to do whatever is necessary (easy, hard, fast, slow, whatever) to follow those rules for the target machine. POSIX, on the other hand, can specify only "tweaks" on the language, place loose requirements on the compiler, and provide a specification for part of a runtime library... and can't say anything at all about the machine. The two cases are exactly the same except that everything is different. -- Dave Butenhof, David.Butenhof@hp.com HP Utility Pricing software, POSIX thread consultant Manageability Solutions Lab (MSL), Hewlett-Packard Company 110 Spit Brook Road, ZK2/3-Q18, Nashua, NH 03062 .