Node vs Threads in scheduling
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Aug 18 11:24:23 UTC 2020
On 17/08/2020 14:35, Richi Dubey wrote:
> Also, can someone please explain how the thread could in the ready
> state while the node is in a scheduled state in this
> <https://git.rtems.org/rtems/tree/cpukit/include/rtems/score/schedulersmpimpl.h#n1517>
> conditional block ?
The MrsP locking protocol performs busy waiting will a thread is
blocked. The busy waiting is carried out by idle threads.
In this case
|static inline bool _Scheduler_SMP_Ask_for_help( Scheduler_Context
*context, Thread_Control *thread, Scheduler_Node *node, Chain_Node_order
order, Scheduler_SMP_Insert insert_ready, Scheduler_SMP_Insert
insert_scheduled, Scheduler_SMP_Move move_from_scheduled_to_ready,
Scheduler_SMP_Get_lowest_scheduled get_lowest_scheduled,
Scheduler_SMP_Allocate_processor allocate_processor ) { Scheduler_Node
*lowest_scheduled; ISR_lock_Context lock_context; bool success; if (
thread->Scheduler.pinned_scheduler != NULL ) { /* * Pinned threads are
not allowed to ask for help. Return success to break * the loop in
_Thread_Ask_for_help() early. */ return true; } lowest_scheduled = (
*get_lowest_scheduled )( context, node );
_Thread_Scheduler_acquire_critical( thread, &lock_context ); if (
thread->Scheduler.state == THREAD_SCHEDULER_READY ) { [...] |
|} else if ( node_state == SCHEDULER_SMP_NODE_SCHEDULED ) {
_Thread_Scheduler_cancel_need_for_help( thread, _Thread_Get_CPU( thread
) ); _Scheduler_Discard_idle_thread( context, thread, node,
_Scheduler_SMP_Release_idle_thread ); _Scheduler_Thread_change_state(
thread, THREAD_SCHEDULER_SCHEDULED );
_Thread_Scheduler_release_critical( thread, &lock_context ); success =
true; the thread is ready to execute again, if this scheduler node is
scheduled, then it uses an idle thread to perform the busy wait. So, we
have to get rid of the idle thread and use the node for its own thread. |
More information about the devel
mailing list