TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Lock-Free Data Structures. The Evolution of a Stack

38 pointsby skazka16about 10 years ago

2 comments

NovaXabout 10 years ago
Elimination can be enhanced by using a combination strategy, such as DECS [1]. Using a combiner approach should also work on a queue structure, though interestingly enough there is a paper on elimination-based fifo queues. I wrote an elimination stack in Java [2], but I haven&#x27;t gotten around to adding combining to the arena yet. The performance is pretty good compared to other shared concurrent structures.<p>[1] <a href="http://www.cs.bgu.ac.il/~hendlerd/papers/DECS.pdf" rel="nofollow">http:&#x2F;&#x2F;www.cs.bgu.ac.il&#x2F;~hendlerd&#x2F;papers&#x2F;DECS.pdf</a> [2] <a href="https://github.com/ben-manes/caffeine" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ben-manes&#x2F;caffeine</a>
zamalekabout 10 years ago
&gt; back-off<p>Another solution is to simply return false and leave the decision of what to do, to the caller. Effectively:<p><pre><code> bool try_push(value_type&amp; value); bool try_pop(value_type* result); </code></pre> Most callers will simply:<p><pre><code> while(!try_push(&amp;val)) bkoff(); </code></pre> However, in my specific case I was writing a toy thread pool. This meant that a failed pend could just result in an attempt to pend it to a different worker thread, instead of trying the same stack over again.