1 | /** |
---|
2 | * @file rtems/score/schedulersimplesmp.h |
---|
3 | * |
---|
4 | * This include file contains all the constants and structures associated |
---|
5 | * with the manipulation of threads on a simple-priority-based ready queue. |
---|
6 | * This implementation is SMP-aware and schedules across multiple cores. |
---|
7 | * |
---|
8 | * The implementation relies heavily on the Simple Scheduler and |
---|
9 | * only replaces a few routines from that scheduler. |
---|
10 | */ |
---|
11 | |
---|
12 | /* |
---|
13 | * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). |
---|
14 | * |
---|
15 | * The license and distribution terms for this file may be |
---|
16 | * found in the file LICENSE in this distribution or at |
---|
17 | * http://www.rtems.com/license/LICENSE. |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_SMP_H |
---|
21 | #define _RTEMS_SCORE_SCHEDULERSIMPLE_SMP_H |
---|
22 | |
---|
23 | /** |
---|
24 | * @addtogroup ScoreScheduler |
---|
25 | * |
---|
26 | * The Simple SMP Scheduler attempts to faithfully implement the |
---|
27 | * behaviour of the Deterministic Priority Scheduler while spreading |
---|
28 | * the threads across multiple cores. It takes into account thread |
---|
29 | * priority, preemption, and how long a thread has been executing |
---|
30 | * on a core as factors. From an implementation perspective, it |
---|
31 | * relies heavily on the Simple Priority Scheduler. |
---|
32 | */ |
---|
33 | /**@{*/ |
---|
34 | |
---|
35 | #ifdef __cplusplus |
---|
36 | extern "C" { |
---|
37 | #endif |
---|
38 | |
---|
39 | #include <rtems/score/scheduler.h> |
---|
40 | #include <rtems/score/schedulersimple.h> |
---|
41 | #include <rtems/score/schedulerpriority.h> |
---|
42 | |
---|
43 | /** |
---|
44 | * Entry points for Scheduler Simple SMP |
---|
45 | */ |
---|
46 | #define SCHEDULER_SIMPLE_SMP_ENTRY_POINTS \ |
---|
47 | { \ |
---|
48 | _Scheduler_simple_Initialize, /* initialize entry point */ \ |
---|
49 | _Scheduler_simple_smp_Schedule, /* schedule entry point */ \ |
---|
50 | _Scheduler_simple_Yield, /* yield entry point */ \ |
---|
51 | _Scheduler_simple_smp_Block, /* block entry point */ \ |
---|
52 | _Scheduler_simple_smp_Unblock, /* unblock entry point */ \ |
---|
53 | _Scheduler_simple_Allocate, /* allocate entry point */ \ |
---|
54 | _Scheduler_simple_Free, /* free entry point */ \ |
---|
55 | _Scheduler_simple_Update, /* update entry point */ \ |
---|
56 | _Scheduler_simple_Enqueue, /* enqueue entry point */ \ |
---|
57 | _Scheduler_simple_Enqueue_first, /* enqueue_first entry point */ \ |
---|
58 | _Scheduler_simple_Extract, /* extract entry point */ \ |
---|
59 | _Scheduler_priority_Priority_compare, /* compares two priorities */ \ |
---|
60 | _Scheduler_priority_Release_job, /* new period of task */ \ |
---|
61 | _Scheduler_simple_smp_Tick /* tick entry point */ \ |
---|
62 | } |
---|
63 | |
---|
64 | /** |
---|
65 | * @brief Scheduler Simple SMP Schedule Method |
---|
66 | * |
---|
67 | * This routine allocates ready threads to individual cores in an SMP |
---|
68 | * system. If the allocation results in a new heir which requires |
---|
69 | * a dispatch, then the dispatch needed flag for that core is set. |
---|
70 | */ |
---|
71 | void _Scheduler_simple_smp_Schedule( void ); |
---|
72 | |
---|
73 | /** |
---|
74 | * @brief Scheduler Simple SMP Block Method |
---|
75 | * |
---|
76 | * This routine removes @a the_thread from the scheduling decision, |
---|
77 | * that is, removes it from the ready queue. It performs |
---|
78 | * any necessary scheduling operations including the selection of |
---|
79 | * a new heir thread. |
---|
80 | * |
---|
81 | * @param[in] the_thread is the thread that is to be blocked |
---|
82 | */ |
---|
83 | void _Scheduler_simple_smp_Block( |
---|
84 | Thread_Control *the_thread |
---|
85 | ); |
---|
86 | |
---|
87 | /** |
---|
88 | * @brief Scheduler Simple SMP Unblock Method |
---|
89 | * |
---|
90 | * This routine adds @a the_thread to the scheduling decision, |
---|
91 | * that is, adds it to the ready queue and updates any appropriate |
---|
92 | * scheduling variables, for example the heir thread. |
---|
93 | * |
---|
94 | * @param[in] the_thread is the thread that is to be unblocked |
---|
95 | */ |
---|
96 | void _Scheduler_simple_smp_Unblock( |
---|
97 | Thread_Control *the_thread |
---|
98 | ); |
---|
99 | |
---|
100 | /** |
---|
101 | * @brief Scheduler Simple SMP Tick Method |
---|
102 | * |
---|
103 | * This routine is invoked as part of processing each clock tick. |
---|
104 | * It is responsible for determining if the current thread allows |
---|
105 | * timeslicing and, if so, when its timeslice expires. |
---|
106 | */ |
---|
107 | void _Scheduler_simple_smp_Tick( void ); |
---|
108 | |
---|
109 | #ifdef __cplusplus |
---|
110 | } |
---|
111 | #endif |
---|
112 | |
---|
113 | /**@}*/ |
---|
114 | |
---|
115 | #endif |
---|
116 | /* end of include file */ |
---|