Conteo Concurrente de Referencias y Gestión de Recursos en Tiempo Constante Sin Espera
Concurrent Reference Counting and Resource Management in Wait-free Constant Time
Concurrent Reference Counting and Resource Management in Wait-free Constant Time
@misc{blelloch2020concurrent,
title = {Concurrent Reference Counting and Resource Management in Wait-free Constant Time},
author = {Guy E. Blelloch and Yuanhao Wei},
year = {2020},
eprint = {2002.07053},
archivePrefix = {arXiv},
primaryClass = {cs.DC},
url = {https://arxiv.org/abs/2002.07053}
}
Blelloch, G. E., & Wei, Y. (2020). Concurrent Reference Counting and Resource Management in Wait-free Constant Time [Preprint]. arXiv. https://doi.org/10.48550/arXiv.2002.07053
BLELLOCH GE, WEI Y. Concurrent Reference Counting and Resource Management in Wait-free Constant Time[EB/OL]. (2020-02-17)[2026-11-29]. https://arxiv.org/abs/2002.07053.
Resumen
Un problema común al implementar programas concurrentes es proteger de manera eficiente contra carreras inseguras entre procesos que leen y luego utilizan un recurso (por ejemplo, bloques de memoria, descriptores de archivo o conexiones de red) y otros procesos que sobrescriben y luego destruyen el mismo recurso simultáneamente. Estas carreras de lectura-destrucción pueden protegerse con bloqueos o con soluciones libres de bloqueos, como punteros de peligro o lectura-copia-actualización (RCU). En este documento describimos un método para proteger carreras de lectura-destrucción con sobrecarga de tiempo esperado constante, O(P^2) espacio y O(P^2) destrucciones diferidas, utilizando únicamente operaciones atómicas de memoria de una sola palabra (lecturas, escrituras y CAS). Se basa en una interfaz con cuatro primitivas: un par acquire-release para proteger accesos y un par retire-eject para diferir la destrucción hasta que sea seguro. Nos referimos a esto como la interfaz acquire-retire. Utilizando la interfaz acquire-retire, desarrollamos implementaciones simples para tres casos de uso comunes: (1) reclamation de memoria con aplicaciones a pilas y colas, (2) objetos con conteo de referencias, y (3) objetos gestionados por propiedad con movimientos, copias y destrucciones. Los dos primeros resultados mejoran significativamente los resultados anteriores, y la tercera aplicación es original. Importante, todas las operaciones tienen una sobrecarga de tiempo esperado constante.
A common problem when implementing concurrent programs is efficiently protecting against unsafe races between processes reading and then using a resource (e.g., memory blocks, file descriptors, or network connections) and other processes that are concurrently overwriting and then destructing the same resource. Such read-destruct races can be protected with locks, or with lock-free solutions such as hazard-pointers or read-copy-update (RCU). In this paper we describe a method for protecting read-destruct races with expected constant time overhead, O(P^2) space and O(P^2) delayed destructs, and with just single word atomic memory operations (reads, writes, and CAS). It is based on an interface with four primitives, an acquire-release pair to protect accesses, and a retire-eject pair to delay the destruct until it is safe. We refer to this as the acquire-retire interface. Using the acquire-retire interface, we develop simple implementations for three common use cases: (1) memory reclamation with applications to stacks and queues, (2) reference counted objects, and (3) objects manage by ownership with moves, copies, and destructs. The first two results significantly improve on previous results, and the third application is original. Importantly, all operations have expected constant time overhead.