Doubt regarding thread creation in RTEMS

Richi Dubey richidubey at gmail.com
Wed Jul 22 13:36:32 UTC 2020


Hi,

Please clear a doubt of mine.

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.



On Wed, Jul 22, 2020 at 1:59 PM Richi Dubey <richidubey at gmail.com> wrote:

> This helps. Thanks a lot.
>
> On Tue, Jul 21, 2020 at 6:55 PM Sebastian Huber <
> sebastian.huber at embedded-brains.de> wrote:
>
>> On 21/07/2020 14:36, Richi Dubey wrote:
>>
>> > Could you please explain what _User_extensions_Thread_start does? It's
>> > hard to understand it all by myself since it has a lot of other
>> > information related to objects.
>> >
>> > The brief for it says:
>> > /**
>> >  * @brief Starts a thread.
>> >  *
>> >  * @param created The thread to start.
>> >  */
>> >
>> > This is exactly what my doubt was. When we unlocked the node by
>> > setting the state to ready by calling _Thread_Clear_state_locked,
>> > shouldn't the node be scheduled if the scheduler sees it fit? Why are
>> > we enabling thread dispatch on the current cpu (Shouldn't it depend on
>> > the affinity of the thread)?
>> >
>> > Please tell me what happens in principle after
>> > calling _Thread_Clear_state_locked().
>>
>> I tried to improve the _Thread_Start() description:
>>
>> https://lists.rtems.org/pipermail/devel/2020-July/060764.html
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200722/544cbc88/attachment-0001.html>


More information about the devel mailing list