本文介绍了无锁和无锁有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一些有关算法的文章中,一些使用词lockfree,另一些使用lockless. locklesslockfree有什么区别?谢谢!

In some articles about algorithm, some use the word lockfree, and some use lockless. What's the difference between lockless and lockfree? Thanks!

更新

http://www.intel.com/content/dam/www/public/us/en/documents/guides/intel-dpdk-programmers-guide.pdf

第5.2节-"Linux *中的无锁环形缓冲区",这是一个用词无锁"的示例

section 5.2 --"Lockless Ring Buffer in Linux*", it's a example of use word "lockless"

推荐答案

如果算法满足以下要求,则该算法是无锁的:程序线程运行足够长的时间时,至少有一个线程取得了进展(对于某些合理的进展定义, ).所有的免等待算法都是无锁的.

An algorithm is lock-free if it satisfies that when the program threads are run sufficiently long at least one of the threads makes progress (for some sensible definition of progress). All wait-free algorithms are lock-free.

通常,无锁算法可以分四个阶段运行:完成自己的操作,协助进行阻塞操作,中止阻塞操作以及等待.可能同时发生的协助和堕胎使完成自己的手术变得复杂,但始终都是完成任务的最快途径.例如非阻塞算法

In general, a lock-free algorithm can run in four phases: completing one's own operation, assisting an obstructing operation, aborting an obstructing operation, and waiting. Completing one's own operation is complicated by the possibility of concurrent assistance and abortion, but is invariably the fastest path to completion. e.g. Non blocking algorithms

无锁编程是用于在不使用锁的情况下安全地操作共享数据的一组技术.有无锁算法可用于传递消息,共享列表和数据队列以及其他任务.无锁编程非常复杂.例如所有纯功能数据结构本质上都是无锁的,因为它们是不可变的

Lockless programming, is a set of techniques for safely manipulating shared data without using locks. There are lockless algorithms available for passing messages, sharing lists and queues of data, and other tasks. Lockless programming is pretty complicated. e.g. All purely functional data structures are inherently lock-free, since they are immutable

这篇关于无锁和无锁有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 06:13