Lock-free data structures are an important tool for the development of concurrent programs as they provide scalability, low latency and avoid deadlocks, livelocks and priority inversion. However, they require some sort of additional support to guarantee memory reclamation. The Optimistic Access (OA) method has most of the desired properties for memory reclamation, but since it allows memory to be accessed after being reclaimed, it is incompatible with the traditional memory management model. This renders it unable to release memory to the memory allocator/operating system, and, as such, it requires a complex memory recycling mechanism. In this paper, we extend the lock-free general purpose memory allocator LRMalloc to support the OA method. By doing so, we are able to simplify the memory reclamation method implementation and also allow memory to be reused by other parts of the same process. We further exploit the virtual memory system provided by the operating system and hardware in order to make it possible to release reclaimed memory to the operating system.
翻译:无锁数据结构是并发程序开发中的重要工具,因其具有可扩展性、低延迟性,并能避免死锁、活锁和优先级反转。然而,它们需要某种额外的支持来保证内存回收。乐观访问(Optimistic Access, OA)方法具备内存回收所需的大部分理想属性,但由于它允许内存被回收后仍可访问,因此与传统的内存管理模型不兼容。这使得它无法将内存释放给内存分配器/操作系统,从而需要复杂的内存回收机制。本文扩展了无锁通用内存分配器LRMalloc,以支持OA方法。通过此举,我们能够简化内存回收方法的实现,并允许同一进程的其他部分重用内存。此外,我们进一步利用操作系统和硬件提供的虚拟内存系统,使得将回收的内存释放给操作系统成为可能。