本篇文章主要介绍了"Some notes on lock-free and wait-free algorithms",主要涉及到algorithm,notes方面的内容,对于企业开发感兴趣的同学可以参考一下:
原文:http://www.rossbencina.com/code/lockfreeOver the past two decades the researc...
原文:http://www.rossbencina.com/code/lockfree
Over the past two decades the research community has developed a body of knowledge concerning “Lock-Free” and “Wait-Free” algorithms and data structures. These techniques allow concurrent update of shared data structures without resorting to critical sections protected by operating system managed locks. A number of wait-free and lock free algorithms for simple data structures such as LIFO stacks and FIFO queues have been published. Lock-free algorithms for more complex data structures such as priority queues, hash tables, sets, and red-black trees are also known.
Some of the most commonly stated benefits of lock-free synchronisation are:
- Efficiency benefits compared to lock-based algorithms for some workloads, including potential scalability benefits on multiprocessor machines.
- Support for concurrent update to shared data structures even when locks aren’t available (e.g. in interrupt handlers etc.)
- Avoidance of priority inversion in real-time systems.
A significant benefit of lock (or wait)-freedom for real-time systems is that by avoiding locks the potential for priority inversion is avoided. Solutions for avoiding priority inversion usually involve special real-time process schedulers. On platforms where a real-time scheduler is not present, lock-free data structures provide an opportunity to sidestep the hazards of interlocking with the scheduler.