]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blob - frsh_configuration_parameters.h
Moving frsh_os_compatibility.h to the src directory, placing the
[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  * @defgroup config Configuration Parameters
78  *
79  * Here we define global parameters that will have an important
80  * influence on FRSH behaviour.  They must also be coherent with the
81  * respective values in the underlaying OS.
82  *
83  * @{
84  **/
85
86
87 /**
88  * This symbol specifies whether the scheduler will make a
89  * schedulability test of the requested contract or not
90  **/
91 #define FRSH_ADMISSION_TEST_IS_ENABLED        true
92
93
94 /**
95  * @defgroup internal lists size for memory optimization
96  * @ingroup config
97  *
98  * Tune these values for optimizing the amount of memory used by the
99  * implementation
100  *
101  * @{
102  **/
103
104 /** Maximum number of accepted contracts (vres) **/
105 #define FRSH_MAX_N_VRES                    125 
106
107
108 /** Maximum number of threads that may be scheduled by the framework **/
109 #define FRSH_MAX_N_THREADS                    25
110
111
112 /**
113  * Maximum number of critical sections that can be stored in a
114  * contract parameters object
115  **/
116 #define FRSH_MAX_N_CRITICAL_SECTIONS          25
117
118 /**
119  * Maximum number of memory areas that can be specified for a
120  * wite operation in a critical section
121  **/
122 #define FRSH_MAX_N_MEMORY_AREAS               4
123
124 /**
125  * Maximum number of utilization values (pairs of budget and period)
126  * that can be stored in a contract parameters object
127  **/
128 #define FRSH_MAX_N_UTILIZATION_VALUES         5
129
130
131 /**
132  * Maximum number of synchronization objects
133  **/
134 #define FRSH_MAX_N_SYNCH_OBJECTS              5
135
136
137 /** Maximum number of shared objects **/
138 #define FRSH_MAX_N_SHARED_OBJECTS             100
139
140 /*@}*/
141
142 /**
143  * @defgroup schedandservice Scheduler and Service thread parameters
144  * @ingroup config
145  *
146  * The current implementation in MaRTE OS uses the Application-Defined
147  * Scheduling Interface (proposed to the POSIX standardization
148  * committee), to create a fixed-priority-based scheduler that
149  * operates under the rules of the FIRST scheduling framework.
150  *
151  * In this implementation there are two special threads:
152  *   - The application scheduler thread, that 
153  *     implements the scheduler
154  *
155  *   - The service thread, that is in charge of 
156  *     negotiating and renegotiating contracts 
157  *     concurrently with the application
158  *
159  * The following symbols are necessary to adapt the application to the
160  * underlying fixed priority scheduler
161  *
162  * @{
163  **/
164
165 /**
166  * Priority assigned to the application scheduler; it should be above
167  * the priorities of the application threads and of the service
168  * thread, and it should be at least 1 level below the maximum of the
169  *  system
170  **/
171 #define FRSH_SCHEDULER_PRIORITY               29   //104 
172
173 /**
174  * Real-time signal number reserved for the application scheduler to
175  * manage its timers.
176  **/
177 #define FRSH_SCHEDULER_SIGNAL                 SIGRTMIN
178
179
180 /**
181  * The highest priority that can be assigned to an application thread,
182  * it should be defined as one level less than the
183  * FRSH_SCHEDULER_PRIORITY
184  **/
185 #define FRSH_HIGHEST_THREAD_PRIORITY  FRSH_SCHEDULER_PRIORITY-1
186
187
188 /**
189  * The lowest priority that can be assigned to an application thread,
190  * it should be at least 1 level above the minimum of the system
191  **/
192 #define FRSH_LOWEST_THREAD_PRIORITY           3
193
194 /**
195  * Each call to the functions that negotiate or renegotiate a contract
196  * or that change the quality and importance generates a request for
197  * the service thread that we call a service job.  This job will be
198  * pending in a queue until executed by the service thread.  The
199  * following symbol represents the maximum number of requests that can
200  * be simultaneously queued.
201  **/
202 #define FRSH_MAX_N_SERVICE_JOBS  FRSH_MAX_N_VRES * 2
203
204
205 /**
206  * In order to bound the background activity of the scheduler (i.e.,
207  * the admission tests necessary for the negotiation and
208  * re-negotiation of contracts), a service thread has been defined. It
209  * runs at a given priority level and has a budget and period
210  * assigned.
211  *
212  **/
213
214 /** Initial period of the service thread (timespec) **/
215 #define FRSH_SERVICE_THREAD_PERIOD  {0,10000000}  //    0.01 seg   
216                                 // {0,100000000}  //0.1 seg  
217                                 // {0,10000000}   //3.1 0.01
218
219 /** Initial budget of the service thread (timespec) **/
220 #define FRSH_SERVICE_THREAD_BUDGET  {0,1000000}   //     0.001 seg 
221                                 // {0,10000000}   //0.01 seg 
222                                 // {0,1000000}    //3.1 0.001 
223
224
225 /**
226  * Initial priority of the service thread, it has to be lower than the
227  * FRSH_SCHEDULER_PRIORITY, and is set according to its period and the
228  * expected response times for reconfiguration or tunning of the
229  * system.
230  **/
231 #define FRSH_SERVICE_THREAD_PRIORITY          FRSH_LOWEST_THREAD_PRIORITY+1 //3 3    //3 1
232
233
234 /*@}*/
235
236
237 /**
238  * @defgroup miscconfig Miscellaneous Config parameters
239  * @ingroup config
240  *
241  * @{
242  **/
243
244 /**
245  * Maximum number of vres that can be simultaneusly waiting for
246  * being signaled in a synchronization object
247  **/
248 #define FRSH_MAX_N_VRES_IN_SYNCH_OBJECT    4
249
250
251 /**
252  * Maximum number of events that can be pending to be signaled in a
253  * synchronization object
254  **/
255 #define FRSH_MAX_N_EVENTS_IN_SYNCH_OBJECT    100  
256
257 /**
258  * Maximum number of pending replenishments in each sporadic server
259  **/
260 #define FRSH_MAX_N_PENDING_REPLENISHMENTS     25   //250
261
262
263 /**
264  * Maximum number of target windows in a table driven schedule
265  **/
266 #define FRSH_MAX_N_TARGET_WINDOWS             100
267
268 /**
269  * The cpu time given by the round robin scheduler 
270  * to the threads in the background (timespec)
271  **/
272 #define FRSH_RR_SLICE_CPU_TIME               {0,100000000}  //3  0.1 sec
273
274 /**
275  * This function must be supplied by the user to map the preemption
276  * level values given in the contracts for the vres, to priority
277  * values in the range that is allowed by the present implementation
278  * for application threads. The value returned by the function must
279  * fit in the interval defined by the constants:
280  * [FRSH_LOWEST_THREAD_PRIORITY, FRSH_HIGHEST_THREAD_PRIORITY]
281  **/
282 int frsh_priority_map (unsigned long plevel);
283
284 /**
285  * This symbol specifies the maximum number of chars that are stored
286  * of a given shared_object_id, so this is the maximum length used
287  * in comparissons
288  **/
289 #define FRSH_MAX_SIZE_SHARED_OBJ_ID           65
290
291
292 /** Maximum number of networks accesible from a node **/
293 #define FRSH_MAX_N_NETWORK_IDS                1
294
295 /**
296  * Maximum number of vres that can be given in a vres list
297  * to the group negotiation/cancellation primitive
298  **/
299 #define FRSH_MAX_N_VRES_VALUES              10
300
301 /**
302  * Maximum number of contracts that can be given in a contracts list
303  * to the group negotiation/cancellation primitive
304  **/
305 #define FRSH_MAX_N_CONTRACT_VALUES              10
306
307 /*@}*/ 
308
309 /*@}*/ 
310
311 #endif /* _FRSH_CONFIGURATION_PARAMETERS_H_ */
312