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