-
Notifications
You must be signed in to change notification settings - Fork 19
Document modular schedulers. #80
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for taking this issue on.
I left some comments. In particular, I think the adaptive
scheduler's explanation could be improved.
packages/documentation/copy/en/reference/Target Language Details.md
Outdated
Show resolved
Hide resolved
|
||
The following schedulers are available: | ||
|
||
- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. It guarantees that in the execution of any given tag, reactions with earlier deadlines are executed before reactions with later deadlines; however, the tag of a reaction will still take precedence over its deadline in determining execution order. Reactions with no explicit deadline implicitly have an infinitely late deadline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It guarantees that in the execution of any given tag, reactions with earlier deadlines are executed before reactions with later deadlines
I think this is technically true, but it is glossing over the fact that reaction precedence within the same tag is also important. E.g., the order of execution for the following two reactions is not according to the user-provided deadline:
main reactor {
reaction(startup) {= =} deadline(2 msec) {= =}
reaction(startup) {= =} deadline(1 msec) {= =}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You put this delicately @Soroosh129; what I wrote was pretty wrong. I just rewrote and pushed my changes, but the description is so obscure and implementation-specific that I wonder if we would prefer to simply describe it as a best-effort policy that respects deadlines. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this:
GEDF_NP
(global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. Whenever the semantics of Lingua Franca allows for concurrent execution of two or more ready reactions at a particular tag, this scheduler will prioritize the reaction with the earliest deadline to run first (but with the limitation that reaction executions are non-preemptive). Reactions with no explicit deadline implicitly have an infinitely late deadline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that is what I wanted to say, but unless I am mistaken, the scheduler does use levels. It is possible for a reaction be have all its dependencies satisfied and to have an earlier deadline than reactions in the currently executing level, but to have its execution deferred because we process the reaction graph in level order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Levels are just one way of encoding reaction precedence (another way would be via a topologically sorted directed graph). I tried to abstract this detail away and simply say "Whenever the semantics of Lingua Franca allows for concurrent execution of two or more ready reactions at a particular tag". In the C runtime, that means whenever two reactions are ready (and triggered) at the current tag and have the same level. I think the only substantial thing I added to your previous explanation was the aforementioned sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But... levels are not part of the semantics of Lingua Franca. If they were, then we would not be able to use chain ID or relaxation of the barrier synchronization (LET).
This is really just a detail, though (and maybe it is not worth arguing about). I almost merged something that was even less precise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point. The GEDF_NP
scheduler's qualification for what reactions can execute concurrently is very limited and is only a subset of what LF semantics would allow.
Then, perhaps, levels are worth explaining briefly as you did. One note that I have is that all the currently-listed schedulers use levels in some form. Perhaps levels merit a brief sub-subsection here?
packages/documentation/copy/en/reference/Target Language Details.md
Outdated
Show resolved
Hide resolved
|
||
- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. It guarantees that in the execution of any given tag, reactions with earlier deadlines are executed before reactions with later deadlines; however, the tag of a reaction will still take precedence over its deadline in determining execution order. Reactions with no explicit deadline implicitly have an infinitely late deadline. | ||
- `NP` (non-preemptive): This scheduler is the default scheduler for programs that have no deadlines. It makes minimal guarantees about its behavior beyond that it maintains the deterministic semantics of Lingua Franca. This allows it to include optimizations that can result in lower execution times than the GEDF_NP scheduler. | ||
- `adaptive`: This scheduler behaves similarly to the `NP` scheduler, with the additional limitation that it is designed for applications that can tolerate potentially wide variability in physical execution times. In exchange, it can accomplish good performance on iterative workloads involving reactions that execute too quickly to justify the degree of automatic parallelization that other schedulers offer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explanation could be expanded. It is still not clear how this scheduler is adapting.
- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. It guarantees that in the execution of any given tag, reactions with earlier deadlines are executed before reactions with later deadlines; however, the tag of a reaction will still take precedence over its deadline in determining execution order. Reactions with no explicit deadline implicitly have an infinitely late deadline. | ||
- `NP` (non-preemptive): This scheduler is the default scheduler for programs that have no deadlines. It makes minimal guarantees about its behavior beyond that it maintains the deterministic semantics of Lingua Franca. This allows it to include optimizations that can result in lower execution times than the GEDF_NP scheduler. | ||
- `adaptive`: This scheduler behaves similarly to the `NP` scheduler, with the additional limitation that it is designed for applications that can tolerate potentially wide variability in physical execution times. In exchange, it can accomplish good performance on iterative workloads involving reactions that execute too quickly to justify the degree of automatic parallelization that other schedulers offer. | ||
- `GEDF_NP_CI` (global earliest-deadline-first, with chain ID): This scheduler implements the same policy as `GEDF_NP`, but it includes an optimization called chain ID that is currently disabled. This scheduler should not be used in practical applications. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps cite @lhstrh dissertation for an explainer on chain IDs.
…ls.md Co-authored-by: Soroush Bateni <[email protected]>
…ls.md Co-authored-by: Soroush Bateni <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fixes #77.