Expand description
CPU core affinity helpers for deterministic cross-core latency.
Pinning publisher and subscriber threads to specific CPU cores eliminates OS scheduler jitter and ensures consistent cache-coherence transfer times.
§NUMA considerations
On multi-socket systems, pin publisher and subscriber threads to cores on the same socket. Cross-socket communication (QPI/UPI) adds ~100-200 ns of additional latency per cache-line transfer compared to intra-socket L3 snoops (~40-55 ns on Intel Comet Lake).
§Example
use photon_ring::affinity;
let cores = affinity::available_cores();
assert!(cores.len() >= 2, "need at least 2 cores");
// Pin to the first core
assert!(affinity::pin_to_core(cores[0]));Structs§
- CoreId
- This represents a CPU core.
Functions§
- available_
cores - Return the list of CPU cores available to this process.
- core_
count - Return the number of CPU cores available to this process.
- pin_
to_ core - Pin the current thread to a specific CPU core.
- pin_
to_ core_ id - Pin the current thread to a core by its numeric index.