|
Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
|
Worker behavior policy configuration. More...
#include <worker_policy.h>

Static Public Member Functions | |
| static worker_policy | default_policy () |
| Create a default worker policy. | |
| static worker_policy | high_performance () |
| Create a high-performance worker policy. | |
| static worker_policy | low_latency () |
| Create a low-latency worker policy. | |
| static worker_policy | power_efficient () |
| Create a power-efficient worker policy. | |
Public Attributes | |
| scheduling_policy | scheduling = scheduling_policy::fifo |
| std::chrono::milliseconds | idle_timeout = config::default_worker_idle_timeout |
| bool | yield_on_idle = config::default_yield_on_idle |
| bool | sleep_when_idle = true |
| std::chrono::microseconds | idle_sleep_duration {100} |
| bool | enable_work_stealing = config::default_work_stealing |
| steal_policy | victim_selection = steal_policy::random |
| size_t | max_steal_attempts = 3 |
| std::chrono::microseconds | steal_backoff {50} |
| bool | pin_to_cpu = config::default_pin_threads |
| int | preferred_cpu = -1 |
| size_t | max_jobs_per_batch = 10 |
| bool | continue_on_exception = true |
| size_t | max_consecutive_failures = 5 |
| bool | enable_statistics = config::enable_statistics |
| std::string | worker_name_prefix = config::default_thread_prefix |
Worker behavior policy configuration.
This structure defines how a worker thread should behave in various situations and under different load conditions.
Definition at line 62 of file worker_policy.h.
|
inlinestatic |
Create a default worker policy.
Definition at line 94 of file worker_policy.h.
|
inlinestatic |
Create a high-performance worker policy.
Definition at line 101 of file worker_policy.h.
References enable_work_stealing, max_jobs_per_batch, sleep_when_idle, and yield_on_idle.
|
inlinestatic |
Create a low-latency worker policy.
Definition at line 113 of file worker_policy.h.
References idle_sleep_duration, max_jobs_per_batch, kcenon::thread::priority, scheduling, and yield_on_idle.
|
inlinestatic |
Create a power-efficient worker policy.
Definition at line 125 of file worker_policy.h.
References enable_work_stealing, idle_sleep_duration, sleep_when_idle, and yield_on_idle.
| bool kcenon::thread::worker_policy::continue_on_exception = true |
Definition at line 84 of file worker_policy.h.
| bool kcenon::thread::worker_policy::enable_statistics = config::enable_statistics |
Definition at line 88 of file worker_policy.h.
| bool kcenon::thread::worker_policy::enable_work_stealing = config::default_work_stealing |
Definition at line 73 of file worker_policy.h.
Referenced by kcenon::thread::numa_thread_pool::configure_numa_work_stealing(), high_performance(), power_efficient(), kcenon::thread::work_stealing_pool_policy::set_enabled(), kcenon::thread::thread_worker::set_policy(), kcenon::thread::work_stealing_pool_policy::set_policy(), kcenon::thread::thread_worker::try_get_job(), kcenon::thread::thread_worker::try_steal_work(), and kcenon::thread::thread_pool_builder::with_work_stealing().
| std::chrono::microseconds kcenon::thread::worker_policy::idle_sleep_duration {100} |
Definition at line 70 of file worker_policy.h.
Referenced by low_latency(), and power_efficient().
| std::chrono::milliseconds kcenon::thread::worker_policy::idle_timeout = config::default_worker_idle_timeout |
Definition at line 67 of file worker_policy.h.
| size_t kcenon::thread::worker_policy::max_consecutive_failures = 5 |
Definition at line 85 of file worker_policy.h.
| size_t kcenon::thread::worker_policy::max_jobs_per_batch = 10 |
Definition at line 81 of file worker_policy.h.
Referenced by high_performance(), and low_latency().
| size_t kcenon::thread::worker_policy::max_steal_attempts = 3 |
Definition at line 75 of file worker_policy.h.
Referenced by kcenon::thread::work_stealing_pool_policy::get_max_steal_attempts(), kcenon::thread::work_stealing_pool_policy::set_max_steal_attempts(), and kcenon::thread::thread_worker::try_steal_work().
| bool kcenon::thread::worker_policy::pin_to_cpu = config::default_pin_threads |
Definition at line 79 of file worker_policy.h.
| int kcenon::thread::worker_policy::preferred_cpu = -1 |
Definition at line 80 of file worker_policy.h.
| scheduling_policy kcenon::thread::worker_policy::scheduling = scheduling_policy::fifo |
Definition at line 64 of file worker_policy.h.
Referenced by low_latency().
| bool kcenon::thread::worker_policy::sleep_when_idle = true |
Definition at line 69 of file worker_policy.h.
Referenced by high_performance(), and power_efficient().
| std::chrono::microseconds kcenon::thread::worker_policy::steal_backoff {50} |
Definition at line 76 of file worker_policy.h.
Referenced by kcenon::thread::work_stealing_pool_policy::get_steal_backoff(), kcenon::thread::work_stealing_pool_policy::set_steal_backoff(), and kcenon::thread::thread_worker::try_steal_work().
| steal_policy kcenon::thread::worker_policy::victim_selection = steal_policy::random |
Definition at line 74 of file worker_policy.h.
Referenced by kcenon::thread::work_stealing_pool_policy::get_steal_policy(), and kcenon::thread::work_stealing_pool_policy::set_steal_policy().
| std::string kcenon::thread::worker_policy::worker_name_prefix = config::default_thread_prefix |
Definition at line 89 of file worker_policy.h.
| bool kcenon::thread::worker_policy::yield_on_idle = config::default_yield_on_idle |
Definition at line 68 of file worker_policy.h.
Referenced by high_performance(), low_latency(), and power_efficient().