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