Rev 1085 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1085 | pj | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Paolo Gai <pj@gandalf.sssup.it> |
||
10 | * Massimiliano Giorgi <massy@gandalf.sssup.it> |
||
11 | * Luca Abeni <luca@gandalf.sssup.it> |
||
12 | * (see the web pages for full authors list) |
||
13 | * |
||
14 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
15 | * |
||
16 | * http://www.sssup.it |
||
17 | * http://retis.sssup.it |
||
18 | * http://shark.sssup.it |
||
19 | */ |
||
20 | |||
21 | |||
22 | /** |
||
23 | ------------ |
||
24 | CVS : $Id: slsh.h,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $ |
||
25 | |||
26 | File: $File$ |
||
27 | Revision: $Revision: 1.1.1.1 $ |
||
28 | Last update: $Date: 2002-09-02 09:37:41 $ |
||
29 | ------------ |
||
30 | Author: Tomas Lennvall, Date: Feb 2000. |
||
31 | |||
32 | This file contains the scheduling module for Slot shifting. |
||
33 | |||
34 | Title: |
||
35 | Slot Shifting |
||
36 | |||
37 | Task Models Accepted: |
||
38 | STATIC_TASK_MODEL - Periodic Hard tasks that are scheduled by |
||
39 | an off-line scheduler, so that all guarantees regarding precedence, mutex |
||
40 | deadline violation is taken care of. The tasks are in an executione schedule, |
||
41 | that is the order in when they become ready. They have the following fields: |
||
42 | est (earliest start time), wcet and absolute deadline. |
||
43 | |||
44 | HARD_TASK_MODEL - Hard Tasks (Hard aperiodic requests) |
||
45 | wcet field and drel field must be != 0. They are used to set the wcet |
||
46 | and deadline of the tasks. |
||
47 | periodicity field must be APERIODIC |
||
48 | mit field is ignored. |
||
49 | |||
50 | SOFT_TASK_MODEL - Soft Tasks (Unspecified tasks) |
||
51 | wcet field must be != 0. periodicity filed must be APERIODIC |
||
52 | period and met filed is ignored. |
||
53 | |||
54 | Guest Models Accepted: |
||
55 | NONE - Slot shifting handles all tasks by itself (at this moment). |
||
56 | |||
57 | Description: |
||
58 | This module schedules the offline scheduled tasks according to the slot- |
||
59 | shifting paradigm, dividing time into slots of a fixed length and assigning |
||
60 | tasks to execute in those slots. Slot-shifting also keeps track of the free |
||
61 | bandwidth in the schedule by using disjoint intervals and sc (spare capacity). |
||
62 | Each interval has a sc nr that represents the free bandwidth in that interval, |
||
63 | the sc can be used by hard aperiodic tasks, static tasks from later interval or |
||
64 | soft aperiodic tasks. Hard aperiodic tasks are guaranteed an incorporated in |
||
65 | the schedule by reduction of sc before they execute. No guarantee is |
||
66 | performed on the soft aperiodic tasks, they are run when no other task wants |
||
67 | to execute and sc is available. |
||
68 | |||
69 | Description: |
||
70 | This module implements the Slot shifting algorithm, by Gerhard Fohler. Slot shifting |
||
71 | schedules off-line scheduled tasks and also handles hard aperiodic requests by the |
||
72 | guarantee alorithm. Slot shifting can also handle soft aperiodic tasks, |
||
73 | called unspecified. That is tasks without a deadline. |
||
74 | |||
75 | Exceptions raised: |
||
76 | These exceptions are pclass-dependent... |
||
77 | XDEADLINE_MISS |
||
78 | If a task miss his deadline, the exception is raised. |
||
79 | |||
80 | XWCET_VIOLATION |
||
81 | If a task doesn't end the current cycle before if consume the wcet, |
||
82 | an exception is raised, and the task is put in the EDF_WCET_VIOLATED |
||
83 | state. To reactivate it, use EDF_task_activate via task_activate or |
||
84 | manage directly the EDF data structure. Note that the exception is not |
||
85 | handled properly, an XDEADLINE_MISS exeeption will also be raised at |
||
86 | the period end... |
||
87 | |||
88 | Restrictions & special features: |
||
89 | - This level doesn't manage the main task. |
||
90 | - At init time we can choose if the level have to activate |
||
91 | . the wcet check |
||
92 | (If a task require more time than declared, it is stopped and put in |
||
93 | the state EDF_WCET_VIOLATED; a XWCET_VIOLATION exception is raised) |
||
94 | . the task guarantee algorithm |
||
95 | (when all task are created the system will check that the task_set |
||
96 | will not use more than the available bandwidth) |
||
97 | - The level use the priority and timespec_priority fields. |
||
98 | - A function to return the used bandwidth of a level is provided. |
||
99 | - The guest tasks don't provide the guest_endcycle function |
||
100 | |||
101 | **/ |
||
102 | |||
103 | /* |
||
104 | * Copyright (C) 2000 Paolo Gai |
||
105 | * |
||
106 | * This program is free software; you can redistribute it and/or modify |
||
107 | * it under the terms of the GNU General Public License as published by |
||
108 | * the Free Software Foundation; either version 2 of the License, or |
||
109 | * (at your option) any later version. |
||
110 | * |
||
111 | * This program is distributed in the hope that it will be useful, |
||
112 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
113 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
114 | * GNU General Public License for more details. |
||
115 | * |
||
116 | * You should have received a copy of the GNU General Public License |
||
117 | * along with this program; if not, write to the Free Software |
||
118 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
119 | * |
||
120 | */ |
||
121 | |||
122 | |||
123 | #ifndef __SLSH_H__ |
||
124 | #define __SLSH_H__ |
||
125 | |||
126 | #include <ll/ll.h> |
||
127 | #include <kernel/config.h> |
||
128 | #include <sys/types.h> |
||
129 | #include <kernel/types.h> |
||
130 | #include <modules/codes.h> |
||
131 | |||
132 | #define STATIC_PCLASS 0x0500 |
||
133 | |||
134 | #define SLSH_LEVELNAME "Slot Shifting" |
||
135 | #define SLSH_LEVEL_CODE 5 |
||
136 | #define SLSH_LEVEL_VERSION 1 |
||
137 | |||
138 | |||
139 | |||
140 | /* ----------------------------------------------------------------------- |
||
141 | STATIC_TASK_MODEL: offline scheduled Tasks |
||
142 | ----------------------------------------------------------------------- */ |
||
143 | /* Offline-scheduled tasks are hard periodic tasks that have been |
||
144 | scheduled before runtime. All guarantees are made by the off- |
||
145 | line scheduler so the tasks are already guaranteed. |
||
146 | */ |
||
147 | |||
148 | typedef struct { |
||
149 | TASK_MODEL t; |
||
150 | TIME est; |
||
151 | TIME wcet; |
||
152 | TIME dabs; |
||
153 | int interval; /* used in slot shifting */ |
||
154 | } STATIC_TASK_MODEL; |
||
155 | |||
156 | #define static_task_default_model(m) \ |
||
157 | task_default_model((m).t,STATIC_PCLASS), \ |
||
158 | (m).est = -1, \ |
||
159 | (m).dabs = 0, \ |
||
160 | (m).wcet = 0, \ |
||
161 | (m).interval = -1; |
||
162 | #define static_task_def_level(m,l) task_def_level((m).t,l) |
||
163 | #define static_task_def_arg(m,a) task_def_arg((m).t,a) |
||
164 | #define static_task_def_stack(m,s) task_def_stack((m).t,s) |
||
165 | #define static_task_def_group(m,g) task_def_group((m).t,g) |
||
166 | #define static_task_def_usemath(m) task_def_usemath((m).t) |
||
167 | #define static_task_def_system(m) task_def_system((m).t) |
||
168 | #define static_task_def_nokill(m) task_def_nokill((m).t) |
||
169 | #define static_task_def_ctrl_jet(m) task_def_ctrl_jet((m).t) |
||
170 | #define static_task_def_est(m,p) (m).est = (p) |
||
171 | #define static_task_def_dabs(m,d) (m).dabs = (d) |
||
172 | #define static_task_def_wcet(m,w) (m).wcet = (w) |
||
173 | #define static_task_def_interval(m,i) (m).interval = (i) |
||
174 | #define static_task_def_trace(m) task_def_trace((m).t) |
||
175 | #define static_task_def_notrace(m) task_def_notrace((m).t) |
||
176 | |||
177 | |||
178 | |||
179 | |||
180 | /*#define min(a, b) ((a) < (b) ? (a) : (b))*/ |
||
181 | |||
182 | #define TIME2TIMESPEC(T, TS) \ |
||
183 | ( \ |
||
184 | ((TS).tv_sec = ((T)/1000000)), \ |
||
185 | ((TS).tv_nsec = (((T)%1000000) * 1000)), \ |
||
186 | (TS) \ |
||
187 | ) |
||
188 | |||
189 | /* define the interval struct */ |
||
190 | typedef struct { |
||
191 | int start; /* start of interval */ |
||
192 | int end; /* end of interval */ |
||
193 | int length; /* Length of interval */ |
||
194 | int maxt; /* maximum execution time in interval */ |
||
195 | int sc; /* spare capacity in interval */ |
||
196 | } SLSH_interval; |
||
197 | |||
198 | /*+ Registration function: */ |
||
199 | void SLSH_register_level(); |
||
200 | |||
201 | void SLSH_set_interval(LEVEL l, int start, int end, int maxt); |
||
202 | void SLSH_set_variables(LEVEL l, TIME length); |
||
203 | |||
204 | #endif |
||
205 |