source: rtems/cpukit/score/src/schedulercbs.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.3 KB
Line 
1/**
2 * @file
3 *
4 * @brief CBS Scheduler Budget Handler
5 * @ingroup ScoreScheduler
6 */
7
8/*
9 *  Copyright (C) 2011 Petr Benes.
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/schedulercbsimpl.h>
22
23void _Scheduler_CBS_Budget_callout(
24  Thread_Control *the_thread
25)
26{
27  Scheduler_CBS_Node      *node;
28  Scheduler_CBS_Server_id  server_id;
29  Thread_queue_Context     queue_context;
30
31  node = _Scheduler_CBS_Thread_get_node( the_thread );
32
33  /* Put violating task to background until the end of period. */
34  _Thread_queue_Context_clear_priority_updates( &queue_context );
35  _Scheduler_CBS_Cancel_job(
36    NULL,
37    the_thread,
38    node->deadline_node,
39    &queue_context
40  );
41  _Thread_Priority_update( &queue_context );
42
43  /* Invoke callback function if any. */
44  if ( node->cbs_server->cbs_budget_overrun ) {
45    _Scheduler_CBS_Get_server_id(
46        node->cbs_server->task_id,
47        &server_id
48    );
49    node->cbs_server->cbs_budget_overrun( server_id );
50  }
51}
52
53int _Scheduler_CBS_Initialize(void)
54{
55  return SCHEDULER_CBS_OK;
56}
Note: See TracBrowser for help on using the repository browser.