Best practices for FreeRTOS kernel running on satellite

Hello, FreeRTOS was chosen as the operating system for a 3U cubesat. The following approach was implmeneted: All tasks were set to the same priority (around 20 tasks). Since a satallite lifetime consists of modes (Inital mode, normal mode, payload mode …etc), each task has a flag set in the beginning and would only run after checking if the flag is set or not. This approach works jsut fine, however I think that it doesnt reflect the true potential of FreeRTOS. It does not make any use of priorites. Is this acceptable? In addition, is frequently altering the priorites of tasks a valid way of controlling which task is running? Thank you

Best practices for FreeRTOS kernel running on satellite

First, I would recommend downloading the book https://www.freertos.org/Documentation/RTOS_book.html – it is a bit out of date but will still give you a good overview. In general terms, it is best to design such that a task is only executing if it has work to do – so it waits in the Blocked state (so not using any CPU time) until an event causes it to unblock. A task can Block on time (vTaskDelayUntil()) or any of the FreeRTOS objects (stream buffers, message buffers, task notifications, semaphores, queues, etc.). So when you say: “each task has a flag set in the beginning and would only run after checking if the flag is set or not.” I would agree – it doesn’t sound like you are making the most of the OS. It has to run to check the flag, so can’t only run after checking it. To you second point – it is rare for a task to have its priority changed – and yes I would say it wasn’t normal to change the priorities of tasks at run time as a way of controlling which is scheduled to run. If all the tasks are in the Blocked state until they have something to do then only the tasks that actually need to do something will be running anyway.