Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
864 trimarchi 1
//fsf_hierarchical.h
2
//====================================================================
3
//       FFFFFFIII   RRRRR      SSTTTTTTT
4
//      FF         IIR   RR    SS
5
//     FF           IR        SS
6
//    FFFFFF         RRRR    SSSSST
7
//   FF       FI       RRR  SS
8
//  FF         II     RRR  SS
9
// FF           IIIIIR    RS
10
//
11
// FSF(FIRST Scheduling Framework) 
12
// hierarchical scheduling management
13
//===================================================================
14
 
15
 
16
#ifndef _FSF_HIERARCHICAL_H_
17
#define _FSF_HIERARCHICAL_H_
18
 
19
#include <time.h>
20
#include "fsf_basic_types.h"
21
#include "fsf_core.h"
22
 
23
#define FSF_HIERARCHICAL_MODULE_SUPPORTED       1
24
 
25
//// The definition of this types is in fsf_basic_types.h
26
//
27
//// Scheduling policies
28
//typedef enum {FSF_FP, FSF_EDF, FSF_TABLE_DRIVEN, FSF_NONE} 
29
//    fsf_sched_policy_t;
30
//
31
//// Scheduling policy and parameters
32
//typedef struct {
33
//  fsf_sched_policy_t    policy;
34
//  void *                params;
35
//} fsf_sched_params_t;
36
//// The params member is a pointer to one of the 
37
//// following:
38
////    FP:  int (priority)
39
////    EDF: struct timespec (deadline)
40
////    TABLE_DRIVEN : struct fsf_table_driven_params_t
41
//
42
//
43
////Scheduling parameters for the table-driven policy (t.b.d)
44
//typedef struct {
45
//  // list of target windows (t.b.d.) 
46
//  // deadline (for the API): end of september
47
//} fsf_table_driven_params_t;
48
//
49
//
50
////Initialization information for a scheduling policy
51
//typedef void * fsf_sched_init_info_t;
52
//// It shall be one of the following:
53
////    FP:  none
54
////    EDF: none
55
////    TABLE_DRIVEN : struct timespec (schedule duration)
56
//
57
 
58
//fsf_init_local_scheduler: This call has the following effects:
59
//    FP:  none
60
//    EDF: none
61
//    TABLE_DRIVEN :
62
//       Records the schedule duration, and starts the
63
//       schedule at the time of the call. After the
64
//       schedule duration has elapsed, the schedule in
65
//       the table is repeated.
66
int fsf_init_local_scheduler(
67
   fsf_server_id_t       server,
68
   fsf_sched_init_info_t info);
69
 
70
 
71
// Constants for assigning default values
72
#define FSF_DEFAULT_SCHED_POLICY        FSF_NONE
73
 
74
 
75
/////////////////////////////////////////////////
76
//                       CONTRACT PARAMETERS
77
////////////////////////////////////////////////
78
 
79
//fsf_set_contract_scheduling_policy: The operation updates the
80
//specified contract parameters object by setting its scheduling
81
//policy to the specified input parameter.  The default policy is
82
//FSF_NONE, which means that only one thread may be bound to the
83
//server
84
 
85
int
86
fsf_set_contract_scheduling_policy
87
  (fsf_contract_parameters_t *contract,
88
   fsf_sched_policy_t         sched_policy);
89
 
90
 
91
//fsf_get_contract_scheduling_policy: This operation obtains from the
92
//specified contract parameters object its scheduling policy, and
93
//copies it to the place pointed to by the corresponding input
94
//parameter.
95
 
96
int
97
fsf_get_contract_scheduling_policy
98
  (const fsf_contract_parameters_t *contract,
99
   fsf_sched_policy_t              *sched_policy);
100
 
101
 
102
//fsf_create_local_thread: : This operation creates a thread and binds
103
//it to the specified server, which must have a policy different than
104
//FSF_NONE. The new thread is created with the arguments thread, attr,
105
//thread_code and arg as they are defined for the pthread_create()
106
//POSIX function call, and its local scheduling parameters are set to
107
//the value stored in the variable pointed to by sched_params, which
108
//must be compatible with the server's scheduling policy. Then, the
109
//function binds the created thread to the new server. The attr
110
//parameter is overwritten as necessary to introduce the adequate
111
//scheduling policy and priority, according to the preemption level
112
//given in the contract and the fsf_priority_map() function defined by
113
//the user.
114
 
115
int
116
fsf_create_local_thread
117
  (fsf_server_id_t        server,
118
   fsf_sched_params_t    *sched_params,
119
   pthread_t             *thread,
120
   pthread_attr_t        *attr,
121
   fsf_thread_code_t      thread_code,
122
   void                  *arg);
123
 
124
//fsf_bind_local_thread_to_server: This operation associates a thread
125
//with a server, which must have a policy different than FSF_NONE. The
126
//thread's local scheduling parameters are set to the value stored in
127
//the variable pointed to by sched_params, which must be compatible
128
//with the server's scheduling policy. After the call the thread
129
//starts consuming the server's budget and is executed according to
130
//the contract established for that server and to its scheduling
131
//policy. If the thread was already bound to another server, it is
132
//effectively unbound from it and bound to the specified one.
133
 
134
//Implementation dependent issue: In order to allow the usage of
135
//application defined schedulers, the given thread must not have the
136
//scheduling policy SCHED_APP and at the same time be attached to an
137
//application scheduler different than the fsf scheduler.
138
 
139
int  
140
fsf_bind_local_thread_to_server
141
  (fsf_server_id_t      server,
142
   pthread_t            thread,
143
   fsf_sched_params_t  *sched_params);
144
 
145
 
146
// fsf_set_local_thread_sched_parameters: this function changes the
147
// local scheduling parameters of the thread to the value pointed to
148
// by sched_params. This value must be compatible with the scheduling
149
// policy of the server to which the thread is bound.
150
 
151
int  
152
fsf_set_local_thread_sched_parameters
153
  (pthread_t                     thread,
154
   const fsf_sched_params_t  *sched_params);
155
 
156
 
157
// fsf_get_local_thread_sched_parameters: this function stores the
158
// local scheduling parameters of the specified thread in the variable
159
// pointed to by sched_params
160
 
161
int  
162
fsf_get_local_thread_sched_parameters
163
  (pthread_t            thread,
164
   fsf_sched_params_t  *sched_params);
165
 
166
 
167
#endif // _FSF_HIERARCHICAL_H_