Doubt regarding thread creation in RTEMS

Sebastian Huber sebastian.huber at
Wed Jul 22 14:16:53 UTC 2020

On 22/07/2020 15:36, Richi Dubey wrote:

> Threads that get created automatically when a CPU starts have their 
> scheduler nodes with node->idle set to the thread itself, while the 
> nodes that are created due to a task being created have NULL in their 
> node->idle (If not using helper function atm).  Am I right?
> If yes, Why isn't the function _Scheduler_Set_idle_thread() called 
> by _Thread_Create_idle_for_CPU?
> Trace:
> exinit.c -> _Thread_Create_idle -> _Thread_Create_idle_for_CPU 
> -> _Scheduler_Start_idle -> _Scheduler_EDF_SMP_Start_idle 
> -> _Scheduler_SMP_Do_start_idle ->_Scheduler_SMP_Release_idle_thread .
> I am asking this since _Scheduler_Set_idle_thread() is the only 
> function that sets the node->idle value.

I think the description of this member is clear:

  * @brief Scheduler node for per-thread data.
struct Scheduler_Node {

    * @brief The idle thread claimed by this node in case the sticky 
level is
    * greater than zero and the thread is block or is scheduled on another
    * scheduler instance.
    * This is necessary to ensure the priority ceiling protocols work across
    * scheduler boundaries.

   struct _Thread_Control *idle;

As I said before, the idle threads are normal threads. The only special 
thing is that they execute no code which blocks. You really have to 
distinguish between threads and scheduler nodes.

More information about the devel mailing list