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

Quasi static scheduler runtime #90

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

lsk567
Copy link

@lsk567 lsk567 commented Jun 28, 2022

This is a draft PR for the C runtime of the quasi-static (QS) scheduler. The design of the scheduler follows the one in this report and (mostly) in this discussion thread.

This scheduler runtime concurrently must be compiled against a schedule.h file, which should be generated by a static schedule generator in lfc. A preliminary version of the schedule generator is implemented using Uclid5 on this branch.

Here are the outstanding TODOs in order to make this scheduler able to be merged in:

  • Support an instruction file specified on the command line. The scheduler then reads the instructions line-by-line from the file during execution. This feature could support scheduler development.

An important TODO after a more efficient schedule generator is merged into lingua-franca:

  • Adding QS tests in the regression test suite.

More research-related items:

  • Debug the performance issue of this scheduler when running benchmarks, which is significantly slower than the default NP scheduler.
  • Support the branch instruction in the instruction set.
  • Implement working-stealing on top of QS.
  • Take WCET into account when generating schedules.
  • Support LET scheduling.
  • Establish an understandable mapping between reactions and reaction IDs (currently no clear mapping).
  • A validator tool that ensures dependency constraints are satisfied in a schedule file.
  • (Peter) Explore branch prediction in modern processors.

Use cases:

  1. Deliver better performance for certain programs (TODO: identify this subset of programs);
  2. Help real-time systems people develop new schedulers;
  3. More deterministic execution;
  4. In formal verification, can provide stronger axioms (LF semantics + QS scheduler semantics) and enable timing analysis given WCETs.

@lsk567 lsk567 self-assigned this Jun 28, 2022
@lsk567 lsk567 requested a review from Soroosh129 June 28, 2022 23:01
Copy link
Contributor

@edwardalee edwardalee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising. A few questions included. Also, there is not enough documentation to know how to use it. Ideally, it would explain how to create (manually) a quasi-static schedule somewhere so that one could use these extensions.

core/threaded/scheduler_QS.c Outdated Show resolved Hide resolved
core/threaded/scheduler_QS.c Show resolved Hide resolved
core/threaded/scheduler_QS.c Outdated Show resolved Hide resolved
// lf_mutex_lock(&_lf_sched_instance->_lf_sched_semaphore->mutex);
// lf_cond_wait(&_lf_sched_instance->_lf_sched_semaphore->cond, &_lf_sched_instance->_lf_sched_semaphore->mutex);
// lf_mutex_unlock(&_lf_sched_instance->_lf_sched_semaphore->mutex);
lf_cond_wait(&_lf_sched_instance->_lf_sched_array_of_conds[0], &mutex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this index be the worker number rather than 0?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although the field is called _lf_sched_array_of_conds, the current implementation only uses one condition variable to coordinate time advancement. An array is used here so that a future scheduler implementation that needs multiple condition variables can still use this field.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment in the code about this would be helpful.

core/threaded/scheduler_QS.c Show resolved Hide resolved
core/threaded/scheduler_instance.h Outdated Show resolved Hide resolved
core/threaded/scheduler_QS.c Outdated Show resolved Hide resolved
core/threaded/scheduler_QS.c Outdated Show resolved Hide resolved
@lsk567 lsk567 changed the title [Draft] Quasi static scheduler runtime Quasi static scheduler runtime Sep 13, 2022
@lsk567 lsk567 marked this pull request as ready for review September 13, 2022 22:45
@lsk567 lsk567 requested a review from lhstrh September 13, 2022 23:05
@lhstrh
Copy link
Member

lhstrh commented Oct 31, 2023

What is the relationship between this PR and #241?

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

Successfully merging this pull request may close these issues.

3 participants