Changeset c6522a65 in rtems


Ignore:
Timestamp:
May 12, 2014, 6:38:38 AM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
e9ee2f0
Parents:
beab7329
git-author:
Sebastian Huber <sebastian.huber@…> (05/12/14 06:38:38)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/14/14 12:46:20)
Message:

score: SMP scheduler documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/schedulersmpimpl.h

    rbeab7329 rc6522a65  
    3535/**
    3636 * @addtogroup ScoreSchedulerSMP
     37 *
     38 * The scheduler nodes can be in four states
     39 * - @ref SCHEDULER_SMP_NODE_BLOCKED,
     40 * - @ref SCHEDULER_SMP_NODE_SCHEDULED,
     41 * - @ref SCHEDULER_SMP_NODE_READY, and
     42 * - @ref SCHEDULER_SMP_NODE_IN_THE_AIR.
     43 *
     44 * State transitions are triggered via basic three operations
     45 * - _Scheduler_SMP_Enqueue_ordered(),
     46 * - _Scheduler_SMP_Extract(), and
     47 * - _Scheduler_SMP_Schedule().
     48 *
     49 * @dot
     50 * digraph {
     51 *   node [style="filled"];
     52 *
     53 *   bs [label="BLOCKED"];
     54 *   ss [label="SCHEDULED", fillcolor="green"];
     55 *   rs [label="READY", fillcolor="red"];
     56 *   as [label="IN THE AIR", fillcolor="orange"];
     57 *
     58 *   edge [label="enqueue"];
     59 *   edge [fontcolor="darkgreen", color="darkgreen"];
     60 *
     61 *   bs -> ss;
     62 *   as -> ss;
     63 *
     64 *   edge [label="enqueue"];
     65 *   edge [fontcolor="red", color="red"];
     66 *
     67 *   bs -> rs;
     68 *   as -> rs;
     69 *
     70 *   edge [label="enqueue other"];
     71 *
     72 *   ss -> rs;
     73 *
     74 *   edge [label="schedule"];
     75 *   edge [fontcolor="black", color="black"];
     76 *
     77 *   as -> bs;
     78 *
     79 *   edge [label="extract"];
     80 *   edge [fontcolor="brown", color="brown"];
     81 *
     82 *   ss -> as;
     83 *
     84 *   edge [fontcolor="black", color="black"];
     85 *
     86 *   rs -> bs;
     87 *
     88 *   edge [label="enqueue other\nschedule other"];
     89 *   edge [fontcolor="darkgreen", color="darkgreen"];
     90 *
     91 *   rs -> ss;
     92 * }
     93 * @enddot
     94 *
     95 * During system initialization each processor of the scheduler instance starts
     96 * with an idle thread assigned to it.  Lets have a look at an example with two
     97 * idle threads I and J with priority 5.  We also have blocked threads A, B and
     98 * C with priorities 1, 2 and 3 respectively.
     99 *
     100 * @dot
     101 * digraph {
     102 *   node [style="filled"];
     103 *   edge [dir="none"];
     104 *   subgraph {
     105 *     rank = same;
     106 *
     107 *     i [label="I (5)", fillcolor="green"];
     108 *     j [label="J (5)", fillcolor="green"];
     109 *     a [label="A (1)"];
     110 *     b [label="B (2)"];
     111 *     c [label="C (3)"];
     112 *     i -> j;
     113 *   }
     114 *
     115 *   subgraph {
     116 *     rank = same;
     117 *
     118 *     p0 [label="PROCESSOR 0", shape="box"];
     119 *     p1 [label="PROCESSOR 1", shape="box"];
     120 *   }
     121 *
     122 *   i -> p0;
     123 *   j -> p1;
     124 * }
     125 * @enddot
     126 *
     127 * Lets start A.  For this an enqueue operation is performed.
     128 *
     129 * @dot
     130 * digraph {
     131 *   node [style="filled"];
     132 *   edge [dir="none"];
     133 *
     134 *   subgraph {
     135 *     rank = same;
     136 *
     137 *     i [label="I (5)", fillcolor="green"];
     138 *     j [label="J (5)", fillcolor="red"];
     139 *     a [label="A (1)", fillcolor="green"];
     140 *     b [label="B (2)"];
     141 *     c [label="C (3)"];
     142 *     a -> i;
     143 *   }
     144 *
     145 *   subgraph {
     146 *     rank = same;
     147 *
     148 *     p0 [label="PROCESSOR 0", shape="box"];
     149 *     p1 [label="PROCESSOR 1", shape="box"];
     150 *   }
     151 *
     152 *   i -> p0;
     153 *   a -> p1;
     154 * }
     155 * @enddot
     156 *
     157 * Lets start C.
     158 *
     159 * @dot
     160 * digraph {
     161 *   node [style="filled"];
     162 *   edge [dir="none"];
     163 *
     164 *   subgraph {
     165 *     rank = same;
     166 *
     167 *     a [label="A (1)", fillcolor="green"];
     168 *     c [label="C (3)", fillcolor="green"];
     169 *     i [label="I (5)", fillcolor="red"];
     170 *     j [label="J (5)", fillcolor="red"];
     171 *     b [label="B (2)"];
     172 *     a -> c;
     173 *     i -> j;
     174 *   }
     175 *
     176 *   subgraph {
     177 *     rank = same;
     178 *
     179 *     p0 [label="PROCESSOR 0", shape="box"];
     180 *     p1 [label="PROCESSOR 1", shape="box"];
     181 *   }
     182 *
     183 *   c -> p0;
     184 *   a -> p1;
     185 * }
     186 * @enddot
     187 *
     188 * Lets start B.
     189 *
     190 * @dot
     191 * digraph {
     192 *   node [style="filled"];
     193 *   edge [dir="none"];
     194 *
     195 *   subgraph {
     196 *     rank = same;
     197 *
     198 *     a [label="A (1)", fillcolor="green"];
     199 *     b [label="B (2)", fillcolor="green"];
     200 *     c [label="C (3)", fillcolor="red"];
     201 *     i [label="I (5)", fillcolor="red"];
     202 *     j [label="J (5)", fillcolor="red"];
     203 *     a -> b;
     204 *     c -> i -> j;
     205 *   }
     206 *
     207 *   subgraph {
     208 *     rank = same;
     209 *
     210 *     p0 [label="PROCESSOR 0", shape="box"];
     211 *     p1 [label="PROCESSOR 1", shape="box"];
     212 *   }
     213 *
     214 *   b -> p0;
     215 *   a -> p1;
     216 * }
     217 * @enddot
     218 *
     219 * Lets do something with A.  This can be a blocking operation or a priority
     220 * change.  For this an extract operation is performed first.
     221 *
     222 * @dot
     223 * digraph {
     224 *   node [style="filled"];
     225 *   edge [dir="none"];
     226 *
     227 *   subgraph {
     228 *     rank = same;
     229 *
     230 *     b [label="B (2)", fillcolor="green"];
     231 *     a [label="A (1)", fillcolor="orange"];
     232 *     c [label="C (3)", fillcolor="red"];
     233 *     i [label="I (5)", fillcolor="red"];
     234 *     j [label="J (5)", fillcolor="red"];
     235 *     c -> i -> j;
     236 *   }
     237 *
     238 *   subgraph {
     239 *     rank = same;
     240 *
     241 *     p0 [label="PROCESSOR 0", shape="box"];
     242 *     p1 [label="PROCESSOR 1", shape="box"];
     243 *   }
     244 *
     245 *   b -> p0;
     246 *   a -> p1;
     247 * }
     248 * @enddot
     249 *
     250 * Lets change the priority of thread A to 4 and enqueue it.
     251 *
     252 * @dot
     253 * digraph {
     254 *   node [style="filled"];
     255 *   edge [dir="none"];
     256 *
     257 *   subgraph {
     258 *     rank = same;
     259 *
     260 *     b [label="B (2)", fillcolor="green"];
     261 *     c [label="C (3)", fillcolor="green"];
     262 *     a [label="A (4)", fillcolor="red"];
     263 *     i [label="I (5)", fillcolor="red"];
     264 *     j [label="J (5)", fillcolor="red"];
     265 *     b -> c;
     266 *     a -> i -> j;
     267 *   }
     268 *
     269 *   subgraph {
     270 *     rank = same;
     271 *
     272 *     p0 [label="PROCESSOR 0", shape="box"];
     273 *     p1 [label="PROCESSOR 1", shape="box"];
     274 *   }
     275 *
     276 *   b -> p0;
     277 *   c -> p1;
     278 * }
     279 * @enddot
     280 *
     281 * Alternatively we can also do a blocking operation with thread A.  In this
     282 * case schedule will be called.
     283 *
     284 * @dot
     285 * digraph {
     286 *   node [style="filled"];
     287 *   edge [dir="none"];
     288 *
     289 *   subgraph {
     290 *     rank = same;
     291 *
     292 *     b [label="B (2)", fillcolor="green"];
     293 *     c [label="C (3)", fillcolor="green"];
     294 *     i [label="I (5)", fillcolor="red"];
     295 *     j [label="J (5)", fillcolor="red"];
     296 *     a [label="A (1)"];
     297 *     b -> c;
     298 *     i -> j;
     299 *   }
     300 *
     301 *   subgraph {
     302 *     rank = same;
     303 *
     304 *     p0 [label="PROCESSOR 0", shape="box"];
     305 *     p1 [label="PROCESSOR 1", shape="box"];
     306 *   }
     307 *
     308 *   b -> p0;
     309 *   c -> p1;
     310 * }
     311 * @enddot
    37312 *
    38313 * @{
     
    181456}
    182457
     458/**
     459 * @brief Enqueues a thread according to the specified order function.
     460 *
     461 * @param[in] context The scheduler instance context.
     462 * @param[in] thread The thread to enqueue.
     463 * @param[in] order The order function.
     464 * @param[in] get_highest_ready Function to get the highest ready node.
     465 * @param[in] insert_ready Function to insert a node into the set of ready
     466 * nodes.
     467 * @param[in] insert_scheduled Function to insert a node into the set of
     468 * scheduled nodes.
     469 * @param[in] move_from_ready_to_scheduled Function to move a node from the set
     470 * of ready nodes to the set of scheduled nodes.
     471 * @param[in] move_from_scheduled_to_ready Function to move a node from the set
     472 * of scheduled nodes to the set of ready nodes.
     473 */
    183474static inline void _Scheduler_SMP_Enqueue_ordered(
    184475  Scheduler_SMP_Context *self,
     
    257548}
    258549
     550/**
     551 * @brief Finalize a scheduling operation.
     552 *
     553 * @param[in] context The scheduler instance context.
     554 * @param[in] thread The thread of the scheduling operation.
     555 * @param[in] get_highest_ready Function to get the highest ready node.
     556 * @param[in] move_from_ready_to_scheduled Function to move a node from the set
     557 * of ready nodes to the set of scheduled nodes.
     558 */
    259559static inline void _Scheduler_SMP_Schedule(
    260560  Scheduler_SMP_Context *self,
     
    296596}
    297597
     598/**
     599 * @brief Extracts a thread from the set of scheduled or ready nodes.
     600 *
     601 * @param[in] context The scheduler instance context.
     602 * @param[in] thread The thread to extract.
     603 * @param[in] extract Function to extract a node from the set of scheduled or
     604 * ready nodes.
     605 */
    298606static inline void _Scheduler_SMP_Extract(
    299607  Scheduler_SMP_Context *self,
Note: See TracChangeset for help on using the changeset viewer.