source: rtems/cpukit/score/src/schedulersmpdebug.c @ bbd6d27a

5
Last change on this file since bbd6d27a was 5c3d250, checked in by Sebastian Huber <sebastian.huber@…>, on 07/04/14 at 12:34:23

score: Implement scheduler helping protocol

The following scheduler operations return a thread in need for help

  • unblock,
  • change priority, and
  • yield.

A thread in need for help is a thread that encounters a scheduler state
change from scheduled to ready or a thread that cannot be scheduled in
an unblock operation. Such a thread can ask threads which depend on
resources owned by this thread for help.

Add a new ask for help scheduler operation. This operation is used by
_Scheduler_Ask_for_help() to help threads in need for help returned by
the operations mentioned above. This operation is also used by
_Scheduler_Thread_change_resource_root() in case the root of a resource
sub-tree changes. A use case is the ownership change of a resource.

In case it is not possible to schedule a thread in need for help, then
the corresponding scheduler node will be placed into the set of ready
scheduler nodes of the scheduler instance. Once a state change from
ready to scheduled happens for this scheduler node it may be used to
schedule the thread in need for help.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreScheduler
5 *
6 * @brief Scheduler SMP Debug Implementation
7 */
8
9/*
10 * Copyright (c) 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#if HAVE_CONFIG_H
24  #include "config.h"
25#endif
26
27#include <rtems/score/schedulerimpl.h>
28#include <rtems/score/schedulerpriorityimpl.h>
29
30#if defined(RTEMS_DEBUG)
31
32/*
33 * Table with all valid state transitions for _Scheduler_Thread_change_state()
34 * in case RTEMS_DEBUG is defined.
35 */
36const bool _Scheduler_Thread_state_valid_state_changes[ 3 ][ 3 ] = {
37  /* FROM / TO       BLOCKED SCHEDULED READY */
38  /* BLOCKED    */ { false,  true,     true },
39  /* SCHEDULED  */ { true,   false,    true },
40  /* READY      */ { true,   true,     true }
41};
42
43/*
44 * Table with all valid state transitions for
45 * _Scheduler_SMP_Node_change_state() in case RTEMS_DEBUG is defined.
46 */
47const bool _Scheduler_SMP_Node_valid_state_changes[ 3 ][ 3 ] = {
48  /* FROM / TO       BLOCKED SCHEDULED READY */
49  /* BLOCKED    */ { false,  true,     true },
50  /* SCHEDULED  */ { true,   false,    true },
51  /* READY      */ { true,   true,     false }
52};
53
54#endif
Note: See TracBrowser for help on using the repository browser.