source: rtems/cpukit/score/include/rtems/score/schedulerprioritysmp.h @ 9bfad8c

5
Last change on this file since 9bfad8c was 9bfad8c, checked in by Sebastian Huber <sebastian.huber@…>, on 06/08/16 at 20:22:46

score: Add thread priority to scheduler nodes

The thread priority is manifest in two independent areas. One area is
the user visible thread priority along with a potential thread queue.
The other is the scheduler. Currently, a thread priority update via
_Thread_Change_priority() first updates the user visble thread priority
and the thread queue, then the scheduler is notified if necessary. The
priority is passed to the scheduler via a local variable. A generation
counter ensures that the scheduler discards out-of-date priorities.

This use of a local variable ties the update in these two areas close
together. For later enhancements and the OMIP locking protocol
implementation we need more flexibility. Add a thread priority
information block to Scheduler_Node and synchronize priority value
updates via a sequence lock on SMP configurations.

Update #2556.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreSchedulerPrioritySMP
5 *
6 * @brief Deterministic Priority SMP Scheduler API
7 */
8
9/*
10 * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Dornierstr. 4
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifndef _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H
24#define _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H
25
26#include <rtems/score/scheduler.h>
27#include <rtems/score/schedulerpriority.h>
28#include <rtems/score/schedulersmp.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif /* __cplusplus */
33
34/**
35 * @defgroup ScoreSchedulerPrioritySMP Deterministic Priority SMP Scheduler
36 *
37 * @ingroup ScoreSchedulerSMP
38 *
39 * This is an implementation of the global fixed priority scheduler (G-FP).  It
40 * uses one ready chain per priority to ensure constant time insert operations.
41 * The scheduled chain uses linear insert operations and has at most processor
42 * count entries.  Since the processor and priority count are constants all
43 * scheduler operations complete in a bounded execution time.
44 *
45 * The thread preempt mode will be ignored.
46 *
47 * @{
48 */
49
50/**
51 * @brief Scheduler context specialization for Deterministic Priority SMP
52 * schedulers.
53 */
54typedef struct {
55  Scheduler_SMP_Context    Base;
56  Priority_bit_map_Control Bit_map;
57  Chain_Control            Ready[ RTEMS_ZERO_LENGTH_ARRAY ];
58} Scheduler_priority_SMP_Context;
59
60/**
61 * @brief Scheduler node specialization for Deterministic Priority SMP
62 * schedulers.
63 */
64typedef struct {
65  /**
66   * @brief SMP scheduler node.
67   */
68  Scheduler_SMP_Node Base;
69
70  /**
71   * @brief The associated ready queue of this node.
72   */
73  Scheduler_priority_Ready_queue Ready_queue;
74} Scheduler_priority_SMP_Node;
75
76/**
77 * @brief Entry points for the Priority SMP Scheduler.
78 */
79#define SCHEDULER_PRIORITY_SMP_ENTRY_POINTS \
80  { \
81    _Scheduler_priority_SMP_Initialize, \
82    _Scheduler_default_Schedule, \
83    _Scheduler_priority_SMP_Yield, \
84    _Scheduler_priority_SMP_Block, \
85    _Scheduler_priority_SMP_Unblock, \
86    _Scheduler_priority_SMP_Update_priority, \
87    _Scheduler_default_Map_priority, \
88    _Scheduler_default_Unmap_priority, \
89    _Scheduler_priority_SMP_Ask_for_help, \
90    _Scheduler_priority_SMP_Node_initialize, \
91    _Scheduler_default_Node_destroy, \
92    _Scheduler_default_Release_job, \
93    _Scheduler_default_Tick, \
94    _Scheduler_SMP_Start_idle \
95    SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
96  }
97
98void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler );
99
100void _Scheduler_priority_SMP_Node_initialize(
101  const Scheduler_Control *scheduler,
102  Thread_Control          *the_thread,
103  Priority_Control         priority
104);
105
106void _Scheduler_priority_SMP_Block(
107  const Scheduler_Control *scheduler,
108  Thread_Control *thread
109);
110
111Thread_Control *_Scheduler_priority_SMP_Unblock(
112  const Scheduler_Control *scheduler,
113  Thread_Control *thread
114);
115
116Thread_Control *_Scheduler_priority_SMP_Update_priority(
117  const Scheduler_Control *scheduler,
118  Thread_Control          *the_thread
119);
120
121Thread_Control *_Scheduler_priority_SMP_Ask_for_help(
122  const Scheduler_Control *scheduler,
123  Thread_Control          *needs_help,
124  Thread_Control          *offers_help
125);
126
127Thread_Control *_Scheduler_priority_SMP_Yield(
128  const Scheduler_Control *scheduler,
129  Thread_Control *thread
130);
131
132/** @} */
133
134#ifdef __cplusplus
135}
136#endif /* __cplusplus */
137
138#endif /* _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H */
Note: See TracBrowser for help on using the repository browser.