Repository navigation
feat(sched): round-robin time slicing below a threshold level (M2 leftover) - #42
Merged
Merged
Conversation
CONFIG_EMB_TIME_SLICING implements KRN-SCH-007, KRN-SCH-026 and KRN-SCH-037 (SPEC-003 §8, KRN-TIM-029). A thread at or below CONFIG_EMB_TIMESLICE_PRIORITY gets CONFIG_EMB_TIMESLICE_TICKS at each dispatch. At expiry the quantum is renewed and, with a READY equal-priority peer, a per-CPU rotation flag makes the next decision place the thread behind its peers. The quantum is one more deadline in the tickless computation and one comparison in the periodic tick. List scheduler only. Off by default, so every existing configuration builds the same kernel. The reference model implements the same rules. The runner reports the quantum and the threshold, and the bridge adopts them. native-timeslice (periodic clock) checks slicing through the bridge, and native-timeslice-tickless runs the conformance cases only: a tickless quantum starts from the free-running counter, which the model does not see. New conformance cases cover rotation behind every peer, expiry without a peer, two spinners sharing a level and the threshold. A portable emb_test_spin_ticks() helper supports them. A63 records the details for review. Signed-off-by: teo1747 <motsoujunior17@gmail.com>
This was referenced Oct 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
CONFIG_EMB_TIME_SLICING, which existed in Kconfig without an implementation (KRN-SCH-007, KRN-SCH-026, KRN-SCH-037; SPEC-003 §8, KRN-TIM-029). The project owner chose to "implement it now" to finish M2.Behavior
CONFIG_EMB_TIMESLICE_PRIORITY(new; 255 means every level) getsCONFIG_EMB_TIMESLICE_TICKSat each dispatch.Evidence
_slice_startand_slice_checkmirror the kernel, plus a new appendedTIMESLICEscenario group explored exhaustively. 129 model tests pass, up from 122.timeslice=andtimeslice_prio=(only on slicing builds, so other captures stay byte-identical), andbridge.adaptadopts them.native-timeslicepreset (quantum 2, threshold 20, periodic clock): seeds 1–3 × 40 runs gave 3560/3560 agreeing runs each.native-timeslice-ticklesspreset, conformance only.test_sched.c, with a portableemb_test_spin_ticks()helper:native-timesliceandnative-timeslice-ticklesslegs.Docs
KRN-SCH-007/026/037/041 and KRN-TIM-029 statuses, SPEC-003 §8, the configuration guide (presets and scheduler options), the tasks guide, STATUS and CHANGELOG.