Changeset 8bd4e6a in rtems-docs


Ignore:
Timestamp:
Mar 3, 2020, 6:51:13 AM (4 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
c6c06ae
Parents:
ac61465
git-author:
Sebastian Huber <sebastian.huber@…> (03/03/20 06:51:13)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/03/20 12:13:17)
Message:

c-user: Document thread switch extension changes

Close #3885.

Location:
c-user
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c-user/symmetric_multiprocessing_services.rst

    rac61465 r8bd4e6a  
    684684nodes for a thread is controlled by the thread queues.
    685685
     686.. _SMPThreadDispatchDetails:
     687
    686688Thread Dispatch Details
    687689-----------------------
  • c-user/user_extensions.rst

    rac61465 r8bd4e6a  
    262262-----------------------
    263263
    264 The thread switch extension is invoked before the context switch from the
    265 currently executing thread to the heir thread.  The thread switch extension is
    266 defined as follows.
     264The thread switch extension is defined as follows.
    267265
    268266.. code-block:: c
     
    273271    );
    274272
    275 The :c:data:`executing` is a pointer to the TCB of the currently executing
    276 thread.  The :c:data:`heir` is a pointer to the TCB of the heir thread.
     273The invocation conditions of the thread switch extension depend on whether RTEMS
     274was configured for uniprocessor or SMP systems.  A user must pay attention to
     275the differences to correctly implement a thread switch extension.
     276
     277In uniprocessor configurations, the thread switch extension is invoked before
     278the context switch from the currently executing thread to the heir thread.  The
     279:c:data:`executing` is a pointer to the TCB of the currently executing thread.
     280The :c:data:`heir` is a pointer to the TCB of the heir thread.  The context
     281switch initiated through the multitasking start is not covered by the thread
     282switch extension.
     283
     284In SMP configurations, the thread switch extension is invoked after the context
     285switch to the new executing thread (previous heir thread).  The
     286:c:data:`executing` is a pointer to the TCB of the previously executing thread.
     287Despite the name, this is not the currently executing thread.  The
     288:c:data:`heir` is a pointer to the TCB of the newly executing thread.  This is
     289the currently executing thread.  The context switches initiated through the
     290multitasking start are covered by the thread switch extension.  The reason for
     291the differences to uniprocessor configurations is that the context switch may
     292update the heir thread of the processor, see :ref:`SMPThreadDispatchDetails`.
     293The thread switch extensions are invoked with disabled interrupts and with
     294ownership of a per-processor SMP lock.  Thread switch extensions may run in
     295parallel on multiple processors.  It is recommended to use thread-local or
     296per-processor data structures for thread switch extensions.  A global SMP lock
     297should be avoided for performance reasons.
    277298
    278299The thread switch extension is invoked in forward order with thread dispatching
    279 disabled.  In SMP configurations, interrupts are disabled and the per-processor
    280 SMP lock is owned.  Thread switch extensions may run in parallel on multiple
    281 processors.  It is recommended to use thread-local or per-processor data
    282 structures in SMP configurations for thread switch extensions.  A global SMP
    283 lock should be avoided for performance reasons.
    284 
    285 The context switches initiated through the multitasking start are not covered
    286 by the thread switch extension.
     300disabled.
    287301
    288302.. index:: rtems_task_begin_extension
Note: See TracChangeset for help on using the changeset viewer.