Hi Kaspar! On Tue, Nov 29, 2016 at 10:41:11AM +0100, Kaspar Schleiser wrote: > On 11/29/2016 10:27 AM, Oleg Hahm wrote: > > I would call it rather a bug in the documentation. The behavior of the > > scheduler for threads of the same priority is simply underspecified. > > We had that discussion offline. The "bug" is both in Cortex-M's ISR > handling and in the docs.
Okay, re-reading the documentation again, I agree that the behavior deviates from what is written. I also see, that the behavior is indeed different on different architectures which is clearly a bug. > > "Assigning the same priority to two or more threads is usually not a good > > idea. A thread in RIOT may run until it yields (thread_yield) or another > > thread with higher priority is runnable (STATUS_ON_RUNQUEUE) again. Multiple > > threads with the same priority will therefore be scheduled cooperatively: > > when > > one of them is running, all others with the same priority depend on it to > > yield (or be interrupted by a thread with higher priority). > > This last half sentence (in braces) is wrong. A higher thread might > interrupt one with "siblings" of the same priority, but after the > high-prio thread is done, the scheduler would switch back to the initial > thread. That's probably my fault. I always thought that `sched_run()` would advance the pointer which is apparently not true. Cheers, Oleg -- The great thing about SQL transaction jokes is that once you BEGIN, you can ROLLBACK if nobody gets them.
signature.asc
Description: PGP signature
_______________________________________________ devel mailing list devel@riot-os.org https://lists.riot-os.org/mailman/listinfo/devel