Safe memory reclamation (SMR) algorithms are crucial for preventing use-after-free errors in optimistic data structures. SMR algorithms typically delay reclamation for safety and reclaim objects in batches for efficiency. It is difficult to strike a balance between performance and space efficiency. Small batch sizes and frequent reclamation attempts lead to high overhead, while freeing large batches can lead to long program interruptions and high memory footprints. An ideal SMR algorithm would forgo batching, and reclaim memory immediately, without suffering high reclamation overheads. To this end, we propose Conditional Access: a set of hardware instructions that offer immediate reclamation and low overhead in optimistic data structures. Conditional Access harnesses cache coherence to enable threads to efficiently detect potential use-after-free errors without explicit shared memory communication, and without introducing additional coherence traffic. We implement and evaluate Conditional Access in Graphite, a multicore simulator. Our experiments show that Conditional Access can rival the performance of highly optimized and carefully tuned SMR algorithms while simultaneously allowing immediate reclamation. This results in concurrent data structures with similar memory footprints to their sequential counterparts.
翻译:安全内存回收(SMR)算法对于防止乐观数据结构中的释放后使用错误至关重要。SMR算法通常为了安全性而延迟回收,并为了效率而批量回收对象。在性能和空间效率之间取得平衡是困难的。小批量大小和频繁回收尝试会导致高开销,而释放大批量则可能导致长时间的程序中断和高内存占用。理想的SMR算法应放弃批处理,立即回收内存,而不会遭受高回收开销。为此,我们提出条件访问(Conditional Access):一组硬件指令,可在乐观数据结构中实现即时回收和低开销。条件访问利用缓存一致性,使线程能够有效检测潜在的释放后使用错误,而无需显式的共享内存通信,也不会引入额外的缓存一致性流量。我们在多核模拟器Graphite上实现并评估了条件访问。实验表明,条件访问能够在允许即时回收的同时,与高度优化和精心调优的SMR算法性能相媲美。这使得并发数据结构的内存占用与其顺序版本相当。