Rev 909 | Rev 985 | 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 | |||
972 | trimarchi | 35 | #define FSF_MAX_N_SERVERS 125 |
881 | trimarchi | 36 | |
37 | |||
38 | // Maximum number of threads that may be scheduled by the framework |
||
39 | |||
972 | trimarchi | 40 | #define FSF_MAX_N_THREADS 25 |
881 | trimarchi | 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 | |||
972 | trimarchi | 89 | #define FSF_SCHEDULER_PRIORITY 104 |
881 | trimarchi | 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 | |||
972 | trimarchi | 108 | #define FSF_LOWEST_THREAD_PRIORITY 3 |
881 | trimarchi | 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 | |||
972 | trimarchi | 127 | #define FSF_SERVICE_THREAD_PERIOD {0,10000000} //0.1 seg //3.1 0.01 |
881 | trimarchi | 128 | |
129 | |||
130 | // Initial budget of the service thread (timespec) |
||
131 | |||
972 | trimarchi | 132 | #define FSF_SERVICE_THREAD_BUDGET {0,1000000} //0.01 seg //3.1 0.001 |
881 | trimarchi | 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 | |||
972 | trimarchi | 140 | #define FSF_SERVICE_THREAD_PRIORITY FSF_LOWEST_THREAD_PRIORITY+1 //3 3 //3 1 |
881 | trimarchi | 141 | |
142 | |||
143 | |||
144 | //Maximum number of servers that can be simultaneusly waiting for |
||
145 | //being signaled in a synchronization object |
||
146 | |||
147 | #define FSF_MAX_N_SERVERS_IN_SYNCH_OBJECT 4 |
||
148 | |||
149 | |||
150 | //Maximum number of events that can be pending to be signaled in a |
||
151 | //synchronization object |
||
152 | |||
153 | #define FSF_MAX_N_EVENTS_IN_SYNCH_OBJECT 100 |
||
154 | |||
155 | |||
156 | //Maximum number of pending replenishments in each sporadic server |
||
157 | |||
972 | trimarchi | 158 | #define FSF_MAX_N_PENDING_REPLENISHMENTS 1050 //25 |
881 | trimarchi | 159 | |
160 | |||
972 | trimarchi | 161 | //Maximum number of target windows in a table driven schedule |
162 | |||
163 | #define FSF_MAX_N_TARGET_WINDOWS 100 |
||
164 | |||
165 | //The cpu time given by the round robin scheduler |
||
166 | //to the threads in the background (timespec) |
||
167 | |||
168 | #define FSF_RR_SLICE_CPU_TIME {0,100000000} //3 0.1 sec |
||
169 | |||
881 | trimarchi | 170 | // This function must be supplied by the user to map the preemption |
171 | // level values given in the contracts for the servers, to priority |
||
172 | // values in the range that is allowed by the present implementation |
||
173 | // for application threads. The value returned by the function must |
||
174 | // fit in the interval defined by the constants: |
||
175 | // [FSF_LOWEST_THREAD_PRIORITY, FSF_HIGHEST_THREAD_PRIORITY] |
||
176 | |||
177 | int |
||
178 | fsf_priority_map (unsigned long plevel); |
||
179 | |||
972 | trimarchi | 180 | // This symbol specifies the maximum number of chars that are stored |
181 | // of a given shared_object_id, so this is the maximum length used |
||
182 | // in comparissons |
||
881 | trimarchi | 183 | |
972 | trimarchi | 184 | #define FSF_MAX_SIZE_SHARED_OBJ_ID 65 |
881 | trimarchi | 185 | |
972 | trimarchi | 186 | |
881 | trimarchi | 187 | #endif /* _FSF_CONFIGURATION_PARAMETERS_H_ */ |