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