]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blob - frsh_configuration_parameters.h
5dbab0b60b64bc7601dd325592fae1d139b99951
[frescor/frsh-include.git] / frsh_configuration_parameters.h
1 // -----------------------------------------------------------------------
2 //  Copyright (C) 2006 - 2007 FRESCOR consortium partners:
3 //
4 //    Universidad de Cantabria,              SPAIN
5 //    University of York,                    UK
6 //    Scuola Superiore Sant'Anna,            ITALY
7 //    Kaiserslautern University,             GERMANY
8 //    Univ. Politécnica  Valencia,           SPAIN
9 //    Czech Technical University in Prague,  CZECH REPUBLIC
10 //    ENEA                                   SWEDEN
11 //    Thales Communication S.A.              FRANCE
12 //    Visual Tools S.A.                      SPAIN
13 //    Rapita Systems Ltd                     UK
14 //    Evidence                               ITALY
15 //
16 //    See http://www.frescor.org for a link to partners' websites
17 //
18 //           FRESCOR project (FP6/2005/IST/5-034026) is funded
19 //        in part by the European Union Sixth Framework Programme
20 //        The European Union is not liable of any use that may be
21 //        made of this code.
22 //
23 //
24 //  based on previous work (FSF) done in the FIRST project
25 //
26 //   Copyright (C) 2005  Mälardalen University, SWEDEN
27 //                       Scuola Superiore S.Anna, ITALY
28 //                       Universidad de Cantabria, SPAIN
29 //                       University of York, UK
30 //
31 //   FSF API web pages: http://marte.unican.es/fsf/docs
32 //                      http://shark.sssup.it/contrib/first/docs/
33 //
34 //  This file is part of FRSH API
35 //
36 //  FRSH API is free software; you can  redistribute it and/or  modify
37 //  it under the terms of  the GNU General Public License as published by
38 //  the Free Software Foundation;  either  version 2, or (at  your option)
39 //  any later version.
40 //
41 //  FRSH API  is distributed  in  the hope  that  it  will  be useful,  but
42 //  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
43 //  MERCHANTABILITY  or  FITNESS FOR  A  PARTICULAR PURPOSE. See  the  GNU
44 //  General Public License for more details.
45 //
46 //  You should have  received a  copy of  the  GNU  General Public License
47 //  distributed  with  FRSH API;  see file COPYING.   If not,  write to the
48 //  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
49 //  02111-1307, USA.
50 //
51 //  As a special exception, if you include this header file into source
52 //  files to be compiled, this header file does not by itself cause
53 //  the resulting executable to be covered by the GNU General Public
54 //  License.  This exception does not however invalidate any other
55 //  reasons why the executable file might be covered by the GNU General
56 //  Public License.
57 // -----------------------------------------------------------------------
58 //frsh_configuration_parameters.h
59 //==============================================
60 //  ******** *******    ********  **      **
61 //  **///// /**////**  **//////  /**     /**
62 //  **      /**   /** /**        /**     /**
63 //  ******* /*******  /********* /**********
64 //  **////  /**///**  ////////** /**//////**
65 //  **      /**  //**        /** /**     /**
66 //  **      /**   //** ********  /**     /**
67 //  //       //     // ////////   //      //
68 //
69 // FRSH(FRescor ScHeduler), pronounced "fresh"
70 //==============================================
71 #ifndef _FRSH_CONFIGURATION_PARAMETERS_H_
72 #define _FRSH_CONFIGURATION_PARAMETERS_H_
73
74 #include <unistd.h>
75
76 /**
77  * @file frsh_configuration_parameters.h
78  *
79  * This file contains parameters that govern the capabilities of the
80  * FRescor ScHeduler.  They must be in concordance with the respective
81  * OS configuration.
82  **/
83
84
85 /**
86  * @defgroup config Configuration Parameters
87  *
88  * Here we define global parameters that will have an important
89  * influence on FRSH behaviour.  They must also be coherent with the
90  * respective values in the underlaying OS.
91  *
92  * @{
93  **/
94
95
96 /**
97  * This symbol specifies whether the scheduler will make a
98  * schedulability test of the requested contract or not
99  **/
100 #define FRSH_ADMISSION_TEST_IS_ENABLED        true
101
102 /**
103  * This symbol specifies whether the service thread will try to
104  * assign automatically the priorities of each vres
105  **/
106 #define FRSH_AUTOMATIC_PRIO_ASSIGN_ENABLE true
107
108 #define FRSH_DISTRIBUTED_MODULE_SUPPORTED false
109
110
111 /** This defines 1 resource_id value for systems that have only one
112     resource of a kind. **/
113 #define FRSH_RESOURCE_ID_DEFAULT 0
114 #define FRSH_CPU_ID_DEFAULT 0
115 #define FRSH_NETWORK_ID_DEFAULT 0
116
117 /**
118  * @defgroup internal Array size for memory optimization
119  * @ingroup config
120  *
121  * Tune these values for optimizing the amount of memory used by the
122  * implementation
123  *
124  * @{
125  **/
126
127 /** Maximum number of accepted contracts (vres) **/
128 #define FRSH_MAX_N_VRES                    125
129
130
131 /** Maximum number of threads that may be scheduled by the framework **/
132 #define FRSH_MAX_N_THREADS                    25
133
134
135 /**
136  * Maximum number of critical sections that can be stored in a
137  * contract parameters object
138  **/
139 #define FRSH_MAX_N_CRITICAL_SECTIONS          25
140
141 /**
142  * Maximum number of memory areas that can be specified for a
143  * wite operation in a critical section
144  **/
145 #define FRSH_MAX_N_MEMORY_AREAS               4
146
147 /**
148  * Maximum number of utilization values (pairs of budget and period)
149  * that can be stored in a contract parameters object
150  **/
151 #define FRSH_MAX_N_UTILIZATION_VALUES         5
152
153
154 /**
155  * Maximum number of synchronization objects
156  **/
157 #define FRSH_MAX_N_SYNCH_OBJECTS              5
158
159
160 /** Maximum number of shared objects **/
161 #define FRSH_MAX_N_SHARED_OBJECTS             100
162
163 /** Maximum number of send and receive endpoints in a single node **/
164 #define FRSH_MAX_N_ENDPOINTS 10
165
166 /** Maximum number of chars for a contract label **/
167 #define FRSH_CONTRACT_LABEL_MAXLENGTH 15
168
169 /*@}*/
170
171 /**
172  * @defgroup schedandservice Scheduler and Service thread parameters
173  * @ingroup config
174  *
175  * The current implementation in MaRTE OS uses the Application-Defined
176  * Scheduling Interface (proposed to the POSIX standardization
177  * committee), to create a fixed-priority-based scheduler that
178  * operates under the rules of the FIRST scheduling framework.
179  *
180  * In this implementation there are two special threads:
181  *   - The application scheduler thread, that
182  *     implements the scheduler
183  *
184  *   - The service thread, that is in charge of
185  *     negotiating and renegotiating contracts
186  *     concurrently with the application
187  *
188  * The following symbols are necessary to adapt the application to the
189  * underlying fixed priority scheduler
190  *
191  * @{
192  **/
193
194 /**
195  * Priority assigned to the application scheduler; it should be above
196  * the priorities of the application threads and of the service
197  * thread, and it should be at least 1 level below the maximum of the
198  *  system
199  **/
200 #define FRSH_SCHEDULER_PRIORITY       (fosa_get_priority_max() -  FOSA_ADS_SCHEDULER_PRIO_DIFF)
201
202 /**
203  * Real-time signal number reserved for the application scheduler to
204  * manage its timers.
205  **/
206 #define FRSH_SCHEDULER_SIGNAL                 FRSH_SIGNAL_MIN
207
208
209
210 /**
211  * The highest priority that can be assigned to an application thread,
212  * it should be defined as one level less than the
213  * FRSH_SCHEDULER_PRIORITY
214  **/
215 #define FRSH_HIGHEST_THREAD_PRIORITY  (FRSH_SCHEDULER_PRIORITY-1)
216
217
218 /**
219  * The lowest priority that can be assigned to an application thread,
220  * it should be at least 1 level above the minimum of the system
221  **/
222 #define FRSH_LOWEST_THREAD_PRIORITY    ( fosa_get_priority_min() + 4)
223
224 /**
225  * Each call to the functions that negotiate or renegotiate a contract
226  * or that change the quality and importance generates a request for
227  * the service thread that we call a service job.  This job will be
228  * pending in a queue until executed by the service thread.  The
229  * following symbol represents the maximum number of requests that can
230  * be simultaneously queued.
231  **/
232 #define FRSH_MAX_N_SERVICE_JOBS  (FRSH_MAX_N_VRES * 2)
233
234
235 /**
236  * In order to bound the background activity of the scheduler (i.e.,
237  * the admission tests necessary for the negotiation and
238  * re-negotiation of contracts), a service thread has been defined. It
239  * runs at a given priority level and has a budget and period
240  * assigned.
241  *
242  **/
243
244 /** Initial period of the service thread (timespec) **/
245 #define FRSH_SERVICE_THREAD_PERIOD  {5,0}
246
247 /** Initial budget of the service thread (timespec) **/
248 #define FRSH_SERVICE_THREAD_BUDGET  {0,1000000}
249
250 /**
251  * Initial priority of the service thread, it has to be lower than the
252  * FRSH_SCHEDULER_PRIORITY, and is set according to its period and the
253  * expected response times for reconfiguration or tunning of the
254  * system.
255  **/
256 #define FRSH_SERVICE_THREAD_PRIORITY          (FRSH_LOWEST_THREAD_PRIORITY+1) //3 3    //3 1
257
258
259 /*@}*/
260
261
262 /**
263  * @defgroup miscconfig Miscellaneous Config parameters
264  * @ingroup config
265  *
266  * @{
267  **/
268
269 /**
270  * Maximum number of vres that can be simultaneusly waiting for
271  * being signaled in a synchronization object
272  **/
273 #define FRSH_MAX_N_VRES_IN_SYNCH_OBJECT    4
274
275
276 /**
277  * Maximum number of events that can be pending to be signaled in a
278  * synchronization object
279  **/
280 #define FRSH_MAX_N_EVENTS_IN_SYNCH_OBJECT    100
281
282 /**
283  * Maximum number of pending replenishments in each sporadic server
284  **/
285 #define FRSH_MAX_N_PENDING_REPLENISHMENTS     25   //250
286
287
288 /**
289  * Maximum number of target windows in a table driven schedule
290  **/
291 #define FRSH_MAX_N_TARGET_WINDOWS             100
292
293 /**
294  * The cpu time given by the round robin scheduler
295  * to the threads in the background (timespec)
296  **/
297 #define FRSH_RR_SLICE_CPU_TIME               {0,100000000}  //3  0.1 sec
298
299 /**
300  * This function must be supplied by the user to map the preemption
301  * level values given in the contracts for the vres, to priority
302  * values in the range that is allowed by the present implementation
303  * for application threads. The value returned by the function must
304  * fit in the interval defined by the constants:
305  * [FRSH_LOWEST_THREAD_PRIORITY, FRSH_HIGHEST_THREAD_PRIORITY]
306  **/
307 int frsh_priority_map (unsigned long plevel);
308
309 /**
310  * This symbol specifies the maximum number of chars that are stored
311  * of a given shared_object_id, so this is the maximum length used
312  * in comparisons
313  **/
314 #define FRSH_MAX_SIZE_SHARED_OBJ_LABEL           15
315
316
317 /** Maximum number of networks accesible from a node **/
318 #define FRSH_MAX_N_NETWORK_IDS                1
319
320 /**
321  * Maximum number of vres that can be given in a vres list
322  * to the group negotiation/cancellation primitive
323  **/
324 #define FRSH_MAX_N_VRES_VALUES              10
325
326 /**
327  * Maximum number of contracts that can be given in a contracts list
328  * to the group negotiation/cancellation primitive
329  **/
330 #define FRSH_MAX_N_CONTRACT_VALUES              10
331
332 /**
333  * Default overheads of shared object protection mechanisms
334  * These values should be calibrated on each specific execution platform
335  */
336
337 // fixed overhead for saving the environment and subsequently
338 // aborting a critical section; units in nanoseconds
339
340 #define FRSH_SO_FIXED_ABORT_OVHD        0
341
342
343 // fixed overhead for copying a memory area, in nanoseconds
344
345 #define FRSH_SO_FIXED_AREA_OVHD         0
346
347
348 // variable overhead for copying a memory area; units in nanoseconds per kbyte
349
350 #define FRSH_SO_NANOS_PER_KB            0
351
352
353 /*@}*/
354
355 /*@}*/
356
357 #endif /* _FRSH_CONFIGURATION_PARAMETERS_H_ */
358