xenium
List of all members
xenium::reclamation::hp_allocation::dynamic_strategy< K, A, B > Struct Template Reference

Hazard pointer allocation strategy for a dynamic number of hazard pointers per thread. More...

#include <hazard_pointer.hpp>

Inherits xenium::reclamation::detail::generic_hp_allocation_strategy< K_, A, B, ThreadControlBlock >.

Detailed Description

template<size_t K = 2, size_t A = 2, size_t B = 100>
struct xenium::reclamation::hp_allocation::dynamic_strategy< K, A, B >

Hazard pointer allocation strategy for a dynamic number of hazard pointers per thread.

This strategy uses a linked list of segments for the hazard pointers. The first segment can hold K hazard pointers; subsequently allocated segments can hold 1.5x the number of hazard pointers as the sum of all previous segments.

The threshold for the number of retired nodes is calculated as A * available_hps + B, where available_hps is the max. number of hazard pointers that could be allocated by all threads at that time, without growing the number of segments. E.g., if K = 2 and we have two threads each with a single segment, then available_hps = 4; if one thread later allocates additional hps and increases the number of segments such that they can hold up to 10 hazard pointers, then available_hps = 10+2 = 12.

K, A and B can be configured via template parameter.

Template Parameters
KThe initial number of hazard pointers (i.e., the number of hps that can be allocated without the need to grow).
A
B