Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1658 | giacomo | 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 2004-06-01 11:42:47 giacomo Exp $ |
||
25 | |||
26 | File: $File$ |
||
27 | Revision: $Revision: 1.1 $ |
||
28 | Last update: $Date: 2004-06-01 11:42:47 $ |
||
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 | |||
131 | #define STATIC_PCLASS 0x0500 |
||
132 | |||
133 | #define SLSH_LEVELNAME "Slot Shifting" |
||
134 | #define SLSH_LEVEL_CODE 5 |
||
135 | #define SLSH_LEVEL_VERSION 1 |
||
136 | |||
137 | |||
138 | |||
139 | /* ----------------------------------------------------------------------- |
||
140 | STATIC_TASK_MODEL: offline scheduled Tasks |
||
141 | ----------------------------------------------------------------------- */ |
||
142 | /* Offline-scheduled tasks are hard periodic tasks that have been |
||
143 | scheduled before runtime. All guarantees are made by the off- |
||
144 | line scheduler so the tasks are already guaranteed. |
||
145 | */ |
||
146 | |||
147 | typedef struct { |
||
148 | TASK_MODEL t; |
||
149 | TIME est; |
||
150 | TIME wcet; |
||
151 | TIME dabs; |
||
152 | int interval; /* used in slot shifting */ |
||
153 | } STATIC_TASK_MODEL; |
||
154 | |||
155 | #define static_task_default_model(m) \ |
||
156 | task_default_model((m).t,STATIC_PCLASS), \ |
||
157 | (m).est = -1, \ |
||
158 | (m).dabs = 0, \ |
||
159 | (m).wcet = 0, \ |
||
160 | (m).interval = -1; |
||
161 | #define static_task_def_level(m,l) task_def_level((m).t,l) |
||
162 | #define static_task_def_arg(m,a) task_def_arg((m).t,a) |
||
163 | #define static_task_def_stack(m,s) task_def_stack((m).t,s) |
||
164 | #define static_task_def_group(m,g) task_def_group((m).t,g) |
||
165 | #define static_task_def_usemath(m) task_def_usemath((m).t) |
||
166 | #define static_task_def_system(m) task_def_system((m).t) |
||
167 | #define static_task_def_nokill(m) task_def_nokill((m).t) |
||
168 | #define static_task_def_ctrl_jet(m) task_def_ctrl_jet((m).t) |
||
169 | #define static_task_def_est(m,p) (m).est = (p) |
||
170 | #define static_task_def_dabs(m,d) (m).dabs = (d) |
||
171 | #define static_task_def_wcet(m,w) (m).wcet = (w) |
||
172 | #define static_task_def_interval(m,i) (m).interval = (i) |
||
173 | #define static_task_def_trace(m) task_def_trace((m).t) |
||
174 | #define static_task_def_notrace(m) task_def_notrace((m).t) |
||
175 | |||
176 | |||
177 | |||
178 | |||
179 | /*#define min(a, b) ((a) < (b) ? (a) : (b))*/ |
||
180 | |||
181 | #define TIME2TIMESPEC(T, TS) \ |
||
182 | ( \ |
||
183 | ((TS).tv_sec = ((T)/1000000)), \ |
||
184 | ((TS).tv_nsec = (((T)%1000000) * 1000)), \ |
||
185 | (TS) \ |
||
186 | ) |
||
187 | |||
188 | /* define the interval struct */ |
||
189 | typedef struct { |
||
190 | int start; /* start of interval */ |
||
191 | int end; /* end of interval */ |
||
192 | int length; /* Length of interval */ |
||
193 | int maxt; /* maximum execution time in interval */ |
||
194 | int sc; /* spare capacity in interval */ |
||
195 | } SLSH_interval; |
||
196 | |||
197 | /*+ Registration function: */ |
||
198 | LEVEL SLSH_register_level(); |
||
199 | |||
200 | void SLSH_set_interval(LEVEL l, int start, int end, int maxt); |
||
201 | void SLSH_set_variables(LEVEL l, TIME length); |
||
202 | |||
203 | #endif |
||
204 |