Rev 159 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | 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 | ------------ |
||
657 | anton | 24 | CVS : $Id: edf.h,v 1.5 2004-05-17 15:03:50 anton Exp $ |
2 | pj | 25 | |
26 | File: $File$ |
||
657 | anton | 27 | Revision: $Revision: 1.5 $ |
28 | Last update: $Date: 2004-05-17 15:03:50 $ |
||
2 | pj | 29 | ------------ |
30 | |||
31 | This file contains the scheduling module EDF (Earliest Deadline First) |
||
32 | |||
33 | Title: |
||
34 | EDF (Earliest Deadline First) |
||
35 | |||
36 | Task Models Accepted: |
||
37 | HARD_TASK_MODEL - Hard Tasks (Periodic and Sporadic) |
||
38 | wcet field and mit field must be != 0. They are used to set the wcet |
||
39 | and period of the tasks. |
||
40 | periodicity field can be either PERIODIC or APERIODIC |
||
657 | anton | 41 | drel field must be <= mit. NOTE: a drel of 0 is interpreted as mit. |
42 | offset field specifies a release offset relative to task_activate or |
||
43 | group_activate. |
||
2 | pj | 44 | |
45 | Guest Models Accepted: |
||
46 | JOB_TASK_MODEL - a single guest task activation |
||
47 | Identified by an absolute deadline and a period. |
||
48 | period field is ignored |
||
49 | |||
50 | Description: |
||
657 | anton | 51 | This module schedules periodic and sporadic tasks based on their |
52 | absolute deadlines. The task guarantee is based on a simple |
||
53 | utilization approach. The utilization factor of a task is computed |
||
54 | as wcet/drel. (By default, drel = mit.) A periodic task must only |
||
55 | be activated once; subsequent activations are triggered by an |
||
56 | internal timer. By contrast, an sporadic task must be explicitely |
||
57 | activated for each instance. NO GUARANTEE is performed on guest |
||
58 | tasks. The guarantee must be performed by the level that inserts |
||
59 | guest tasks in the EDF level. |
||
2 | pj | 60 | |
61 | Exceptions raised: |
||
62 | XUNVALID_GUEST |
||
63 | This level doesn't support guests. When a guest operation |
||
64 | is called, the exception is raised. |
||
65 | |||
657 | anton | 66 | The following exceptions may be raised by the module: |
2 | pj | 67 | XDEADLINE_MISS |
657 | anton | 68 | If a task misses its deadline and the EDF_ENABLE_DL_EXCEPTION |
69 | flag is set, this exception is raised. |
||
2 | pj | 70 | |
657 | anton | 71 | XWCET_VIOLATION |
72 | If a task executes longer than its declared wcet and the |
||
73 | EDF_ENABLE_WCET_EXCEPTION flag is set, this exception is raised. |
||
2 | pj | 74 | |
75 | XACTIVATION |
||
657 | anton | 76 | If a sporadic task is activated more often than its declared mit |
77 | and the EDF_ENABLE_ACT_EXCEPTION flag is set, this exception is |
||
78 | raised. This exception is also raised if a periodic task is |
||
79 | activated while not in the SLEEP state. |
||
2 | pj | 80 | |
81 | Restrictions & special features: |
||
657 | anton | 82 | |
83 | - Relative deadlines drel <= mit may be specified. |
||
84 | - An offset > 0 will delay the activation of the task by the same |
||
85 | amount of time. To synchronize a group of tasks, use the |
||
86 | group_activate function. |
||
2 | pj | 87 | - This level doesn't manage the main task. |
657 | anton | 88 | - The level uses the priority and timespec_priority fields. |
2 | pj | 89 | - A function to return the used bandwidth of a level is provided. |
90 | - The guest tasks don't provide the guest_endcycle function |
||
657 | anton | 91 | - At init time, the user can specify the behavior in case of |
92 | deadline and wcet overruns. The following flags are available: |
||
2 | pj | 93 | |
657 | anton | 94 | (No flags enabled) - Deadline and wcet overruns are ignored. |
95 | Pending periodic jobs are queued and are |
||
96 | eventually scheduled with correct deadlines |
||
97 | according to their original arrival times. |
||
98 | Sporadic tasks that arrive to often are |
||
99 | simply dropped. |
||
100 | EDF_ENABLE_DL_CHECK - When a deadline overrun occurs, the |
||
101 | dl_miss counter of the task is increased. |
||
102 | Same behavior for pending jobs as above. |
||
103 | EDF_ENABLE_WCET_CHECK - When a wcet overrun occurs, the |
||
104 | wcet_miss counter of the task is increased. |
||
105 | Same behavior for pending jobs as above. |
||
106 | EDF_ENABLE_DL_EXCEPTION - When a deadline overrun occurs, an |
||
107 | exception is raised. |
||
108 | EDF_ENABLE_WCET_EXCEPTION - When a wcet overrun occurs, an |
||
109 | exception is raised. |
||
110 | EDF_ENABLE_ACT_EXCEPTION When a periodic or sporadic task is activated |
||
111 | too often, an exception is raised. |
||
112 | |||
113 | - The functions EDF_get_dl_miss, EDF_get_wcet_miss, EDF_get_nact, |
||
114 | and EDF_get_nskip can be used to find out the number of missed |
||
115 | deadlines, number of wcet overruns, number of currently queued |
||
116 | periodic activations, and the number of skipped sporadic activations. |
||
117 | |||
2 | pj | 118 | **/ |
119 | |||
120 | /* |
||
121 | * Copyright (C) 2000 Paolo Gai |
||
122 | * |
||
123 | * This program is free software; you can redistribute it and/or modify |
||
124 | * it under the terms of the GNU General Public License as published by |
||
125 | * the Free Software Foundation; either version 2 of the License, or |
||
126 | * (at your option) any later version. |
||
127 | * |
||
128 | * This program is distributed in the hope that it will be useful, |
||
129 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
130 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
131 | * GNU General Public License for more details. |
||
132 | * |
||
133 | * You should have received a copy of the GNU General Public License |
||
134 | * along with this program; if not, write to the Free Software |
||
135 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
136 | * |
||
137 | */ |
||
138 | |||
139 | |||
140 | #ifndef __EDF_H__ |
||
141 | #define __EDF_H__ |
||
142 | |||
143 | #include <ll/ll.h> |
||
144 | #include <kernel/config.h> |
||
145 | #include <sys/types.h> |
||
146 | #include <kernel/types.h> |
||
80 | pj | 147 | #include "ll/sys/cdefs.h" |
2 | pj | 148 | |
80 | pj | 149 | __BEGIN_DECLS |
2 | pj | 150 | |
80 | pj | 151 | |
2 | pj | 152 | /*+ flags... +*/ |
657 | anton | 153 | #define EDF_DISABLE_ALL 0 |
154 | #define EDF_ENABLE_GUARANTEE 1 /*+ Task guarantee enabled +*/ |
||
155 | #define EDF_ENABLE_WCET_CHECK 2 /*+ Wcet monitoring enabled +*/ |
||
156 | #define EDF_ENABLE_DL_CHECK 4 /*+ Deadline monitoring enabled +*/ |
||
157 | #define EDF_ENABLE_WCET_EXCEPTION 8 /*+ Wcet overrun exception enabled +*/ |
||
158 | #define EDF_ENABLE_DL_EXCEPTION 16 /*+ Deadline overrun exception enabled +*/ |
||
159 | #define EDF_ENABLE_ACT_EXCEPTION 32 /*+ Activation exception enabled +*/ |
||
160 | #define EDF_ENABLE_ALL 63 /*+ All flags enabled +*/ |
||
2 | pj | 161 | |
162 | |||
657 | anton | 163 | /*+ Registration function +*/ |
164 | LEVEL EDF_register_level(int flags); |
||
2 | pj | 165 | |
166 | /*+ Returns the used bandwidth of a level +*/ |
||
167 | bandwidth_t EDF_usedbandwidth(LEVEL l); |
||
168 | |||
657 | anton | 169 | int EDF_get_dl_miss(PID p); |
170 | int EDF_get_wcet_miss(PID p); |
||
171 | int EDF_get_nact(PID p); |
||
172 | int EDF_get_nskip(PID p); |
||
173 | |||
80 | pj | 174 | __END_DECLS |
2 | pj | 175 | #endif |