Rev 3 | 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> |
||
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 | ------------ |
||
38 | pj | 24 | CVS : $Id: posix.h,v 1.2 2003-01-07 17:12:20 pj Exp $ |
2 | pj | 25 | |
26 | File: $File$ |
||
38 | pj | 27 | Revision: $Revision: 1.2 $ |
28 | Last update: $Date: 2003-01-07 17:12:20 $ |
||
2 | pj | 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 __POSIX_H__ |
||
93 | #define __POSIX_H__ |
||
94 | |||
95 | #include <ll/ll.h> |
||
96 | #include <kernel/config.h> |
||
97 | #include <sys/types.h> |
||
98 | #include <kernel/types.h> |
||
99 | |||
100 | extern TASK __init__(void *arg); |
||
101 | |||
102 | |||
103 | |||
104 | /*+ Const: +*/ |
||
105 | #define POSIX_MINIMUM_SLICE 1000 /*+ Minimum Timeslice +*/ |
||
106 | #define POSIX_MAXIMUM_SLICE 500000 /*+ Maximum Timeslice +*/ |
||
107 | |||
108 | #define POSIX_MAIN_YES 1 /*+ The level creates the main +*/ |
||
109 | #define POSIX_MAIN_NO 0 /*+ The level does'nt create the main +*/ |
||
110 | |||
111 | /*+ Registration function: |
||
112 | TIME slice the slice for the Round Robin queue |
||
113 | int createmain 1 if the level creates the main task 0 otherwise |
||
38 | pj | 114 | struct multiboot_info *mb used if createmain specified |
115 | |||
116 | returns the level number at which the module has been registered. |
||
117 | +*/ |
||
118 | LEVEL POSIX_register_level(TIME slice, |
||
2 | pj | 119 | int createmain, |
120 | struct multiboot_info *mb, |
||
121 | int prioritylevels); |
||
122 | |||
123 | /*+ this function forces the running task to go to his queue tail, |
||
124 | then calls the scheduler and changes the context |
||
125 | (it works only on the POSIX level) +*/ |
||
126 | int POSIX_sched_yield(LEVEL l); |
||
127 | |||
128 | /* the following functions have to be called with interruptions DISABLED! */ |
||
129 | |||
130 | /*+ this function returns the maximum level allowed for the POSIX level +*/ |
||
131 | int POSIX_get_priority_max(LEVEL l); |
||
132 | |||
133 | /*+ this function returns the default timeslice for the POSIX level +*/ |
||
134 | int POSIX_rr_get_interval(LEVEL l); |
||
135 | |||
136 | /*+ this functions returns some paramaters of a task; |
||
137 | policy must be NRT_RR_POLICY or NRT_FIFO_POLICY; |
||
138 | priority must be in the range [0..prioritylevels] |
||
139 | returns ENOSYS or ESRCH if there are problems +*/ |
||
140 | int POSIX_getschedparam(LEVEL l, PID p, int *policy, int *priority); |
||
141 | |||
142 | /*+ this functions sets paramaters of a task +*/ |
||
143 | int POSIX_setschedparam(LEVEL l, PID p, int policy, int priority); |
||
144 | |||
145 | #endif |
||
146 | |||
147 | /* |
||
148 | MANCANO |
||
149 | 13.3.6 GETPRIORITYMin da mettere a 0 |
||
150 | */ |