Java中的无锁并发链表 [英] Lock-Free Concurrent Linked List in Java

查看:834
本文介绍了Java中的无锁并发链表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用文件中所述的链接列表。
然而,我没有在网络中找到任何Java实现。

I would like to use a Linked List like the one described in this paper. However, I didn't find any Java implementation in the web.

如果没有上述链表的Java实现存在,我想,请使用 java.util.concurrent.ConcurrentLinkedQueue< E> 。这是一个好的选择(它不是一个真正的链表)?

If no java implementation of the above mentioned Linked List exists, I think, I would use the java.util.concurrent.ConcurrentLinkedQueue<E>. Is this a good choice (it is not really a linked list)?

如果这不是一个好的选择,任何人都知道可靠的并发(线程安全)等待-free(无锁)Java中的链接表实现?

If it's not a good choice, does anyone know of a reliable concurrent (thread-safe) wait-free(lock-free) Linked List implementation in Java?

推荐答案

ConcurrentLinkedQueue 是一个队列,并做什么一个并发单链表可以做。
一个小警告:如果你不使用轮询或窥视和只有iterator()(+ .remove())它会泄漏内存。

ConcurrentLinkedQueue is a superb lock free queue and does what a concurrent single linked list can do. A small warning: if you dont use poll or peek and only iterator() (+.remove()) it will leak memory.

队列

这篇关于Java中的无锁并发链表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆