Rev 881 | Rev 909 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
881 | trimarchi | 1 | //fsf_configuration_parameters.h |
2 | //=============================================================== |
||
3 | // FFFFFFIII RRRRR SSTTTTTTT |
||
4 | // FF IIR RR SS |
||
5 | // FF IR SS |
||
6 | // FFFFFF RRRR SSSSST |
||
7 | // FF FI RRR SS |
||
8 | // FF II RRR SS |
||
9 | // FF IIIIIR RS |
||
10 | // |
||
11 | // Basic FSF(FIRST Scheduling Framework) configuration parameters |
||
12 | //============================================================== |
||
13 | |||
14 | ////////////////////////////////////////////////////// |
||
15 | // Definitions required to configure the fsf |
||
16 | // scheduling algorithms. |
||
17 | |||
889 | trimarchi | 18 | #include <unistd.h> |
19 | #include "stdbool.h" |
||
881 | trimarchi | 20 | |
21 | #ifndef _FSF_CONFIGURATION_PARAMETERS_H_ |
||
22 | #define _FSF_CONFIGURATION_PARAMETERS_H_ |
||
23 | |||
24 | // This symbol specifies whether the scheduler will make a |
||
25 | // schedulability test of the requested contract or not |
||
26 | |||
27 | #define FSF_ADMISSION_TEST_IS_ENABLED true |
||
28 | |||
29 | |||
30 | // Tune these values for optimizing the amount of memory used by the |
||
31 | // implementation |
||
32 | |||
33 | // Maximum number of accepted contracts (servers) |
||
34 | |||
35 | #define FSF_MAX_N_SERVERS 10 |
||
36 | |||
37 | |||
38 | // Maximum number of threads that may be scheduled by the framework |
||
39 | |||
40 | #define FSF_MAX_N_THREADS 11 |
||
41 | |||
42 | |||
43 | // Maximum number of critical sections that can be stored in a |
||
44 | // contract parameters object |
||
45 | |||
46 | #define FSF_MAX_N_CRITICAL_SECTIONS 10 |
||
47 | |||
48 | |||
49 | // Maximum number of utilization values (pairs of budget and period) |
||
50 | // that can be stored in a contract parameters object |
||
51 | |||
52 | #define FSF_MAX_N_UTILIZATION_VALUES 5 |
||
53 | |||
54 | |||
55 | // Maximum number of synchronization objects |
||
56 | |||
57 | #define FSF_MAX_N_SYNCH_OBJECTS 5 |
||
58 | |||
59 | |||
60 | // Maximum number of shared objects |
||
61 | |||
62 | #define FSF_MAX_N_SHARED_OBJECTS 100 |
||
63 | |||
64 | |||
65 | //////////////////////////////////////////// |
||
66 | // Other implementation dependent parameters |
||
67 | |||
68 | // The current implementation in MaRTE OS uses the Application-Defined |
||
69 | // Scheduling Interface (proposed to the POSIX standardization |
||
70 | // committee), to create a fixed-priority-based scheduler that |
||
71 | // operates under the rules of the FIRST scheduling framework. |
||
72 | |||
73 | // In this implementation there are two special threads: |
||
74 | // - The application scheduler thread, that |
||
75 | // implements the scheduler |
||
76 | |||
77 | // - The service thread, that is in charge of |
||
78 | // negotiating and renegotiating contracts |
||
79 | // concurrently with the application |
||
80 | |||
81 | // The following symbols are necessary to adapt the application to the |
||
82 | // underlying fixed priority scheduler |
||
83 | |||
84 | // Priority assigned to the application scheduler; it should be above |
||
85 | // the priorities of the application threads and of the service |
||
86 | // thread, and it should be at least 1 level below the maximum of the |
||
87 | // system |
||
88 | |||
89 | #define FSF_SCHEDULER_PRIORITY 30 |
||
90 | |||
91 | |||
92 | // Real-time signal number reserved for the application scheduler to |
||
93 | // manage its timers. |
||
94 | |||
95 | #define FSF_SCHEDULER_SIGNAL SIGRTMIN |
||
96 | |||
97 | |||
98 | // The highest priority that can be assigned to an application thread, |
||
99 | // it should be defined as one level less than the |
||
100 | // FSF_SCHEDULER_PRIORITY |
||
101 | |||
102 | #define FSF_HIGHEST_THREAD_PRIORITY FSF_SCHEDULER_PRIORITY-1 |
||
103 | |||
104 | |||
105 | // The lowest priority that can be assigned to an application thread, |
||
106 | // it should be at least 1 level above the minimum of the system |
||
107 | |||
108 | #define FSF_LOWEST_THREAD_PRIORITY 2 |
||
109 | |||
110 | // Each call to the functions that negotiate or renegotiate a contract |
||
111 | // or that change the quality and importance generates a request for |
||
112 | // the service thread that we call a service job. This job will be |
||
113 | // pending in a queue until executed by the service thread. The |
||
114 | // following symbol represents the maximum number of requests that can |
||
115 | // be simultaneously queued. |
||
116 | #define FSF_MAX_N_SERVICE_JOBS FSF_MAX_N_SERVERS * 2 |
||
117 | |||
118 | // In order to bound the background activity of the scheduler (i.e., |
||
119 | // the admission tests necessary for the negotiation and |
||
120 | // re-negotiation of contracts), a service thread has been defined. It |
||
121 | // runs at a given priority level and has a budget and period |
||
122 | // assigned. |
||
123 | |||
124 | |||
125 | // Initial period of the service thread (timespec) |
||
126 | |||
127 | #define FSF_SERVICE_THREAD_PERIOD {0,100000000} //0.1 seg |
||
128 | |||
129 | |||
130 | // Initial budget of the service thread (timespec) |
||
131 | |||
132 | #define FSF_SERVICE_THREAD_BUDGET {0,10000000} //0.01 seg |
||
133 | |||
134 | |||
135 | // Initial priority of the service thread, it has to be lower than the |
||
136 | // FSF_SCHEDULER_PRIORITY, and is set according to its period and the |
||
137 | // expected response times for reconfiguration or tunning of the |
||
138 | // system. |
||
139 | |||
140 | #define FSF_SERVICE_THREAD_PRIORITY 1 |
||
141 | |||
142 | |||
143 | // Numeric identifier of the service thread, used for tracing |
||
144 | |||
145 | #define FSF_SERVICE_THREAD_IDNAME 0x55555555 |
||
146 | |||
147 | |||
148 | //Maximum number of servers that can be simultaneusly waiting for |
||
149 | //being signaled in a synchronization object |
||
150 | |||
151 | #define FSF_MAX_N_SERVERS_IN_SYNCH_OBJECT 4 |
||
152 | |||
153 | |||
154 | //Maximum number of events that can be pending to be signaled in a |
||
155 | //synchronization object |
||
156 | |||
157 | #define FSF_MAX_N_EVENTS_IN_SYNCH_OBJECT 100 |
||
158 | |||
159 | |||
160 | //Maximum number of pending replenishments in each sporadic server |
||
161 | |||
162 | #define FSF_MAX_N_PENDING_REPLENISHMENTS 25 |
||
163 | |||
164 | |||
165 | // This function must be supplied by the user to map the preemption |
||
166 | // level values given in the contracts for the servers, to priority |
||
167 | // values in the range that is allowed by the present implementation |
||
168 | // for application threads. The value returned by the function must |
||
169 | // fit in the interval defined by the constants: |
||
170 | // [FSF_LOWEST_THREAD_PRIORITY, FSF_HIGHEST_THREAD_PRIORITY] |
||
171 | |||
172 | int |
||
173 | fsf_priority_map (unsigned long plevel); |
||
174 | |||
175 | // This symbol specifies whether the scheduling system will make |
||
176 | // traces of the servers, the scheduler and the service thread |
||
177 | // operation and make them available through the fsf_print_traces |
||
178 | // function |
||
179 | |||
180 | #define FSF_TRACING_SERVICE_IS_ENABLED true |
||
181 | |||
182 | |||
183 | #endif /* _FSF_CONFIGURATION_PARAMETERS_H_ */ |