Rework thread priority management

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Sep 7 05:25:19 UTC 2016


The new thread priority data structures are:

/**
  * @brief The priority node to build up a priority aggregation.
  */
typedef struct {
   /**
    * @brief Node component for a chain or red-black tree.
    */
   union {
     Chain_Node Chain;
     RBTree_Node RBTree;
   } Node;

   /**
    * @brief The priority value of this node.
    */
   Priority_Control priority;
} Priority_Node;

/**
  * @brief The priority action type.
  */
typedef enum {
   PRIORITY_ACTION_ADD,
   PRIORITY_ACTION_CHANGE,
   PRIORITY_ACTION_REMOVE,
   PRIORITY_ACTION_INVALID
} Priority_Action_type;

typedef struct Priority_Aggregation Priority_Aggregation;

/**
  * @brief The priority aggregation.
  */
struct Priority_Aggregation {
   /**
    * @brief A priority node reflection the overall priority of the 
aggregation.
    *
    * May be used to add this aggregation to another aggregation to 
build up a
    * recursive priority scheme.
    */
   Priority_Node Node;

   /**
    * @brief A red-black tree to contain priority nodes contributing to the
    * overall priority of the this priority aggregation.
    */
   RBTree_Control Contributors;

#if defined(RTEMS_SMP)
   /**
    * @brief The scheduler instance of this priority aggregation.
    */
   const struct Scheduler_Control *scheduler;
#endif

   /**
    * @brief A priority action block to manage priority node additions, 
changes
    * and removals.
    */
   struct {
#if defined(RTEMS_SMP)
     /**
      * @brief The next priority aggregation in the action chain.
      */
     Priority_Aggregation *next;
#endif

     /**
      * @brief The priority node of the action.
      */
     Priority_Node *node;

     /**
      * @brief The type of the action.
      */
     Priority_Action_type type;
   } Action;
};

/**
  * @brief A set of priority actions.
  */
typedef struct {
   /**
    * @brief The first action of a priority action chain.
    */
   Priority_Aggregation *actions;
} Priority_Actions;

A thread priority is now a basically a priority queue.

On 07/09/16 03:44, Gedare Bloom wrote:
> I will try to read this code, but probably not until Friday.
>
> One question from the high-level description, can you clarify what
> "aggregation" means? Maybe this comes clear in one of the patches.
>
> Gedare
>
> On Tue, Sep 6, 2016 at 8:40 AM, Sebastian Huber
> <sebastian.huber at embedded-brains.de> wrote:
>> This patch set reworks the thread priority management.  The main goals are
>>
>> 1. an enhanced implementation of the priority inheritance protocol, and
>>
>> 2. support for the OMIP locking protocol.
>>
>> Instead of the current and real priority values in combination with the
>> resource count use thread priority nodes which contribute to the overall thread
>> priority.
>>
>> The actual priority of a thread is now an aggregation of priority nodes.
>> The thread priority aggregation for the home scheduler instance of a
>> thread consists of at least one priority node, which is normally the
>> real priority of the thread.  The locking protocols (e.g. priority
>> ceiling and priority inheritance), rate-monotonic period objects and the
>> POSIX sporadic server add, change and remove priority nodes.
>>
>> A thread changes its priority now immediately, e.g. priority changes are
>> not deferred until the thread releases its last resource.
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list