moirai_core/executor/placement.rs
1//! Worker placement policy.
2
3/// Whether scheduler workers are confined to logical processors.
4///
5/// The policy is an opt-in startup contract. It changes what the runtime
6/// enforces, and therefore what it may publish about worker placement.
7#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
8pub enum WorkerPlacement {
9 /// Workers run wherever the operating system schedules them.
10 ///
11 /// The runtime claims no worker-to-processor or worker-to-node assignment,
12 /// and the topology-aware victim tier stays inactive.
13 #[default]
14 Unbound,
15 /// Worker `i` is confined to one logical processor for its whole life.
16 ///
17 /// Processors are taken from the detected topology in ascending id order,
18 /// worker `i` receiving processor `i % processor_count`, so a pool larger
19 /// than the machine shares processors. Construction fails closed: when the
20 /// topology cannot be detected, or the operating system refuses any
21 /// worker's binding, the scheduler is not returned and the error names the
22 /// lowest-numbered worker that failed. On a host with more than one NUMA
23 /// node the bound assignment is what the runtime publishes for
24 /// topology-aware stealing.
25 Pinned,
26}