-
Notifications
You must be signed in to change notification settings - Fork 24
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
Perform busy waiting when the wait duration is less than MIN_SLEEP_DURATION
#514
base: main
Are you sure you want to change the base?
Conversation
@erlingrj I ended up creating a new PR instead of #403 because that PR is WIP. I have two questions for you.
|
MIN_SLEEP_DURATION
MIN_SLEEP_DURATION
Hmm, I think doing busy-waiting is fine, but I think it should be viewed as a real-time optimization, the purpose of it is to reduce lag. That might not be always what is wanted, however, we only do this a short period of time anyways. Another argument is that if the users are writing real-time programs they have to configure the underlying platform to achieve it. If they are using Linux, this means enabling PREEMPT_RT and using a real-time scheduling policy for the process that runs the LF program. |
… exceed the next tag
Surprisingly, either removing MIN_SLEEP_DURATION (CI-test#184b55f) or adding busy waiting (CI-test#fd7bd22) in |
My guess here is that we try going to sleep for a negative duration and the Windows platform implementation does not support that. I suggest that we verify that the sleep duration is greater than zero. (Basically setting MIN_SLEEP_DURATION to zero). The first failures when adding the busy-wait seems to be different than the ones when you removed it altogether:
Could be something else completely |
Very wierd Java errors, almost seems like its something with the network? |
Yes, it is very weird. RomanIakovlev/timeshape#1 Maybe the busy waiting causes a stack or heap overflow?
Anyway, I'll add your suggestion. Thanks! |
Hmm... I found that there's already the code to handle negative time delays below in reactor-c/low_level_platform/impl/src/lf_windows_support.c Lines 293 to 299 in 856e98a
|
Why don't we set |
This fixes #513.
Add busy waiting when the wait duration is less than
MIN_SLEEP_DURATION
to prevent the reactor from advancing to a logical time greater than the current physical time.