Repository navigation
Remove ready_queue_next - #206
Conversation
Increase of trying to invent the concept of a tick, we will just run tasks that are ready, until we either reach the end, or we already ran 61 of them. This makes is easier to implement work-stealing later on, it also improves CPU-bound tasks. It might slightly increase latency for I/O tasks, but if there are I/O tasks, they will simple clear the ready queue and do poll more often. The worse case are mixed workloads, I/O latency could increase, but we will add more control over this and work-stealing will also help with balancing the load.
📝 WalkthroughWalkthroughSimplified task scheduler by eliminating the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (4)📚 Learning: 2025-10-21T10:00:56.962ZApplied to files:
📚 Learning: 2025-10-16T14:33:19.718ZApplied to files:
📚 Learning: 2026-01-10T13:55:00.163ZApplied to files:
📚 Learning: 2026-01-10T14:08:37.019ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (1)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/runtime.zig (1)
308-323: Update stale comments that still mentionnext_ready_queue.They now contradict the implementation and will mislead future edits.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/runtime.zig
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-10-21T10:00:56.962Z
Learnt from: lalinsky
Repo: lalinsky/zio PR: 62
File: src/utils/queue.zig:141-147
Timestamp: 2025-10-21T10:00:56.962Z
Learning: In work-stealing queues implemented in src/utils/queue.zig, stealers only modify the victim's head position, never the tail. The tail is exclusively owned by the owner thread, so no atomic acquire operations are needed when the owner reads its own tail.
Applied to files:
src/runtime.zig
📚 Learning: 2025-10-16T14:33:19.718Z
Learnt from: lalinsky
Repo: lalinsky/zio PR: 48
File: src/core/ConcurrentAwaitableList.zig:254-269
Timestamp: 2025-10-16T14:33:19.718Z
Learning: In the zio repository's `src/core/ConcurrentAwaitableList.zig` and `src/core/Awaitable.zig`, the `in_list` field should remain debug-only (conditional compilation with `builtin.mode == .Debug`). Double-removal detection in `ConcurrentAwaitableList.remove()` uses pointer-based checks (comparing `prev`/`next` against `head`/`tail`) rather than relying on a regular `in_list` field.
Applied to files:
src/runtime.zig
📚 Learning: 2026-01-10T13:55:00.163Z
Learnt from: lalinsky
Repo: lalinsky/zio PR: 184
File: src/runtime/blocking_task.zig:117-146
Timestamp: 2026-01-10T13:55:00.163Z
Learning: In Zig files, do not reference libxev for async I/O. The project uses a custom event loop implementation under src/ev/ and a callback-based async I/O loop similar to libuv/libxev. Reviewers should ensure code relies on the src/ev event loop and that there are no libxev usage patterns; prefer the central event loop in src/ev/ for all asynchronous operations.
Applied to files:
src/runtime.zig
📚 Learning: 2026-01-10T14:08:37.019Z
Learnt from: lalinsky
Repo: lalinsky/zio PR: 184
File: src/stdio.zig:117-129
Timestamp: 2026-01-10T14:08:37.019Z
Learning: In Zig files implementing swap-like semantics (e.g., old = swap(new); defer swap(old)), ensure the return value is an opaque restoration token rather than a direct reflection of internal state. Rely on the contract to perform increment/decrement logic internally (e.g., shield_count) and not expose internal state through the token. This makes behavior predictable, supports refactoring, and avoids leaking internal state across calls. Apply this pattern broadly to Zig code that uses a paired-swap or restoration-token mechanism.
Applied to files:
src/runtime.zig
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test (windows-latest)
🔇 Additional comments (1)
src/runtime.zig (1)
713-739: Looks good: yield vs wake scheduling is clear and fair.The rule is consistent and keeps
ready_countin sync.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
|
@coderabbitai can you guess the reason behind this? if so, does it make sense to yuo? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 2490
The old design: You had a two-tier queue system where yielded tasks went to Why remove it:
Does it make sense? Yeah, it's a pragmatic trade-off. You're accepting potential I/O latency hits in mixed workloads in exchange for simpler code that's easier to extend with work-stealing. The batch limit mitigates the worst fairness issues, and you've acknowledged the I/O concerns as something to tune later. For work-stealing, starting with the simplest queue structure that could work is the right call. |
Increase of trying to invent the concept of a tick, we will just run tasks that are ready, until we either reach the end, or we already ran 61 of them.
This makes is easier to implement work-stealing later on, it also improves CPU-bound tasks. It might slightly increase latency for I/O tasks, but if there are I/O tasks, they will simple clear the ready queue and do poll more often.
The worse case are mixed workloads, I/O latency could increase, but we will add more control over this and work-stealing will also help with balancing the load.