Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inefficient distribution of priorities #66

Open
j-hui opened this issue Aug 4, 2021 · 1 comment
Open

Inefficient distribution of priorities #66

j-hui opened this issue Aug 4, 2021 · 1 comment

Comments

@j-hui
Copy link
Collaborator

j-hui commented Aug 4, 2021

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:

main =
  fork outputHandler | actualMain

where most of the interesting stuff starts in actualMain (e.g., forking more processes), while outputHandler is just a leaf process that evaluates output. This means that half of the priorities are effectively wasted on outputHandler.

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)

@sedwards-lab
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants