Rev 80 | 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 | ------------ |
||
80 | pj | 24 | CVS : $Id: rm.h,v 1.3 2003-03-13 13:39:04 pj Exp $ |
2 | pj | 25 | |
26 | File: $File$ |
||
80 | pj | 27 | Revision: $Revision: 1.3 $ |
28 | Last update: $Date: 2003-03-13 13:39:04 $ |
||
2 | pj | 29 | ------------ |
30 | |||
31 | This file contains the scheduling module RM (Rate Monotonic) |
||
32 | |||
33 | Title: |
||
34 | RM (Rate Monotonic |
||
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 |
||
41 | drel field is ignored |
||
42 | |||
43 | Guest Models Accepted: |
||
44 | JOB_TASK_MODEL - a single guest task activation |
||
45 | Identified by an absolute deadline and a period. |
||
46 | all fieds are used |
||
47 | |||
48 | Description: |
||
49 | This module schedule his tasks following the classic RM scheme. |
||
50 | The task guarantee is based on the factor utilization approach. |
||
51 | The tasks scheduled are periodic and sporadic. The sporadic tasks |
||
52 | are like hard task with periodicity set to APERIODIC; they are guaranteed |
||
53 | as a periodic task with period equal to the minimum interarrival time. |
||
54 | All the task are put in a queue and the scheduling is based on the |
||
55 | deadline value. |
||
56 | NO GUARANTEE is performed on guest tasks. The guarantee must be performed |
||
57 | by the level that inserts guest tasks in the EDF level. |
||
58 | |||
59 | Exceptions raised: |
||
60 | XUNVALID_GUEST |
||
61 | This level doesn't support guests. When a guest operation |
||
62 | is called, the exception is raised. |
||
63 | |||
64 | These exceptions are pclass-dependent... |
||
65 | XDEADLINE_MISS |
||
66 | If a task miss his deadline, the exception is raised. |
||
67 | |||
68 | XWCET_VIOLATION |
||
69 | If a task doesn't end the current cycle before if consume the wcet, |
||
70 | an exception is raised, and the task is put in the RM_WCET_VIOLATED |
||
71 | state. To reactivate it, use RM_task_activate via task_activate or |
||
72 | manage directly the RM data structure. Note that the exception is not |
||
73 | handled properly, an XDEADLINE_MISS exeception will also be raised at |
||
74 | the period end... |
||
75 | |||
76 | XACTIVATION |
||
77 | If a sporadic task is activated with a rate that is greather than the |
||
78 | rate declared in the model, this exception is raised and the task is NOT |
||
79 | activated. |
||
80 | This exception is also raised if we are trying to activate a periodic task |
||
81 | stopped with task_sleep before the deadline in which the task_sleep is |
||
82 | called. |
||
83 | |||
84 | Restrictions & special features: |
||
85 | - This level doesn't manage the main task. |
||
86 | - At init time we can choose if the level have to activate |
||
87 | . the wcet check |
||
88 | (If a task require more time than declared, it is stopped and put in |
||
89 | the state RM_WCET_VIOLATED; a XWCET_VIOLATION exception is raised) |
||
90 | . the task guarantee algorithm |
||
91 | (when all task are created the system will check that the task_set |
||
92 | will not use more than the available bandwidth) |
||
93 | - The level use the priority field. |
||
94 | - A function to return the used bandwidth of a level is provided. |
||
95 | |||
96 | **/ |
||
97 | |||
98 | /* |
||
99 | * Copyright (C) 2000 Paolo Gai |
||
100 | * |
||
101 | * This program is free software; you can redistribute it and/or modify |
||
102 | * it under the terms of the GNU General Public License as published by |
||
103 | * the Free Software Foundation; either version 2 of the License, or |
||
104 | * (at your option) any later version. |
||
105 | * |
||
106 | * This program is distributed in the hope that it will be useful, |
||
107 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
108 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
109 | * GNU General Public License for more details. |
||
110 | * |
||
111 | * You should have received a copy of the GNU General Public License |
||
112 | * along with this program; if not, write to the Free Software |
||
113 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
114 | * |
||
115 | */ |
||
116 | |||
117 | |||
118 | #ifndef __RM_H__ |
||
119 | #define __RM_H__ |
||
120 | |||
121 | #include <ll/ll.h> |
||
122 | #include <kernel/config.h> |
||
123 | #include <sys/types.h> |
||
124 | #include <kernel/types.h> |
||
80 | pj | 125 | #include "ll/sys/cdefs.h" |
2 | pj | 126 | |
80 | pj | 127 | __BEGIN_DECLS |
128 | |||
2 | pj | 129 | /*+ 1 - ln(2) +*/ |
130 | |||
131 | #ifndef RM_MINFREEBANDWIDTH |
||
132 | #define RM_MINFREEBANDWIDTH 1317922825 |
||
133 | #endif |
||
134 | |||
135 | |||
136 | |||
137 | /*+ flags... +*/ |
||
138 | #define RM_DISABLE_ALL 0 |
||
139 | #define RM_ENABLE_WCET_CHECK 1 /*+ Wcet check enabled +*/ |
||
140 | #define RM_ENABLE_GUARANTEE 2 /*+ Task Guarantee enabled +*/ |
||
141 | #define RM_ENABLE_ALL 3 /*+ All flags enabled +*/ |
||
142 | |||
143 | #define RM_FAILED_GUARANTEE 8 /*+ used in the module, unsettable |
||
144 | in RM_register_level... +*/ |
||
145 | |||
146 | |||
147 | /*+ Registration function: |
||
38 | pj | 148 | int flag Options to be used in this level instance... |
2 | pj | 149 | |
38 | pj | 150 | returns the level number at which the module has been registered. |
151 | +*/ |
||
152 | LEVEL RM_register_level(int flag); |
||
153 | |||
2 | pj | 154 | /*+ Returns the used bandwidth of a level +*/ |
155 | bandwidth_t RM_usedbandwidth(LEVEL l); |
||
156 | |||
80 | pj | 157 | __END_DECLS |
2 | pj | 158 | #endif |