ITeye博客

Lock Free Queue Implementation

standalone · 2012-09-05 16:29 · algorithm · 编程语言 · Markdown

One consumer, one producer problem:

Lock Free Queue

Basically add one a separator in a list then nodes between separator and last is owned by consumer, the node between first and separator should be collected by producer and producer only append new nodes to the last.

This problem is also described in the book Java Concurrency in Practice.

见上图,producer从last处插入结点,consumer从divider处开始消耗结点。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。