Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 656 → Rev 657

/shark/trunk/include/kernel/descr.h
21,11 → 21,11
 
/**
------------
CVS : $Id: descr.h,v 1.4 2003-03-13 13:36:27 pj Exp $
CVS : $Id: descr.h,v 1.5 2004-05-17 15:03:50 anton Exp $
 
File: $File$
Revision: $Revision: 1.4 $
Last update: $Date: 2003-03-13 13:36:27 $
Revision: $Revision: 1.5 $
Last update: $Date: 2004-05-17 15:03:50 $
------------
 
Kernel main data structures
255,7 → 255,7
void (*public_epilogue )(LEVEL l, PID p);
A task has been preempted (or its capacity is exausted).
 
void (*public_activate )(LEVEL l, PID p);
void (*public_activate )(LEVEL l, PID p, struct timespec *t);
A task has been activated.
 
void (*public_unblock )(LEVEL l, PID p);
291,7 → 291,7
int (*public_eligible )(LEVEL l, PID p);
void (*public_dispatch )(LEVEL l, PID p, int nostop);
void (*public_epilogue )(LEVEL l, PID p);
void (*public_activate )(LEVEL l, PID p);
void (*public_activate )(LEVEL l, PID p, struct timespec *t);
void (*public_unblock )(LEVEL l, PID p);
void (*public_block )(LEVEL l, PID p);
int (*public_message )(LEVEL l, PID p, void *m);
/shark/trunk/include/kernel/model.h
21,11 → 21,11
 
/**
------------
CVS : $Id: model.h,v 1.5 2004-03-19 12:37:41 giacomo Exp $
CVS : $Id: model.h,v 1.6 2004-05-17 15:03:50 anton Exp $
 
File: $File$
Revision: $Revision: 1.5 $
Last update: $Date: 2004-03-19 12:37:41 $
Revision: $Revision: 1.6 $
Last update: $Date: 2004-05-17 15:03:50 $
------------
 
This file contains the definitions of the task and resource models.
289,7 → 289,8
 
/* A Hard Task model can be used to model periodic and sporadic tasks.
These tasks are usually guaranteed basing on their minimum interarrival
time (mit) and wcet, and may have a relative deadline.
time (mit) and wcet, and may have a relative deadline and a release
offset.
 
A hard task can raise these exceptions:
XDEADLINE_MISS XWCET_VIOLATION XACTIVATION
304,6 → 305,7
TIME drel;
TIME wcet;
int periodicity;
TIME offset;
} HARD_TASK_MODEL;
 
#define hard_task_default_model(m) \
311,7 → 313,8
(m).mit = 0, \
(m).drel = 0, \
(m).wcet = 0, \
(m).periodicity = PERIODIC
(m).periodicity = PERIODIC, \
(m).offset = 0
#define hard_task_def_level(m,l) task_def_level((m).t,l)
#define hard_task_def_arg(m,a) task_def_arg((m).t,a)
#define hard_task_def_stack(m,s) task_def_stack((m).t,s)
324,6 → 327,7
#define hard_task_def_mit(m,p) (m).mit = (p)
#define hard_task_def_drel(m,d) (m).drel = (d)
#define hard_task_def_wcet(m,w) (m).wcet = (w)
#define hard_task_def_offset(m,o) (m).offset = (o)
#define hard_task_def_periodic(m) (m).periodicity = PERIODIC
#define hard_task_def_aperiodic(m) (m).periodicity = APERIODIC
#define hard_task_def_interrupt(m) (m).periodicity = INTDRIVE
/shark/trunk/include/modules/edf.h
21,11 → 21,11
 
/**
------------
CVS : $Id: edf.h,v 1.4 2003-05-05 07:31:12 pj Exp $
CVS : $Id: edf.h,v 1.5 2004-05-17 15:03:50 anton Exp $
 
File: $File$
Revision: $Revision: 1.4 $
Last update: $Date: 2003-05-05 07:31:12 $
Revision: $Revision: 1.5 $
Last update: $Date: 2004-05-17 15:03:50 $
------------
 
This file contains the scheduling module EDF (Earliest Deadline First)
38,7 → 38,9
wcet field and mit field must be != 0. They are used to set the wcet
and period of the tasks.
periodicity field can be either PERIODIC or APERIODIC
drel field is ignored
drel field must be <= mit. NOTE: a drel of 0 is interpreted as mit.
offset field specifies a release offset relative to task_activate or
group_activate.
 
Guest Models Accepted:
JOB_TASK_MODEL - a single guest task activation
46,15 → 48,15
period field is ignored
 
Description:
This module schedule his tasks following the classic EDF scheme.
The task guarantee is based on the factor utilization approach.
The tasks scheduled are periodic and sporadic. The sporadic tasks
are like hard task with periodicity set to APERIODIC; they are guaranteed
as a periodic task with period equal to the minimum interarrival time.
All the task are put in a queue and the scheduling is based on the
deadline value.
NO GUARANTEE is performed on guest tasks. The guarantee must be performed
by the level that inserts guest tasks in the EDF level.
This module schedules periodic and sporadic tasks based on their
absolute deadlines. The task guarantee is based on a simple
utilization approach. The utilization factor of a task is computed
as wcet/drel. (By default, drel = mit.) A periodic task must only
be activated once; subsequent activations are triggered by an
internal timer. By contrast, an sporadic task must be explicitely
activated for each instance. NO GUARANTEE is performed on guest
tasks. The guarantee must be performed by the level that inserts
guest tasks in the EDF level.
 
Exceptions raised:
XUNVALID_GUEST
61,39 → 63,58
This level doesn't support guests. When a guest operation
is called, the exception is raised.
 
These exceptions are pclass-dependent...
The following exceptions may be raised by the module:
XDEADLINE_MISS
If a task miss his deadline, the exception is raised.
If a task misses its deadline and the EDF_ENABLE_DL_EXCEPTION
flag is set, this exception is raised.
 
XWCET_VIOLATION
If a task doesn't end the current cycle before if consume the wcet,
an exception is raised, and the task is put in the EDF_WCET_VIOLATED
state. To reactivate it, use EDF_task_activate via task_activate or
manage directly the EDF data structure. Note that the exception is not
handled properly, an XDEADLINE_MISS exeeption will also be raised at
the period end...
XWCET_VIOLATION
If a task executes longer than its declared wcet and the
EDF_ENABLE_WCET_EXCEPTION flag is set, this exception is raised.
 
XACTIVATION
If a sporadic task is activated with a rate that is greather than the
rate declared in the model, this exception is raised and the task is NOT
activated.
This exception is also raised if we are trying to activate a periodic task
stopped with task_sleep before the deadline in which the task_sleep is
called.
If a sporadic task is activated more often than its declared mit
and the EDF_ENABLE_ACT_EXCEPTION flag is set, this exception is
raised. This exception is also raised if a periodic task is
activated while not in the SLEEP state.
 
Restrictions & special features:
 
- Relative deadlines drel <= mit may be specified.
- An offset > 0 will delay the activation of the task by the same
amount of time. To synchronize a group of tasks, use the
group_activate function.
- This level doesn't manage the main task.
- At init time we can choose if the level have to activate
. the wcet check
(If a task require more time than declared, it is stopped and put in
the state EDF_WCET_VIOLATED; a XWCET_VIOLATION exception is raised)
. the task guarantee algorithm
(when all task are created the system will check that the task_set
will not use more than the available bandwidth)
- The level use the priority and timespec_priority fields.
- The level uses the priority and timespec_priority fields.
- A function to return the used bandwidth of a level is provided.
- The guest tasks don't provide the guest_endcycle function
- At init time, the user can specify the behavior in case of
deadline and wcet overruns. The following flags are available:
 
(No flags enabled) - Deadline and wcet overruns are ignored.
Pending periodic jobs are queued and are
eventually scheduled with correct deadlines
according to their original arrival times.
Sporadic tasks that arrive to often are
simply dropped.
EDF_ENABLE_DL_CHECK - When a deadline overrun occurs, the
dl_miss counter of the task is increased.
Same behavior for pending jobs as above.
EDF_ENABLE_WCET_CHECK - When a wcet overrun occurs, the
wcet_miss counter of the task is increased.
Same behavior for pending jobs as above.
EDF_ENABLE_DL_EXCEPTION - When a deadline overrun occurs, an
exception is raised.
EDF_ENABLE_WCET_EXCEPTION - When a wcet overrun occurs, an
exception is raised.
EDF_ENABLE_ACT_EXCEPTION When a periodic or sporadic task is activated
too often, an exception is raised.
 
- The functions EDF_get_dl_miss, EDF_get_wcet_miss, EDF_get_nact,
and EDF_get_nskip can be used to find out the number of missed
deadlines, number of wcet overruns, number of currently queued
periodic activations, and the number of skipped sporadic activations.
 
**/
 
/*
129,21 → 150,26
 
 
/*+ flags... +*/
#define EDF_DISABLE_ALL 0
#define EDF_ENABLE_WCET_CHECK 1 /*+ Wcet check enabled +*/
#define EDF_ENABLE_GUARANTEE 2 /*+ Task Guarantee enabled +*/
#define EDF_ENABLE_ALL 3 /*+ All flags enabled +*/
#define EDF_DISABLE_ALL 0
#define EDF_ENABLE_GUARANTEE 1 /*+ Task guarantee enabled +*/
#define EDF_ENABLE_WCET_CHECK 2 /*+ Wcet monitoring enabled +*/
#define EDF_ENABLE_DL_CHECK 4 /*+ Deadline monitoring enabled +*/
#define EDF_ENABLE_WCET_EXCEPTION 8 /*+ Wcet overrun exception enabled +*/
#define EDF_ENABLE_DL_EXCEPTION 16 /*+ Deadline overrun exception enabled +*/
#define EDF_ENABLE_ACT_EXCEPTION 32 /*+ Activation exception enabled +*/
#define EDF_ENABLE_ALL 63 /*+ All flags enabled +*/
 
 
/*+ Registration function:
int flag Options to be used in this level instance...
/*+ Registration function +*/
LEVEL EDF_register_level(int flags);
 
returns the level number at which the module has been registered.
+*/
LEVEL EDF_register_level(int flag);
 
/*+ Returns the used bandwidth of a level +*/
bandwidth_t EDF_usedbandwidth(LEVEL l);
 
int EDF_get_dl_miss(PID p);
int EDF_get_wcet_miss(PID p);
int EDF_get_nact(PID p);
int EDF_get_nskip(PID p);
 
__END_DECLS
#endif
/shark/trunk/include/modules/rm.h
21,17 → 21,17
 
/**
------------
CVS : $Id: rm.h,v 1.4 2003-05-05 07:31:12 pj Exp $
CVS : $Id: rm.h,v 1.5 2004-05-17 15:03:51 anton Exp $
 
File: $File$
Revision: $Revision: 1.4 $
Last update: $Date: 2003-05-05 07:31:12 $
Revision: $Revision: 1.5 $
Last update: $Date: 2004-05-17 15:03:51 $
------------
 
This file contains the scheduling module RM (Rate Monotonic)
This file contains the scheduling module RM (rate/deadline monotonic)
 
Title:
RM (Rate Monotonic
RM (Rate/Deadline Monotonic)
 
Task Models Accepted:
HARD_TASK_MODEL - Hard Tasks (Periodic and Sporadic)
38,61 → 38,84
wcet field and mit field must be != 0. They are used to set the wcet
and period of the tasks.
periodicity field can be either PERIODIC or APERIODIC
drel field is ignored
drel field must be <= mit. NOTE: a drel of 0 is interpreted as mit.
offset field specifies a release offset relative to task_activate or
group_activate.
 
Guest Models Accepted:
JOB_TASK_MODEL - a single guest task activation
Identified by an absolute deadline and a period.
all fieds are used
period field is ignored
 
Description:
This module schedule his tasks following the classic RM scheme.
The task guarantee is based on the factor utilization approach.
The tasks scheduled are periodic and sporadic. The sporadic tasks
are like hard task with periodicity set to APERIODIC; they are guaranteed
as a periodic task with period equal to the minimum interarrival time.
All the task are put in a queue and the scheduling is based on the
deadline value.
NO GUARANTEE is performed on guest tasks. The guarantee must be performed
by the level that inserts guest tasks in the EDF level.
 
This module schedules periodic and sporadic tasks based on fixed
priorities according to their relative deadlines. (By default, drel
= mit.) The task guarantee is based on a simple utilization
approach. The utilization factor of a task is computed as
wcet/drel. A periodic task must only be activated once; subsequent
activations are triggered by an internal timer. By contrast, an
sporadic task must be explicitely activated for each instance. NO
GUARANTEE is performed on guest tasks. The guarantee must be
performed by the level that inserts guest tasks in the RM level.
 
Exceptions raised:
XUNVALID_GUEST
This level doesn't support guests. When a guest operation
is called, the exception is raised.
 
These exceptions are pclass-dependent...
The following exceptions may be raised by the module:
XDEADLINE_MISS
If a task miss his deadline, the exception is raised.
If a task misses its deadline and the RM_ENABLE_DL_EXCEPTION
flag is set, this exception is raised.
 
XWCET_VIOLATION
If a task doesn't end the current cycle before if consume the wcet,
an exception is raised, and the task is put in the RM_WCET_VIOLATED
state. To reactivate it, use RM_task_activate via task_activate or
manage directly the RM data structure. Note that the exception is not
handled properly, an XDEADLINE_MISS exeception will also be raised at
the period end...
XWCET_VIOLATION
If a task executes longer than its declared wcet and the
RM_ENABLE_WCET_EXCEPTION flag is set, this exception is raised.
 
XACTIVATION
If a sporadic task is activated with a rate that is greather than the
rate declared in the model, this exception is raised and the task is NOT
activated.
This exception is also raised if we are trying to activate a periodic task
stopped with task_sleep before the deadline in which the task_sleep is
called.
If a sporadic task is activated more often than its declared mit
and the RM_ENABLE_ACT_EXCEPTION flag is set, this exception is
raised. This exception is also raised if a periodic task is
activated while not in the SLEEP state.
 
Restrictions & special features:
 
- Relative deadlines drel <= mit may be specified.
- An offset > 0 will delay the activation of the task by the same
amount of time. To synchronize a group of tasks, use the
group_activate function.
- This level doesn't manage the main task.
- At init time we can choose if the level have to activate
. the wcet check
(If a task require more time than declared, it is stopped and put in
the state RM_WCET_VIOLATED; a XWCET_VIOLATION exception is raised)
. the task guarantee algorithm
(when all task are created the system will check that the task_set
will not use more than the available bandwidth)
- The level use the priority field.
- The level uses the priority and timespec_priority fields.
- A function to return the used bandwidth of a level is provided.
- The guest tasks don't provide the guest_endcycle function
- At init time, the user can specify the behavior in case of
deadline and wcet overruns. The following flags are available:
 
(No flags enabled) - Deadline and wcet overruns are ignored.
Pending periodic jobs are queued and are
eventually scheduled with correct deadlines
according to their original arrival times.
Sporadic tasks that arrive to often are
simply dropped.
RM_ENABLE_DL_CHECK - When a deadline overrun occurs, the
dl_miss counter of the task is increased.
Same behavior for pending jobs as above.
RM_ENABLE_WCET_CHECK - When a wcet overrun occurs, the
wcet_miss counter of the task is increased.
Same behavior for pending jobs as above.
RM_ENABLE_DL_EXCEPTION - When a deadline overrun occurs, an
exception is raised.
RM_ENABLE_WCET_EXCEPTION - When a wcet overrun occurs, an
exception is raised.
RM_ENABLE_ACT_EXCEPTION When a periodic or sporadic task is activated
too often, an exception is raised.
 
- The functions RM_get_dl_miss, RM_get_wcet_miss, RM_get_nact,
and RM_get_nskip can be used to find out the number of missed
deadlines, number of wcet overruns, number of currently queued
periodic activations, and the number of skipped sporadic activations.
 
**/
 
/*
126,22 → 149,20
 
__BEGIN_DECLS
 
/*+ 1 - ln(2) +*/
 
#ifndef RM_MINFREEBANDWIDTH
#define RM_MINFREEBANDWIDTH 1317922825
#endif
/*+ flags... +*/
#define RM_DISABLE_ALL 0
#define RM_ENABLE_GUARANTEE 1 /*+ Task guarantee enabled +*/
#define RM_ENABLE_WCET_CHECK 2 /*+ Wcet monitoring enabled +*/
#define RM_ENABLE_DL_CHECK 4 /*+ Deadline monitoring enabled +*/
#define RM_ENABLE_WCET_EXCEPTION 8 /*+ Wcet overrun exception enabled +*/
#define RM_ENABLE_DL_EXCEPTION 16 /*+ Deadline overrun exception enabled +*/
#define RM_ENABLE_ACT_EXCEPTION 32 /*+ Activation exception enabled +*/
#define RM_ENABLE_ALL 63 /*+ All flags enabled +*/
 
 
 
/*+ flags... +*/
#define RM_DISABLE_ALL 0
#define RM_ENABLE_WCET_CHECK 1 /*+ Wcet check enabled +*/
#define RM_ENABLE_GUARANTEE 2 /*+ Task Guarantee enabled +*/
#define RM_ENABLE_ALL 3 /*+ All flags enabled +*/
 
/*+ Registration function:
int flag Options to be used in this level instance...
int flag Options to be used in this level instance
 
returns the level number at which the module has been registered.
+*/
150,5 → 171,10
/*+ Returns the used bandwidth of a level +*/
bandwidth_t RM_usedbandwidth(LEVEL l);
 
int RM_get_dl_miss(PID p);
int RM_get_wcet_miss(PID p);
int RM_get_nact(PID p);
int RM_get_nskip(PID p);
 
__END_DECLS
#endif