Open j-hui opened 3 years ago
There almost certainly is a better way to do it if you know how many child processes you're ever going to have. The basic idea is that each child is given a range of priorities, which it then subdivides across its children. By default, it divides its range into powers of two and distributes them equally among children to avoid complicated arithmetic. The waste is primarily due to the "equally" part; if you know exactly how many levels each child will need, you can distribute them better.
the way we are currently using the priority and depth, we are evenly distributing the priorities among the forked children.
However, I would imagine a common pattern would be something like this:
where most of the interesting stuff starts in
actualMain
(e.g., forking more processes), whileoutputHandler
is just a leaf process that evaluates output. This means that half of the priorities are effectively wasted onoutputHandler
.Is there a better way to distribute the priorities among children, if we know that a process is a leaf process? (tagging @sedwards-lab since he came up with the original approach)