8000 MC/Subsystem improvements by Absolucy · Pull Request #6710 · Monkestation/Monkestation2.0 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

MC/Subsystem improvements #6710

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

Merged
merged 17 commits into from
Jun 1, 2025

Conversation

Absolucy
Copy link
Member
@Absolucy Absolucy commented May 16, 2025

About The Pull Request

Ports DaedalusDock/daedalusdock#293 and DaedalusDock/daedalusdock#709

So the way the MC schedules is that it has 3 buckets, Ticker, Normal, and Background. Ticker subsystems will queue every X ticks, no matter how much tick time they use when they fire. They are the first subsystems to fire in a given tick. Normal subsystems will queue every X deciseconds and the MC will assign a tick allocation based on their Priority. If the subsystem goes over it's allocation, it's next queue time will be offset by how much of the tick they overconsumed last run. Background systems will queue every X deciseconds, but their queue is always placed after every Ticker and Normal subsystem.

But there's a problem here. What if a subsystem has no work to do, but it's wait says it should fire this tick? Well, then it will be allocated tick time it doesn't need, and the subsystems before it will be allocated less time than they should be. This PR addresses that by adding a new flag, SS_HIBERNATE. Alongside giving a subsystem this flag, you define a list of variable names to check during CheckQueue(). For example, SSprocessing is assigned hibernate_checks = list("processing", "currentrun").

When the Master Controller is creating it's queue for this tick, it will check the length() of each variable in hibernate_checks. If any are greater than zero, the subsystem will be queued to fire like normal. If all are zero, the subsystem will be put into Hibernation, where it will not be queued to run until it has work to do. The result is that tick time is allocated more accurately based on how much work there is to do this tick.

In additional to all of that, 0-wait subsystems now exist. When paired with SS_HIBERNATE, the subsystem will only fire when it has work to do, as long as it does not overrun it's tick allocation.

I've also de-modularized some of our subsystems, and cleaned up some formatting.

Changelog

🆑 Absolucy, Kapu1178
server: The Master Controller now allocates tick time based on the work required for the tick.
/:cl:

@Absolucy Absolucy added Process: do not merge don't merge this ffs Code: Performance / Optimization the number going down makes me happy :3 Process: should testmerge PR should be testmerged first Code: Improvement exactly what it says on the tin labels May 16, 2025
@Absolucy Absolucy removed the Process: do not merge don't merge this ffs label May 31, 2025
@Absolucy Absolucy marked this pull request as ready for review May 31, 2025 03:08
@Absolucy Absolucy merged commit adef078 into Monkestation:master Jun 1, 2025
27 checks passed
@Absolucy Absolucy deleted the im-hiding-catnip-in-the-mc branch June 1, 2025 00:20
github-actions bot added a commit that referenced this pull request Jun 1, 2025
Xander3359 pushed a commit that referenced this pull request Jun 11, 2025
## About The Pull Request

whoopsies, I mistakingly set `SSblackmarket` to hibernate in
#6710, which pretty
much ensured markets would never fire.

## Changelog
:cl:
fix: Fixed black market auctions not processing.
/:cl:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code: Improvement exactly what it says on the tin Code: Performance / Optimization the number going down makes me happy :3 Process: should testmerge PR should be testmerged first
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0