1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/sys/sched_round_robin
Hugues Larrive 3c465836f2 examples and tests: add atmega8 to relevent Makefile.ci
using dist/tools/insufficient_memory/add_insufficient_memory_board.sh
2023-07-11 21:22:02 +02:00
..
tests tests: move sys related applications to tests/sys/ subdirectory 2023-05-10 12:02:58 +02:00
main.c tests: move sys related applications to tests/sys/ subdirectory 2023-05-10 12:02:58 +02:00
Makefile tests: move sys related applications to tests/sys/ subdirectory 2023-05-10 12:02:58 +02:00
Makefile.ci examples and tests: add atmega8 to relevent Makefile.ci 2023-07-11 21:22:02 +02:00
README.md tests: move sys related applications to tests/sys/ subdirectory 2023-05-10 12:02:58 +02:00

Round Robing Scheduling Test

This application is a simple test case for round-robin scheduling. Two threads are started with the same priority. The first thread is a busy loop and is started first. The second thread unlocks a mutex allowing the main thread to continue and exit.

Without Round Robin scheduling the busy loop thread would run indefinitely, with round-robin in eventually getting de-scheduled allowing the main thread to run and exit.

Usage

By default sched_round_robin is included:

make tests/sys_sched_round_robin flash term

...Board Initialisation...

Help: Press s to start test, r to print it is ready
s
START
main(): This is RIOT! (Version: ...)
starting threads
double locking mutex
mutex_thread yield
bad thread looping
unlock mutex
[SUCCESS]

It can be excluded from the build by setting the command-line argument NORR=1:

NORR=1 make tests/sys_sched_round_robin flash term

...Board Initialisation...

Help: Press s to start test, r to print it is ready
s
START
main(): This is RIOT! (Version: ...)
starting threads
double locking mutex
mutex_thread yield
bad thread looping

This will loop endlessly as the bad thread does not release the CPU, make test will timeout in that case.