如何在 C 中编写线程安全、高效、无锁的内存分配器?高效我的意思是:
快速分配和释放
优化内存使用(最小浪费且无外部碎片)
最小的元数据开销
最佳答案
http://www.research.ibm.com/people/m/michael/pldi-2004.pdf
This paper presents a completely lock-free memory allocator. It uses only widely-available operating system support and hardware atomic instructions. It offers guaranteed availability even under arbitrary thread termination and crash-failure, and it is immune to dead-lock regardless of scheduling policies, and hence it can be used even in interrupt handlers and real-time applications without requiring special scheduler support. Also, by leveraging some high-level structures from Hoard, our allocator is highly scalable, limits space blowup to a constant factor, and is capable of avoiding false sharing...
关于c - 如何在 C 中编写线程安全、高效、无锁的内存分配器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1995871/