source: rtems/cpukit/score/src/schedulerpriority.c @ 0daa8ab

5
Last change on this file since 0daa8ab was 300f6a48, checked in by Sebastian Huber <sebastian.huber@…>, on 06/22/16 at 15:09:23

score: Rework thread priority management

Add 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.

Replace the _Thread_Change_priority() function with

  • _Thread_Priority_perform_actions(),
  • _Thread_Priority_add(),
  • _Thread_Priority_remove(),
  • _Thread_Priority_change(), and
  • _Thread_Priority_update().

Update #2412.
Update #2556.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  @file
3 *
4 *  @brief Initialize Scheduler Priority
5 *  @ingroup ScoreScheduler
6 */
7
8/*
9 *  Copyright (C) 2010 Gedare Bloom.
10 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/schedulerpriorityimpl.h>
22#include <rtems/score/wkspace.h>
23
24void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler )
25{
26  Scheduler_priority_Context *context =
27    _Scheduler_priority_Get_context( scheduler );
28
29  _Priority_bit_map_Initialize( &context->Bit_map );
30  _Scheduler_priority_Ready_queue_initialize(
31    &context->Ready[ 0 ],
32    scheduler->maximum_priority
33  );
34}
35
36void _Scheduler_priority_Node_initialize(
37  const Scheduler_Control *scheduler,
38  Scheduler_Node          *node,
39  Thread_Control          *the_thread,
40  Priority_Control         priority
41)
42{
43  Scheduler_priority_Context *context;
44  Scheduler_priority_Node    *the_node;
45
46  _Scheduler_Node_do_initialize( scheduler, node, the_thread, priority );
47
48  context = _Scheduler_priority_Get_context( scheduler );
49  the_node = _Scheduler_priority_Node_downcast( node );
50  _Scheduler_priority_Ready_queue_update(
51    &the_node->Ready_queue,
52    priority,
53    &context->Bit_map,
54    &context->Ready[ 0 ]
55  );
56}
Note: See TracBrowser for help on using the repository browser.