Skip to main content

distribute_cpus_proportional

Function distribute_cpus_proportional 

Source
fn distribute_cpus_proportional(
    cpus: &[usize],
    recipients: &[(u32, f64)],
) -> Result<HashMap<u32, Vec<usize>>>
Expand description

Distribute CPUs among recipients proportionally by weight.

Recipients with weight 0 receive 0 CPUs. If all weights are 0, falls back to equal division. As a post-processing step, if any positive-weight recipient got 0 CPUs, 1 CPU is stolen from the recipient with the highest allocation (that has

  1. to prevent starvation.