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

Major refactoring of Scheduler/Task #339

Merged
merged 5 commits into from
Jun 27, 2024
Merged

Major refactoring of Scheduler/Task #339

merged 5 commits into from
Jun 27, 2024

Conversation

rdaum
Copy link
Owner

@rdaum rdaum commented Jun 26, 2024

**Sorry this one is going to be hard to read as any kind of diff. If you're worried, I recommend just reading the whole of scheduler.rs and task.rs. **

Highlights:

  • Suspended tasks no longer hog a thread and idle. Instead their thread ends and they are moved into a suspended vector inside the scheduler itself.
  • Tasks that start in a delayed state (e.g. forks) now no longer use a thread with a manual delay. Instead they begin their life in suspended state and are picked up by the scheduler tick.
  • Gut the remainder of the complicated dispatch logic that was leftover from the old async/tokio version of this code. Intermediate result objects (which used to be processed in batch) are gone, and actions are immediately acted on. This should be a lot easier to read now.

I believe this paves the way for a more testable, robust future.

@rdaum rdaum requested review from abesto and nnunley June 26, 2024 21:08
@rdaum rdaum self-assigned this Jun 26, 2024
Highlights:
  * Suspended tasks no longer hog a thread and idle. Instead their
    thread ends and they are moved into a suspended vector inside the
    scheduler itself.
  * Tasks that start in a delayed state (e.g. forks) now no longer use
    a thread with a manual delay. Instead they begin their life in
    suspended state and are picked up by the scheduler tick.
  * Gut the remainder of the complicated dispatch logic that was
    leftover from the old async/tokio version of this code. Intermediate
    result objects (which used to be processed in batch) are gone, and
    actions are immediately acted on. This should be a lot easier to
    read now.

I believe this paves the way for a more testable, robust future.
  * Run simple program to completion
  * Throw an exception
  * `suspend()` and resume
  * `read()`` and resume
  * fork
@rdaum rdaum merged commit dc56d58 into main Jun 27, 2024
7 checks passed
@rdaum rdaum deleted the rd/scheduler-refactor branch July 6, 2024 02:51
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.

2 participants