Subversion Repositories shark

Rev

Rev 657 | 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>
760 anton 12
 *   Anton Cervin
2 pj 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
 ------------
760 anton 24
 CVS :        $Id: rm.h,v 1.6 2004-06-21 11:40:06 anton Exp $
2 pj 25
 
26
 File:        $File$
760 anton 27
 Revision:    $Revision: 1.6 $
28
 Last update: $Date: 2004-06-21 11:40:06 $
2 pj 29
 ------------
30
 
760 anton 31
 This file contains the scheduling module RM (rate-/deadline-monotonic)
2 pj 32
 
33
 Title:
760 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
760 anton 41
     drel field must be <= mit. NOTE 1: a drel of 0 is interpreted as mit.
42
       NOTE 2: The utilization of the task is computed as wcet/drel.
657 anton 43
     offset field specifies a release offset relative to task_activate or
44
       group_activate.
2 pj 45
 
46
 Guest Models Accepted:
47
   JOB_TASK_MODEL - a single guest task activation
48
     Identified by an absolute deadline and a period.
657 anton 49
     period field is ignored
2 pj 50
 
51
 Description:
760 anton 52
   This module schedules periodic and sporadic tasks based on their
53
   relative deadlines. The task guarantee is based on a simple
54
   utilization approach. The utilization factor of a task is computed
55
   as wcet/drel. (By default, drel = mit.) A periodic task must only
56
   be activated once; subsequent activations are triggered by an
57
   internal timer. By contrast, an sporadic task must be explicitely
58
   activated for each instance. NO GUARANTEE is performed on guest
59
   tasks. The guarantee must be performed by the level that inserts
60
   guest tasks in the RM level.
2 pj 61
 
62
 Exceptions raised:
63
   XUNVALID_GUEST
760 anton 64
     This level doesn't support guests of this type. When a guest
65
     operation is called, the exception is raised.
2 pj 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
760 anton 86
     amount of time. To synchronize a group of tasks, assign suitable
87
     offsets and then use the 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.
760 anton 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
     RM_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
     RM_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
     RM_ENABLE_DL_EXCEPTION -  When a deadline overrun occurs, an
107
                               exception is raised.
108
     RM_ENABLE_WCET_EXCEPTION - When a wcet overrun occurs, an
109
                               exception is raised.
110
     RM_ENABLE_ACT_EXCEPTION   When a periodic or sporadic task is activated
111
                               too often, an exception is raised.
112
 
760 anton 113
   - The functions RM_get_dl_miss, RM_get_wcet_miss, RM_get_act_miss,
114
     and RM_get_nact can be used to find out the number of missed
115
     deadlines, the number of wcet overruns, the number of skipped
116
     activations, and the number of currently queued periodic activations.
657 anton 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 __RM_H__
141
#define __RM_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
150
 
760 anton 151
/* Level flags */
657 anton 152
#define RM_DISABLE_ALL            0
760 anton 153
#define RM_ENABLE_GUARANTEE       1  /* Task guarantee enabled             */
154
#define RM_ENABLE_WCET_CHECK      2  /* Wcet monitoring enabled            */
155
#define RM_ENABLE_DL_CHECK        4  /* Deadline monitoring enabled        */
156
#define RM_ENABLE_WCET_EXCEPTION  8  /* Wcet overrun exception enabled     */
157
#define RM_ENABLE_DL_EXCEPTION   16  /* Deadline overrun exception enabled */
158
#define RM_ENABLE_ACT_EXCEPTION  32  /* Activation exception enabled       */
159
#define RM_ENABLE_ALL            63  /* All flags enabled                  */
2 pj 160
 
760 anton 161
/* Registration function */
162
LEVEL RM_register_level(int flags);
2 pj 163
 
164
 
760 anton 165
/**** Public utility functions ****/
38 pj 166
 
760 anton 167
/* Get the bandwidth used by the level */
2 pj 168
bandwidth_t RM_usedbandwidth(LEVEL l);
169
 
760 anton 170
/* Get the number of missed deadlines for a task */
657 anton 171
int RM_get_dl_miss(PID p);
760 anton 172
 
173
/* Get the number of execution overruns for a task */
657 anton 174
int RM_get_wcet_miss(PID p);
760 anton 175
 
176
/* Get the number of skipped activations for a task */
177
int RM_get_act_miss(PID p);
178
 
179
/* Get the current number of queued activations for a task */
657 anton 180
int RM_get_nact(PID p);
181
 
760 anton 182
 
80 pj 183
__END_DECLS
2 pj 184
#endif