Rev 221 | 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 | ------------ |
||
817 | trimarchi | 24 | CVS : $Id: posixstar.h,v 1.2 2004-09-06 11:51:36 trimarchi Exp $ |
221 | giacomo | 25 | |
26 | File: $File$ |
||
817 | trimarchi | 27 | Revision: $Revision: 1.2 $ |
28 | Last update: $Date: 2004-09-06 11:51:36 $ |
||
221 | giacomo | 29 | ------------ |
30 | |||
31 | This file contains the scheduling module compatible with POSIX |
||
32 | specifications |
||
33 | |||
34 | Title: |
||
35 | POSIX version 1 |
||
36 | |||
37 | Task Models Accepted: |
||
38 | NRT_TASK_MODEL - Non-Realtime Tasks |
||
39 | weight field is ignored |
||
40 | slice field is used to set the slice of a task, if it is !=0 |
||
41 | policy field is ignored |
||
42 | inherit field is ignored |
||
43 | |||
44 | Description: |
||
45 | This module schedule his tasks following the POSIX specifications... |
||
46 | |||
47 | A task can be scheduled in a Round Robin way or in a FIFO way. |
||
48 | The tasks have also a priority field. |
||
49 | |||
50 | The slices can be different one task from one another. |
||
51 | |||
52 | The module can SAVE or SKIP activations |
||
53 | |||
54 | Exceptions raised: |
||
55 | XUNVALID_GUEST |
||
56 | This level doesn't support guests. When a guest operation |
||
57 | is called, the exception is raised. |
||
58 | |||
59 | Restrictions & special features: |
||
60 | - if specified, it creates at init time a task, |
||
61 | called "Main", attached to the function __init__(). |
||
62 | - There must be only one module in the system that creates a task |
||
63 | attached to the function __init__(). |
||
64 | - The level tries to guarantee that a RR task uses a "full" timeslice |
||
65 | before going to the queue tail. "full" means that a task can execute |
||
66 | a maximum time of slice+sys_tick due to the approx. done by |
||
67 | the Virtual Machine. If a task execute more time than the slice, |
||
68 | the next time it execute less... |
||
69 | |||
70 | **/ |
||
71 | |||
72 | /* |
||
73 | * Copyright (C) 2000 Paolo Gai |
||
74 | * |
||
75 | * This program is free software; you can redistribute it and/or modify |
||
76 | * it under the terms of the GNU General Public License as published by |
||
77 | * the Free Software Foundation; either version 2 of the License, or |
||
78 | * (at your option) any later version. |
||
79 | * |
||
80 | * This program is distributed in the hope that it will be useful, |
||
81 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
82 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
83 | * GNU General Public License for more details. |
||
84 | * |
||
85 | * You should have received a copy of the GNU General Public License |
||
86 | * along with this program; if not, write to the Free Software |
||
87 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
88 | * |
||
89 | */ |
||
90 | |||
91 | |||
92 | #ifndef __POSIXSTAR_H__ |
||
93 | #define __POSIXSTAR_H__ |
||
94 | |||
95 | #include <ll/ll.h> |
||
96 | #include <kernel/config.h> |
||
97 | #include <sys/types.h> |
||
98 | #include <kernel/types.h> |
||
99 | //#define POSIXSTAR_DEBUG |
||
100 | |||
101 | /*+ Const: +*/ |
||
102 | #define POSIXSTAR_MINIMUM_SLICE 1000 /*+ Minimum Timeslice +*/ |
||
103 | #define POSIXSTAR_MAXIMUM_SLICE 500000 /*+ Maximum Timeslice +*/ |
||
104 | |||
105 | typedef struct { |
||
106 | int command; |
||
107 | void *param; |
||
108 | } POSIXSTAR_command_message; |
||
109 | |||
110 | #define POSIXSTAR_SET_NEW_LEVEL 0 |
||
111 | |||
112 | /*+ Registration function: |
||
113 | TIME slice the slice for the Round Robin queue |
||
114 | int createmain 1 if the level creates the main task 0 otherwise |
||
115 | struct multiboot_info *mb used if createmain specified |
||
116 | |||
117 | returns the level number at which the module has been registered. |
||
118 | +*/ |
||
119 | LEVEL POSIXSTAR_register_level(int master, TIME slice, int prioritylevels); |
||
120 | |||
121 | int POSIXSTAR_setbudget(LEVEL l, PID p, int budget); |
||
122 | int POSIXSTAR_getbudget(LEVEL l, PID p); |
||
123 | |||
124 | int POSIXSTAR_budget_has_thread(LEVEL l, int budget); |
||
125 | |||
126 | /*+ this function forces the running task to go to his queue tail, |
||
127 | then calls the scheduler and changes the context |
||
128 | (it works only on the POSIX level) +*/ |
||
129 | int POSIXSTAR_sched_yield(LEVEL l); |
||
130 | |||
131 | /* the following functions have to be called with interruptions DISABLED! */ |
||
132 | |||
133 | /*+ this function returns the maximum level allowed for the POSIX level +*/ |
||
134 | int POSIXSTAR_get_priority_max(LEVEL l); |
||
135 | |||
136 | /*+ this function returns the default timeslice for the POSIX level +*/ |
||
137 | int POSIXSTAR_rr_get_interval(LEVEL l); |
||
138 | |||
139 | /*+ this functions returns some paramaters of a task; |
||
140 | policy must be NRT_RR_POLICY or NRT_FIFO_POLICY; |
||
141 | priority must be in the range [0..prioritylevels] |
||
142 | returns ENOSYS or ESRCH if there are problems +*/ |
||
143 | int POSIXSTAR_getschedparam(LEVEL l, PID p, int *policy, int *priority); |
||
144 | |||
145 | /*+ this functions sets paramaters of a task +*/ |
||
146 | int POSIXSTAR_setschedparam(LEVEL l, PID p, int policy, int priority); |
||
147 | |||
817 | trimarchi | 148 | |
149 | void POSIXSTAR_set_nopreemtive_current(LEVEL l); |
||
150 | |||
151 | void POSIXSTAR_unset_nopreemtive_current(LEVEL l); |
||
152 | |||
221 | giacomo | 153 | #endif |
154 | |||
155 | /* |
||
156 | MANCANO |
||
157 | 13.3.6 GETPRIORITYMin da mettere a 0 |
||
158 | */ |