On 24 Jul 2024, at 10:20, Gernot Heiser via Devel wrote:
A thread should always be preempted if its budget is depleted.
A depleted budget is replenished once the new period begins. If budget=period, then that’s immediate.
After budget replenishment, the thread should be inserted back at the end of the ready queue.
This means, a full budget acts like a normal time slice, with threads of equal priority scheduled round-robin.
I can confirm that the implementation does indeed do that.
Liam, for what you are observing is it possible that you might be doing something similar to what I did when I was trying to reproduce your report?
I modified the test SCHED0013 in sel4test to set both threads to equal period and budget, and saw the (wrong) behaviour you described. Until Kent pointed out to me that the sel4test thread that is starting the two round-robin threads is setting itself to a lower priority first so that they can run..
If the first thread is round-robin, that means it is always the highest priority thread as soon as it gets started, and the second thread never gets started at all, because the sel4test setup thread does not run any more (since the first thread is always ready).
Keeping the setup thread priority high until after both round-robin threads are started (and then dropping it) shows the correct round robin behaviour for me.
Cheers,
Gerwin