Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
numa_thread_pool.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
13#pragma once
14
21
22namespace kcenon::thread
23{
24
94{
95public:
105 explicit numa_thread_pool(const std::string& thread_title = "numa_thread_pool",
106 const thread_context& context = thread_context());
107
114 numa_thread_pool(const std::string& thread_title,
115 std::shared_ptr<job_queue> custom_queue,
116 const thread_context& context = thread_context());
117
124 numa_thread_pool(const std::string& thread_title,
125 std::unique_ptr<pool_queue_adapter_interface> queue_adapter,
126 const thread_context& context = thread_context());
127
131 ~numa_thread_pool() override = default;
132
133 // =========================================================================
134 // NUMA-specific Methods
135 // =========================================================================
136
149
154 [[nodiscard]] const enhanced_work_stealing_config& numa_work_stealing_config() const;
155
167
177 [[nodiscard]] const numa_topology& numa_topology_info() const;
178
183 [[nodiscard]] bool is_numa_system() const;
184
194
201
206 [[nodiscard]] bool is_numa_work_stealing_enabled() const;
207
208private:
211
213 mutable bool topology_detected_{false};
214
217
219 std::unique_ptr<numa_work_stealer> numa_work_stealer_;
220
223
225 void ensure_topology_detected() const;
226};
227
228} // namespace kcenon::thread
A NUMA-aware thread pool optimized for Non-Uniform Memory Access architectures.
const numa_topology & numa_topology_info() const
Get the detected NUMA topology.
enhanced_work_stealing_config enhanced_ws_config_
Enhanced work-stealing configuration.
~numa_thread_pool() override=default
Virtual destructor.
bool is_numa_system() const
Check if the system has NUMA architecture.
worker_policy worker_policy_
Worker policy configuration.
bool topology_detected_
Flag indicating if topology has been detected.
bool is_numa_work_stealing_enabled() const
Check if NUMA work stealing is currently enabled.
numa_topology cached_topology_
Cached NUMA topology (detected on construction)
void enable_numa_work_stealing()
Enable NUMA-optimized work stealing with default settings.
const enhanced_work_stealing_config & numa_work_stealing_config() const
Get the current NUMA work-stealing configuration.
void configure_numa_work_stealing(const enhanced_work_stealing_config &config)
Configure NUMA-aware work stealing.
std::unique_ptr< numa_work_stealer > numa_work_stealer_
NUMA-aware work stealer.
void disable_numa_work_stealing()
Disable NUMA-aware work stealing.
void ensure_topology_detected() const
Ensure topology is detected.
work_stealing_stats_snapshot numa_work_stealing_stats() const
Get a snapshot of NUMA work-stealing statistics.
NUMA (Non-Uniform Memory Access) topology information.
Context object that provides access to optional services.
A thread pool for concurrent execution of jobs using multiple worker threads.
Core thread pool implementation with work stealing and auto-scaling.
Configuration for enhanced work-stealing with NUMA awareness.
Core threading foundation of the thread system library.
Definition thread_impl.h:17
NUMA node topology detection and information.
NUMA-aware work stealer with enhanced victim selection policies.
Configuration for enhanced work-stealing with NUMA awareness.
Non-atomic snapshot of work-stealing statistics.
Worker behavior policy configuration.
Statistics snapshot for work-stealing performance monitoring.
Worker behavior policies and configuration.