将手动并发内存回收转换为自动引用计数
Turning Manual Concurrent Memory Reclamation into Automatic Reference Counting
摘要:
安全内存回收(SMR)方案是无锁数据结构和并发编程的重要工具。然而,手动SMR方案是出了名的难以正确应用,而自动方案,如引用计数,十多年来一直被认为对于实际目的来说太慢。最近的一波工作已经推翻了这个长期持有的概念,并表明引用计数可以像危险指针一样可扩展,危险指针是最常见的手动技术之一。尽管有这些巨大的改进,但这些方案与更快的手动技术(如基于时期的回收(EBR))之间的性能差距仍高达2倍或更多。在这项工作中,我们首先提出这些想法,并表明在许多情况下,自动引用计数实际上可以像最快的手动SMR技术一样快。我们概括了我们以前的并发延迟引用计数(CDRC)算法,以获得一种方法,用于将任何标准的手动SMR技术转换为具有类似性能的自动引用计数技术。我们的第二个贡献是扩展了这个框架,以支持弱指针,这是引用计数指针,自动打破指针周期不贡献的引用计数,从而解决了一个常见的弱点,引用计数垃圾回收。我们的C++库实现的实验表明,我们的自动技术与他们的手动同行,我们的弱指针实现优于最知名的原子弱指针库的数量级高线程数。总之,我们表明,可以实现自动存储管理的易用性,而不显着的成本,实际性能或一般适用性。
英文摘要:
Safe memory reclamation (SMR) schemes are an essential tool for lock-free data structures and concurrent programming. However, manual SMR schemes are notoriously difficult to apply correctly, and automatic schemes, such as reference counting, have been argued for over a decade to be too slow for practical purposes. A recent wave of work has disproved this long-held notion and shown that reference counting can be as scalable as hazard pointers, one of the most common manual techniques. Despite these tremendous improvements, there remains a gap of up to 2x or more in performance between these schemes and faster manual techniques such as epoch-based reclamation (EBR). In this work, we first advance these ideas and show that in many cases, automatic reference counting can in fact be as fast as the fastest manual SMR techniques. We generalize our previous Concurrent Deferred Reference Counting (CDRC) algorithm to obtain a method for converting any standard manual SMR technique into an automatic reference counting technique with a similar performance profile. Our second contribution is extending this framework to support weak pointers, which are reference-counted pointers that automatically break pointer cycles by not contributing to the reference count, thus addressing a common weakness in reference-counted garbage collection. Our experiments with a C++-library implementation show that our automatic techniques perform in line with their manual counterparts, and that our weak pointer implementation outperforms the best known atomic weak pointer library by up to an order of magnitude on high thread counts. All together, we show that the ease of use of automatic memory management can be achieved without significant cost to practical performance or general applicability.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。