Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
961 | 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: tbs.h,v 1.1 2005-02-25 10:53:02 pj Exp $ |
||
25 | |||
26 | File: $File$ |
||
27 | Revision: $Revision: 1.1 $ |
||
28 | Last update: $Date: 2005-02-25 10:53:02 $ |
||
29 | ------------ |
||
30 | |||
31 | This file contains the aperiodic server TBS (Total Bandwidth Server) |
||
32 | |||
33 | Title: |
||
34 | TBS (Total Bandwidth Server) |
||
35 | |||
36 | Task Models Accepted: |
||
37 | SOFT_TASK_MODEL - Aperiodic Tasks |
||
38 | wcet field must be != 0 |
||
39 | met field is ignored |
||
40 | period field is ignored |
||
41 | periodicity must be APERIODIC |
||
42 | arrivals can be either SAVE or SKIP |
||
43 | |||
44 | Description: |
||
45 | This module schedule his tasks following the TBS scheme. |
||
46 | Each task has a deadline assigned with the TBS scheme, |
||
47 | |||
48 | wcet |
||
49 | d = max(r , d ) + ---- |
||
50 | k k k-1 Us |
||
51 | |||
52 | The tasks are inserted in an EDF level (or similar) with a JOB_TASK_MODEL, |
||
53 | and the TBS level expects that the task is scheduled with the absolute |
||
54 | deadline passed in the model. |
||
55 | |||
56 | The task guarantee is based on the factor utilization approach. |
||
57 | The theory guarantees that the task set is schedulable if |
||
58 | Up + Us <= 1 |
||
59 | so it is sufficient to add the Us to the bandwidth used by the upper |
||
60 | levels (we suppose that the levels with level number < of the current |
||
61 | can guarantee their task sets basing on the same formula... |
||
62 | |||
63 | All the tasks are put in a FIFO (FCFS) queue and at a time only the first |
||
64 | task in the queue is put in the upper level. |
||
65 | |||
66 | Exceptions raised: |
||
67 | XUNVALID_GUEST |
||
68 | This level doesn't support guests. When a guest operation |
||
69 | is called, the exception is raised. |
||
70 | |||
71 | These exceptions are pclass-dependent... |
||
72 | XDEADLINE_MISS |
||
73 | If a task miss his deadline, the exception is raised. |
||
74 | Normally, a TBS task can't cause the raise of such exception because |
||
75 | if it really use more time than declared a XWCET_VIOLATION is raised |
||
76 | instead. |
||
77 | |||
78 | XWCET_VIOLATION |
||
79 | If a task doesn't end the current cycle before if consume the wcet, |
||
80 | an exception is raised, and the task is put in the TBS_WCET_VIOLATED |
||
81 | state. To reactivate it, use TBS_task_activate via task_activate or |
||
82 | manage directly the TBS data structure. Note that if the exception |
||
83 | is not handled properly, an XDEADLINE_MISS exception will also be |
||
84 | raised at the absolute deadline... |
||
85 | |||
86 | Restrictions & special features: |
||
87 | - This level doesn't manage the main task. |
||
88 | - At init time we have to specify: |
||
89 | . The bandwidth used by the server |
||
90 | . some flags |
||
91 | . wcet check activated |
||
92 | (If a task require more time than declared, it is stopped and put in |
||
93 | the state TBS_WCET_VIOLATED; a XWCET_VIOLATION exception is raised) |
||
94 | . guarantee check |
||
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 don't use the priority field. |
||
98 | - A function to return the used bandwidth of the level is provided. |
||
99 | |||
100 | **/ |
||
101 | |||
102 | /* |
||
103 | * Copyright (C) 2000 Paolo Gai |
||
104 | * |
||
105 | * This program is free software; you can redistribute it and/or modify |
||
106 | * it under the terms of the GNU General Public License as published by |
||
107 | * the Free Software Foundation; either version 2 of the License, or |
||
108 | * (at your option) any later version. |
||
109 | * |
||
110 | * This program is distributed in the hope that it will be useful, |
||
111 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
112 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
113 | * GNU General Public License for more details. |
||
114 | * |
||
115 | * You should have received a copy of the GNU General Public License |
||
116 | * along with this program; if not, write to the Free Software |
||
117 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
118 | * |
||
119 | */ |
||
120 | |||
121 | |||
122 | #ifndef __TBS_H__ |
||
123 | #define __TBS_H__ |
||
124 | |||
125 | #include <ll/ll.h> |
||
126 | #include <kernel/config.h> |
||
127 | #include <sys/types.h> |
||
128 | #include <kernel/types.h> |
||
129 | #include "ll/sys/cdefs.h" |
||
130 | |||
131 | __BEGIN_DECLS |
||
132 | |||
133 | /*+ flags... +*/ |
||
134 | #define TBS_DISABLE_ALL 0 |
||
135 | #define TBS_ENABLE_WCET_CHECK 1 /*+ Wcet check enabled +*/ |
||
136 | #define TBS_ENABLE_GUARANTEE 2 /*+ Task Guarantee enabled +*/ |
||
137 | #define TBS_ENABLE_ALL 3 /*+ All flags enabled +*/ |
||
138 | |||
139 | |||
140 | /*+ Registration function: |
||
141 | bandwidth_t b Max bandwidth used by the TBS |
||
142 | int flags Options to be used in this level instance... |
||
143 | LEVEL master the level that must be used as master level for the |
||
144 | TBS tasks |
||
145 | int num,den used to compute the TBS bandwidth +*/ |
||
146 | void TBS_register_level(int flags, LEVEL master, int num, int den); |
||
147 | |||
148 | /*+ Returns the used bandwidth of a level +*/ |
||
149 | bandwidth_t TBS_usedbandwidth(LEVEL l); |
||
150 | |||
151 | /*+ Returns the number of pending activations of a task, or -1 if the level |
||
152 | is wrong. |
||
153 | No control is done if the task is not a TBS task! +*/ |
||
154 | int TBS_get_nact(LEVEL l, PID p); |
||
155 | |||
156 | __END_DECLS |
||
157 | #endif |