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

Implement min_spacing for actions #84

Open
erlingrj opened this issue Oct 22, 2024 · 2 comments
Open

Implement min_spacing for actions #84

erlingrj opened this issue Oct 22, 2024 · 2 comments

Comments

@erlingrj
Copy link
Collaborator

min_spacing is a optional argument to an action restricting the minimum time delta
between two events scheduled on the action.

It was easy to support when we required actions scheduled monotonically. But now that we will support arbitrary schedulings (#71) we need a complete implementation.

A proposed algorithm looks like this:
When lf_schedule is called with a tag t, if there is a min_spacing. We must search through the event queue and guarantee that there are no other events from the same action scheduled in the time-window" [t-min_spacing, t+min_spacing]. If so, drop the event.

In LF there are actually several policies for handling such an "illegal" schedule:

  • defer
  • drop
  • replace

However, is this well-defined if you try to schedule an event "between" two existing events on the event queue? Where do you defer it to? Which of the two events do you replace?

I think for now we will stick with the drop policy

@edwardalee
Copy link
Collaborator

If you look at the specification of min_spacing here: https://www.lf-lang.org/docs/next/writing-reactors/actions#triggering-time-for-actions, then I think the implementation is very simple. When you give a min_spacing, then monotonic scheduling becomes required. I think the current implementation in reactor-c takes advantage of this.

@erlingrj
Copy link
Collaborator Author

OK, I see, in this case it is very simple, I will look at it

@erlingrj erlingrj assigned erlingrj and unassigned erlingrj Oct 22, 2024
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

No branches or pull requests

2 participants