People have for so long tried to solve the memory deallocation problem with lock-free algorithms, at a point when it looked like there is no satisfactory solution. However, with minimum scaffolding and by maneuvering carefully between thread-private and thread-shared data, it is possible to devise an algorithm that gives strong and satisfactory speed and memory consumption guarantees. Besides, although we used WRRMMap as an example throughout, the hazard pointers technique is, of course, applicable to much more complex data structures. The memory reclamation problem is more important in dynamic structures that can grow and shrink arbitrarily; for example, a program that has thousands of linked lists that may grow to have millions of dynamic nodes and then shrink. That would be where hazard pointers would show their full power. The worst that a reader thread could ever do is die and leave all of its hazard pointers set, thus forever keeping allocated at mos one node for each of its hazard pointers.
展开▼