Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The first two questions I want to know when I see a lock-free library:

    - how does it handle the ABA problem?
    - how does it handle the safe memory reclamation problem?
The answers to these questions were not easy to find for this library.

It appears that it solves the ABA problem by requiring DCAS (double-compare-and-swap). This rules out some platforms:

"Note that the Alpha, IA64, MIPS, PowerPC and SPARC architectures do not provide contigious double-word compare-and-swap and as such, liblfds cannot be ported to those architectures." --http://liblfds.org/documentation/mediawiki/index.php?title=r...

An earlier release had a note that the library could theoretically be ported to an architecture supporting LL/SC instead (load-linked/store-conditional), but this note seems to have been removed in later versions:

"Currently, liblfds has been ported only to platforms which provide a contigious double-word compare-and-swap (x86, x64 and ARM). It is entirely possible to port to a platform which instead provides load-link/conditional-store where non-load-linked loads can be performed inside the LL/SC pair (this is how ABA is solved using single word LL/SC) but this has not yet been done and it is not reasonable to ask a third party to undertake such a port until I've done it and documented it." --http://liblfds.org/documentation/mediawiki/index.php?title=r...

I could not readily find an answer to the question of how safe memory reclamation is handled. When elements are removed they are placed on a freelist, but there's no indication that the freelist is protected from prematurely deleting things at all. Perhaps the library is using DCAS somehow to ensure that deleted nodes are never dereferenced.



While reading the rather hilarious blog of his, I stumbled upon this possible explanation why that sentence is gone:

I'm going to ditch LL/SC implementations, in part because they're just too unreliable and in part because they prevent the library from being able to simply offer the caller a choice - "garbage collection or not?" which in turn removes a TON of stuff which otherwise has to be explained to the end user.

http://www.liblfds.org/blog/index.php?entry=Quick-update


> "Note that the Alpha, IA64, MIPS, PowerPC and SPARC architectures do not provide contigious double-word compare-and-swap and as such, liblfds cannot be ported to those architectures."

Yet the front page claims that MIPS, PowerPC and SPARC are supported since version 7.0.0. How does that add up?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: