tag:blogger.com,1999:blog-8231772264325864647.post4466936497975540608..comments2024-03-22T19:05:00.088+01:00Comments on Concurrency Freaks: Log2ArrayQueue - MPMC lock-free queue (part 2 of 4)Pedro Ramalhetehttp://www.blogger.com/profile/01340437958052998917noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8231772264325864647.post-29999655024579633422016-11-19T20:48:21.724+01:002016-11-19T20:48:21.724+01:00Yes the GC will have to do more work to cleanup th...Yes the GC will have to do more work to cleanup the unused node. One alternative is to insert it one the next node, of if that fails, on the next-to-next node, and so on. I'll have to try that as well to see if it makes a difference in the benchmarks.<br />Thanks for pointing it out!<br /><br />I would assume that if the code is "spinning" on a marker, then it means it's blocking, not lock-free, and we're only interested in lock-free or wait-free queues. Pedro Ramalhetehttps://www.blogger.com/profile/01340437958052998917noreply@blogger.comtag:blogger.com,1999:blog-8231772264325864647.post-49770284617210307902016-11-19T13:26:29.592+01:002016-11-19T13:26:29.592+01:00In enqueue(), it is possible that more than one th...In enqueue(), it is possible that more than one thread that detects a full node will new up a new Node but only one of them wins, therefore the others are wasted (more GC?). I've been experimenting with MPSC Linked-Array Queue myself (https://gist.github.com/akarnokd/0699387c4ed43f5d4386) some time ago and I received suggestions from Nitsan Wakart (JCTools) that the code could spin on a special "allocating" marker in "next". (In fact, the idea of linked "islands" in an SPSC queue came from Nitsan and I tried expanding that into MPSC with unsatisfactory results.)David Karnokhttps://www.blogger.com/profile/07920580392321059533noreply@blogger.com