Subversion Repositories shark

Rev

Details | 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
 ------------
24
 CVS :        $Id: srp.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
25
 
26
 File:        $File$
27
 Revision:    $Revision: 1.1.1.1 $
28
 Last update: $Date: 2002-03-29 14:12:51 $
29
 ------------
30
 
31
 This file contains the Stack Resource Policy (SRP) Protocol
32
 
33
 Title:
34
   SRP (Stack Resource Policy)
35
 
36
 Resource Models Accepted:
37
   None
38
 
39
 Description:
40
   This module implement the Stack Resource policy using the shadow field
41
   of the task descriptor. No difference is made upon the task model of the
42
   tasks that use SRP mutexes.
43
 
44
   A SRP mutex is created passing the SRP_mutexattr structure to mutex_init.
45
 
46
   In effect, this module doesn't work correctly if it is
47
   used, for example, with a Round Robin Module; in this case we
48
   can have a task B that preempts A, but when B finishes his timeslice, A
49
   can be scheduled by the RR module, and the SRP can't block it, because
50
   the SRP module can not control preemptions (it works only using the shadow
51
   field at lock and unlock time!!!).
52
   Note that this problen not affect the EDF, RM & co. algorithms... because
53
   if B preempts A, A will never preempts on B...
54
 
55
   A task that want to use the SRP protocol MUST declare it using a
56
   SRP_RES_MODEL in the task_create. Only the first SRP_RES_MODEL is
57
   considered.
58
 
59
   A task that want to use a SRP mutex have to declare it with the
60
   SRP_usemutex function as last parameter of a task_create call, AFTER
61
   the specification of the preemption level.
62
 
63
 Exceptions raised:
64
   XMUTEX_OWNER_KILLED
65
     This exception is raised when a task ends and it owns one or more
66
     mutexes
67
 
68
   XSRP_UNVALID_LOCK
69
     This exception is raised when a task try to lock a srp mutex but
70
     it don't have the provilege.
71
 
72
 Restrictions & special features:
73
   - This module is NOT Posix compliant
74
   - This module can manage any number of SRP mutexes.
75
   - If a task ends (because it reaches the end of the body or because it
76
     is killed by someone) and it owns some mutex, an exception is raised.
77
   - if a mutex unlock is called on a mutex not previously
78
     locked or previously locked by another task an exception is raised
79
   - A SRP mutex can not be statically allocated
80
   - The module is incompatible with the primitive TASK_JOIN, so the tasks
81
     that uses SRP can NOT call task_join.
82
**/
83
 
84
/*
85
 * Copyright (C) 2000 Paolo Gai
86
 *
87
 * This program is free software; you can redistribute it and/or modify
88
 * it under the terms of the GNU General Public License as published by
89
 * the Free Software Foundation; either version 2 of the License, or
90
 * (at your option) any later version.
91
 *
92
 * This program is distributed in the hope that it will be useful,
93
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
94
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
95
 * GNU General Public License for more details.
96
 *
97
 * You should have received a copy of the GNU General Public License
98
 * along with this program; if not, write to the Free Software
99
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
100
 *
101
 */
102
 
103
 
104
 
105
#ifndef __SRP_H__
106
#define __SRP_H__
107
 
108
#include <kernel/model.h>
109
#include <kernel/descr.h>
110
 
111
void SRP_register_module(void);
112
 
113
extern __inline__ RES_MODEL *SRP_usemutex(mutex_t *m) {
114
  return (RES_MODEL *)m->opt;
115
};
116
 
117
#endif