Rev 273 | Rev 830 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
221 | giacomo | 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 | ------------ |
||
288 | giacomo | 24 | CVS : $Id: cbsstar.h,v 1.3 2003-10-15 11:12:03 giacomo Exp $ |
221 | giacomo | 25 | |
26 | File: $File$ |
||
288 | giacomo | 27 | Revision: $Revision: 1.3 $ |
28 | Last update: $Date: 2003-10-15 11:12:03 $ |
||
221 | giacomo | 29 | ------------ |
30 | |||
31 | This file contains the budget support for the multiapplication |
||
32 | scheduling algorithm proposed in the framework of the FIRST Project |
||
33 | |||
34 | Title: |
||
35 | CBSSTAR |
||
36 | |||
37 | Task Models Accepted: |
||
38 | None! |
||
39 | |||
40 | Guest Models Accepted: |
||
41 | BUDGET_TASK_MODEL - A task that is attached to a budget |
||
42 | int b; --> the number of the budget which the task is attached to |
||
43 | |||
44 | Description: |
||
45 | This module schedule its tasks following the CBS scheme. |
||
46 | Every task is inserted using the guest calls. |
||
47 | |||
48 | The module defines a limited set of budgets that the application |
||
49 | can use. Every guest task will use a particular budget; FIFO |
||
50 | scheduling is used inside a budget to schedule more than one ready |
||
51 | task attached to the same budget. |
||
52 | |||
53 | The tasks are inserted in an EDF level (or similar) with a JOB_TASK_MODEL, |
||
54 | and the CBS level expects that the task is scheduled with the absolute |
||
55 | deadline passed in the model. |
||
56 | |||
57 | This module tries to implement a simplified version of the guest |
||
58 | task interface: |
||
59 | - To insert a guest task, use guest_create |
||
60 | - When a task is dispatched, use guest_dispatch |
||
61 | - When a task have to be suspended, you have to use: |
||
62 | -> preemption: use guest_epilogue |
||
63 | -> synchronization, end: use guest_end |
||
64 | Remember: no check is done on the budget number passed with the model!!! |
||
65 | |||
66 | Exceptions raised: |
||
67 | XUNVALID_TASK |
||
68 | This level doesn't support normal tasks, but just guest tasks. |
||
69 | When a task operation is called, an exception is raised. |
||
70 | |||
71 | Restrictions & special features: |
||
72 | - This level doesn't manage the main task. |
||
73 | - At init time we have to specify: |
||
74 | . guarantee check |
||
75 | (when all task are created the system will check that the task_set |
||
76 | will not use more than the available bandwidth) |
||
77 | - A function to return the used bandwidth of the level is provided. |
||
78 | |||
79 | - A function is provided to allocate a buffer. |
||
80 | */ |
||
81 | |||
82 | /* |
||
83 | * Copyright (C) 2002 Paolo Gai |
||
84 | * |
||
85 | * This program is free software; you can redistribute it and/or modify |
||
86 | * it under the terms of the GNU General Public License as published by |
||
87 | * the Free Software Foundation; either version 2 of the License, or |
||
88 | * (at your option) any later version. |
||
89 | * |
||
90 | * This program is distributed in the hope that it will be useful, |
||
91 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
92 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
93 | * GNU General Public License for more details. |
||
94 | * |
||
95 | * You should have received a copy of the GNU General Public License |
||
96 | * along with this program; if not, write to the Free Software |
||
97 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
98 | * |
||
99 | */ |
||
100 | |||
101 | |||
102 | #ifndef __CBSSTAR_H__ |
||
103 | #define __CBSSTAR_H__ |
||
104 | |||
105 | #include <kernel/kern.h> |
||
106 | |||
107 | //#include <ll/ll.h> |
||
108 | //#include <kernel/config.h> |
||
109 | //#include <sys/types.h> |
||
110 | //#include <kernel/types.h> |
||
111 | //#include <modules/codes.h> |
||
112 | |||
113 | /* ----------------------------------------------------------------------- |
||
114 | BUDGET_TASK_MODEL: a model for guest tasks |
||
115 | ----------------------------------------------------------------------- */ |
||
116 | |||
117 | #define BUDGET_PCLASS 0x0600 |
||
118 | |||
119 | typedef struct { |
||
120 | TASK_MODEL t; |
||
121 | int b; |
||
122 | } BUDGET_TASK_MODEL; |
||
123 | |||
124 | #define budget_task_default_model(m,buf) \ |
||
125 | task_default_model((m).t, BUDGET_PCLASS), \ |
||
126 | (m).b = (buf); |
||
127 | |||
128 | |||
129 | |||
130 | /* some constants for registering the Module in the right place */ |
||
131 | #define CBSSTAR_LEVELNAME "CBSSTAR" |
||
132 | #define CBSSTAR_LEVEL_CODE 106 |
||
133 | #define CBSSTAR_LEVEL_VERSION 1 |
||
134 | |||
135 | typedef struct { |
||
136 | int command; |
||
137 | void *param; |
||
138 | } CBSSTAR_command_message; |
||
139 | |||
140 | typedef struct { |
||
141 | int budget; |
||
142 | TIME T,Q; |
||
143 | } CBSSTAR_mod_budget; |
||
144 | |||
145 | /* Registration function: |
||
146 | int N Maximum number of budgets allocated for the applications |
||
147 | LEVEL master the level that must be used as master level for the |
||
148 | CBS tasks |
||
149 | */ |
||
150 | LEVEL CBSSTAR_register_level(int n, LEVEL master); |
||
151 | |||
152 | /* Allocates a budget to be used for an application. |
||
153 | Input parameters: |
||
154 | Q The budget |
||
155 | T The period of the budget |
||
156 | Return value: |
||
157 | 0..N The ID of the budget |
||
158 | -1 no more free budgets |
||
159 | -2 The budgets allocated locally to this module have bandwidth > 1 |
||
160 | -3 wrong LEVEL id |
||
161 | */ |
||
162 | int CBSSTAR_setbudget(LEVEL l, TIME Q, TIME T, LEVEL local_scheduler_level, int scheduler_id); |
||
163 | |||
164 | int CBSSTAR_removebudget(LEVEL l, int budget); |
||
165 | |||
166 | int CBSSTAR_adjust_budget(LEVEL l, TIME Q, TIME T, int budget); |
||
167 | |||
168 | int CBSSTAR_getbudgetinfo(LEVEL l, TIME *Q, TIME *T, int budget); |
||
169 | |||
170 | int CBSSTAR_was_budget_overran(LEVEL l, int budget); |
||
171 | |||
172 | int CBSSTAR_is_active(LEVEL l, int budget); |
||
173 | |||
174 | int CBSSTAR_get_local_scheduler_level_from_budget(LEVEL l, int budget); |
||
175 | |||
176 | int CBSSTAR_get_local_scheduler_level_from_pid(LEVEL l, PID p); |
||
177 | |||
178 | int CBSSTAR_get_local_scheduler_id_from_budget(LEVEL l, int budget); |
||
179 | |||
180 | int CBSSTAR_get_local_scheduler_id_from_pid(LEVEL l, PID p); |
||
181 | |||
288 | giacomo | 182 | int CBSSTAR_get_last_reclaiming(LEVEL l, PID p); |
273 | giacomo | 183 | |
221 | giacomo | 184 | #endif |