Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::config Namespace Reference

Typedefs

using default_job_type = job_types
 

Variables

constexpr size_t default_thread_count = 4
 
constexpr size_t max_threads = 64
 
constexpr size_t min_threads = 1
 
constexpr size_t default_queue_size = 1024
 
constexpr size_t unlimited_queue_size = 0
 
constexpr auto default_wake_interval = std::chrono::milliseconds(100)
 
constexpr auto default_shutdown_timeout = std::chrono::seconds(5)
 
constexpr auto default_worker_idle_timeout = std::chrono::seconds(30)
 
constexpr bool default_yield_on_idle = true
 
constexpr bool default_work_stealing = false
 Enable work stealing for improved load balancing.
 
constexpr size_t default_max_steal_attempts = 3
 Default maximum steal attempts before backing off.
 
constexpr auto default_steal_backoff = std::chrono::microseconds(50)
 Default backoff duration between steal attempts (microseconds).
 
constexpr bool default_pin_threads = false
 
constexpr bool default_use_priorities = false
 
constexpr size_t max_queue_size = 1024 * 1024
 
constexpr size_t default_stack_size = 1024 * 1024
 
constexpr bool enable_coroutines = __cplusplus >= 202002L
 
constexpr bool enable_statistics = true
 
constexpr bool enable_debugging = false
 
constexpr const char * default_thread_prefix = "worker"
 
constexpr const char * default_pool_name = "thread_pool"
 
constexpr size_t default_worker_count = 4
 
constexpr size_t max_workers = 64
 
constexpr size_t min_workers = 1
 
constexpr size_t default_wait_timeout_ms = 100
 
constexpr size_t default_shutdown_timeout_ms = 5000
 
constexpr bool enable_priority_boost = false
 
constexpr bool enable_work_stealing = true
 
constexpr bool enable_adaptive_sizing = false
 
constexpr size_t default_job_pool_size = 512
 
constexpr bool enable_job_recycling = true
 
constexpr bool enable_debug_logging = false
 
constexpr bool enable_performance_monitoring = false
 
constexpr size_t monitoring_interval_ms = 1000
 

Typedef Documentation

◆ default_job_type

Definition at line 21 of file config.h.

Variable Documentation

◆ default_job_pool_size

size_t kcenon::thread::config::default_job_pool_size = 512
constexpr

Definition at line 40 of file config.h.

◆ default_max_steal_attempts

size_t kcenon::thread::config::default_max_steal_attempts = 3
constexpr

Default maximum steal attempts before backing off.

Definition at line 69 of file config.h.

◆ default_pin_threads

bool kcenon::thread::config::default_pin_threads = false
constexpr

Definition at line 76 of file config.h.

◆ default_pool_name

const char* kcenon::thread::config::default_pool_name = "thread_pool"
constexpr

Definition at line 90 of file config.h.

◆ default_queue_size

size_t kcenon::thread::config::default_queue_size = 1024
constexpr

◆ default_shutdown_timeout

auto kcenon::thread::config::default_shutdown_timeout = std::chrono::seconds(5)
constexpr

Definition at line 31 of file config.h.

◆ default_shutdown_timeout_ms

size_t kcenon::thread::config::default_shutdown_timeout_ms = 5000
constexpr

Definition at line 31 of file config.h.

◆ default_stack_size

size_t kcenon::thread::config::default_stack_size = 1024 * 1024
constexpr

Definition at line 81 of file config.h.

◆ default_steal_backoff

auto kcenon::thread::config::default_steal_backoff = std::chrono::microseconds(50)
constexpr

Default backoff duration between steal attempts (microseconds).

Definition at line 74 of file config.h.

◆ default_thread_count

size_t kcenon::thread::config::default_thread_count = 4
constexpr

Definition at line 21 of file config.h.

◆ default_thread_prefix

const char* kcenon::thread::config::default_thread_prefix = "worker"
constexpr

Definition at line 89 of file config.h.

◆ default_use_priorities

bool kcenon::thread::config::default_use_priorities = false
constexpr

Definition at line 77 of file config.h.

◆ default_wait_timeout_ms

size_t kcenon::thread::config::default_wait_timeout_ms = 100
constexpr

Definition at line 30 of file config.h.

◆ default_wake_interval

auto kcenon::thread::config::default_wake_interval = std::chrono::milliseconds(100)
constexpr

Definition at line 30 of file config.h.

◆ default_work_stealing

bool kcenon::thread::config::default_work_stealing = false
constexpr

Enable work stealing for improved load balancing.

Work stealing allows idle workers to steal jobs from busy workers, reducing tail latency and improving throughput in mixed workloads.

Architecture (when enabled):

  • Each worker maintains a local LIFO deque (Chase-Lev algorithm)
  • Workers push/pop from their own deque (cache-friendly)
  • Idle workers steal from top of other workers' deques (FIFO)
  • Global queue serves as fallback for work submission

Performance Characteristics:

  • Reduced global queue contention (~50-70% less CAS operations)
  • Better cache locality for job execution
  • Lower tail latency for mixed job sizes
  • Slight overhead for steal attempts (backoff mechanism)
See also
worker_policy for tuning steal_backoff and max_steal_attempts
steal_policy for victim selection strategies

Definition at line 61 of file config.h.

◆ default_worker_count

size_t kcenon::thread::config::default_worker_count = 4
constexpr

◆ default_worker_idle_timeout

auto kcenon::thread::config::default_worker_idle_timeout = std::chrono::seconds(30)
constexpr

Definition at line 32 of file config.h.

◆ default_yield_on_idle

bool kcenon::thread::config::default_yield_on_idle = true
constexpr

Definition at line 35 of file config.h.

◆ enable_adaptive_sizing

bool kcenon::thread::config::enable_adaptive_sizing = false
constexpr

Definition at line 37 of file config.h.

◆ enable_coroutines

bool kcenon::thread::config::enable_coroutines = __cplusplus >= 202002L
constexpr

Definition at line 84 of file config.h.

◆ enable_debug_logging

bool kcenon::thread::config::enable_debug_logging = false
constexpr

Definition at line 44 of file config.h.

◆ enable_debugging

bool kcenon::thread::config::enable_debugging = false
constexpr

Definition at line 86 of file config.h.

◆ enable_job_recycling

bool kcenon::thread::config::enable_job_recycling = true
constexpr

Definition at line 41 of file config.h.

◆ enable_performance_monitoring

bool kcenon::thread::config::enable_performance_monitoring = false
constexpr

Definition at line 45 of file config.h.

◆ enable_priority_boost

bool kcenon::thread::config::enable_priority_boost = false
constexpr

Definition at line 35 of file config.h.

◆ enable_statistics

bool kcenon::thread::config::enable_statistics = true
constexpr

Definition at line 85 of file config.h.

◆ enable_work_stealing

bool kcenon::thread::config::enable_work_stealing = true
constexpr

Definition at line 36 of file config.h.

◆ max_queue_size

size_t kcenon::thread::config::max_queue_size = 1024 * 1024
constexpr

Definition at line 80 of file config.h.

◆ max_threads

size_t kcenon::thread::config::max_threads = 64
constexpr

Definition at line 22 of file config.h.

◆ max_workers

size_t kcenon::thread::config::max_workers = 64
constexpr

◆ min_threads

size_t kcenon::thread::config::min_threads = 1
constexpr

Definition at line 23 of file config.h.

◆ min_workers

size_t kcenon::thread::config::min_workers = 1
constexpr

◆ monitoring_interval_ms

size_t kcenon::thread::config::monitoring_interval_ms = 1000
constexpr

Definition at line 46 of file config.h.

◆ unlimited_queue_size

size_t kcenon::thread::config::unlimited_queue_size = 0
constexpr

Definition at line 27 of file config.h.