Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
enhanced_steal_policy.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2024, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
12#pragma once
13
14#include <cstdint>
15
16namespace kcenon::thread
17{
18
37enum class enhanced_steal_policy : std::uint8_t
38{
39 random,
41 adaptive,
45};
46
52constexpr const char* to_string(enhanced_steal_policy policy)
53{
54 switch (policy)
55 {
57 return "random";
59 return "round_robin";
61 return "adaptive";
63 return "numa_aware";
65 return "locality_aware";
67 return "hierarchical";
68 default:
69 return "unknown";
70 }
71}
72
73} // namespace kcenon::thread
@ adaptive
Automatically adjust based on load conditions.
Core threading foundation of the thread system library.
Definition thread_impl.h:17
@ round_robin
Sequential victim selection (deterministic, fair)
@ random
Random victim selection (default, good load distribution)
constexpr std::string_view to_string(log_level_v2 level) noexcept
Convert log_level_v2 to string representation.
Definition log_level.h:40
enhanced_steal_policy
Enhanced policies for selecting work-stealing victims.
@ hierarchical
NUMA node first, then random within node (large NUMA systems)
@ round_robin
Sequential victim selection (deterministic, fair)
@ locality_aware
Prefer workers with recent cooperation history (cache affinity)
@ random
Random victim selection (baseline, good distribution)
@ adaptive
Select based on queue sizes (best for uneven loads)
@ numa_aware
Prefer workers on the same NUMA node (reduces cross-node traffic)