java无锁并发,Java中的无锁并发链表

博主探讨了在没有找到特定LinkedList Java实现的情况下,考虑使用ConcurrentLinkedQueue作为替代。指出ConcurrentLinkedQueue是一个高性能的并发队列,能完成单链表的功能,但不完全符合链表特性。同时警告如果只使用iterator().remove()可能会导致内存泄漏。文章寻求一个可靠的并发、线程安全且无锁的Java LinkedList实现。
摘要由CSDN通过智能技术生成

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.

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

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 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.

It's an outstanding Queue.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值