Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 927 → Rev 928

/shark/trunk/ports/first/fsf_include/fsf_hierarchical.h
54,24 → 54,33
//// TABLE_DRIVEN : struct timespec (schedule duration)
//
 
//fsf_init_local_scheduler: This call has the following effects:
// FP: none
// EDF: none
// TABLE_DRIVEN :
// Records the schedule duration, and starts the
// schedule at the time of the call. After the
// schedule duration has elapsed, the schedule in
// the table is repeated.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the value of the server argument is not in range,
or info is NULL
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
has been cancelled or it is not valid
]
// Constants for assigning default values
#define FSF_DEFAULT_SCHED_POLICY FSF_NONE
 
 
/**
\ingroup hiermodule
 
This call has the following effects:
- FP: none
- EDF: none
- TABLE_DRIVEN :
Records the schedule duration, and starts the
schedule at the time of the call. After the
schedule duration has elapsed, the schedule in
the table is repeated.
 
@param [in] server server id
@param [in] info TBD
 
@retval FSF_ERR_BAD_ARGUMENT if the value of the server argument
is not in range or info is NULL
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling
thread has been cancelled or it is not valid
*/
int fsf_init_local_scheduler(
fsf_server_id_t server,
78,26 → 87,27
fsf_sched_init_info_t info);
 
 
// Constants for assigning default values
#define FSF_DEFAULT_SCHED_POLICY FSF_NONE
 
 
/////////////////////////////////////////////////
// CONTRACT PARAMETERS
////////////////////////////////////////////////
 
//fsf_set_contract_scheduling_policy: The operation updates the
//specified contract parameters object by setting its scheduling
//policy to the specified input parameter. The default policy is
//FSF_NONE, which means that only one thread may be bound to the
//server
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if sched_policy is not in range,
or contract is NULL
]
/**
\ingroup hiermodule
 
The operation updates the specified contract parameters object by
setting its scheduling policy to the specified input parameter.
The default policy is FSF_NONE, which means that only one thread
may be bound to the server
 
@param [in] contract pointer to the contract
@param [in] sched_policy local scheduling policy for this server.
Can be FSF_FP, FSF_EDF, FSF_TABLE_DRIVEN, FSF_NONE.
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if sched_policy is not one of the supported
ones, or contract is NULL
*/
 
int
fsf_set_contract_scheduling_policy
(fsf_contract_parameters_t *contract,
104,16 → 114,21
fsf_sched_policy_t sched_policy);
 
 
//fsf_get_contract_scheduling_policy: This operation obtains from the
//specified contract parameters object its scheduling policy, and
//copies it to the place pointed to by the corresponding input
//parameter.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if sched_policy or contract are NULL
]
/**
\ingroup hiermodule
 
This operation obtains from the specified contract parameters
object its scheduling policy, and copies it to the place pointed to
by the corresponding input parameter.
 
@param [in] contract pointer to the contract
@param [out] sched_policy pointer to a variable that will contain
the scheduling policy
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if sched_policy or contract are NULL
*/
 
int
fsf_get_contract_scheduling_policy
(const fsf_contract_parameters_t *contract,
120,33 → 135,40
fsf_sched_policy_t *sched_policy);
 
 
//fsf_create_local_thread: : This operation creates a thread and binds
//it to the specified server, which must have a policy different than
//FSF_NONE. The new thread is created with the arguments thread, attr,
//thread_code and arg as they are defined for the pthread_create()
//POSIX function call, and its local scheduling parameters are set to
//the value stored in the variable pointed to by sched_params, which
//must be compatible with the server's scheduling policy. Then, the
//function binds the created thread to the new server. The attr
//parameter is overwritten as necessary to introduce the adequate
//scheduling policy and priority, according to the preemption level
//given in the contract and the fsf_priority_map() function defined by
//the user.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the value of the server argument is not in range,
or sched_params is NULL
FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE : if the scheduling policy
/**
\ingroup hiermodule
 
This operation creates a thread and binds it to the specified
server, which must have a policy different than FSF_NONE. The new
thread is created with the arguments thread, attr, thread_code and
arg as they are defined for the pthread_create() POSIX function
call, and its local scheduling parameters are set to the value
stored in the variable pointed to by sched_params, which must be
compatible with the server's scheduling policy. Then, the function
binds the created thread to the new server. The attr parameter is
overwritten as necessary to introduce the adequate scheduling
policy and priority, according to the preemption level given in the
contract and the fsf_priority_map() function defined by the user.
 
@param [in] server server id
@param [in] sched_params scheduling parameters for the thread
@param [out] thread the thread id after creation
@param [in] attr attributes for the task (see pthread_create())
@param [in] thread_code pointer to a function that implements the
thread code
@param [in] arg arguments for the thread
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if the value of the server argument
is not in range, or sched_params is NULL
@retval FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE if the scheduling policy
in sched_params is not compatible to the server's one.
FSF_ERR_INTERNAL_ERROR : erroneous binding or malfunction of the FSF
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction of the FSF
main scheduler
FSF_ERR_NOT_CONTRACTED_SERVER : if the referenced server is not valid
FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE: if the kind of workload
of the server is FSF_OVERHEAD
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the referenced server is not valid
It may also return any of the errors that may be returned by the
pthread_create()POSIX function call
]
@retval others It may also return any of the errors that may be
returned by the pthread_create()POSIX function call
*/
 
int
158,38 → 180,40
fsf_thread_code_t thread_code,
void *arg);
 
//fsf_bind_local_thread_to_server: This operation associates a thread
//with a server, which must have a policy different than FSF_NONE. The
//thread's local scheduling parameters are set to the value stored in
//the variable pointed to by sched_params, which must be compatible
//with the server's scheduling policy. After the call the thread
//starts consuming the server's budget and is executed according to
//the contract established for that server and to its scheduling
//policy. If the thread was already bound to another server, it is
//effectively unbound from it and bound to the specified one.
/**
\ingroup hiermodule
 
This operation associates a thread with a server, which must have a
policy different than FSF_NONE. The thread's local scheduling
parameters are set to the value stored in the variable pointed to
by sched_params, which must be compatible with the server's
scheduling policy. After the call the thread starts consuming the
server's budget and is executed according to the contract
established for that server and to its scheduling policy. If the
thread was already bound to another server, it is effectively
unbound from it and bound to the specified one.
//Implementation dependent issue: In order to allow the usage of
//application defined schedulers, the given thread must not have the
//scheduling policy SCHED_APP and at the same time be attached to an
//application scheduler different than the fsf scheduler.
Implementation dependent issue: In order to allow the usage of
application defined schedulers, the given thread must not have the
scheduling policy SCHED_APP and at the same time be attached to an
application scheduler different than the fsf scheduler.
 
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the server argument does not complain with
@param [in] server server id
@param [in] thread thread id
@param [in] sched_params scheduling parameters for the thread
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if the server argument does not complain with
the expected format or valid range, the given thread does not exist,
or sched_params is NULL
FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE : if the scheduling policy
@retval FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE if the scheduling policy
in sched_params is not compatible to the server's one.
FSF_ERR_INTERNAL_ERROR : erroneous binding or malfunction of the FSF
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction of the FSF
main scheduler
FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD : if the thread is attached to
@retval FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD if the thread is attached to
an application defined scheduler different than the fsf scheduler
FSF_ERR_NOT_CONTRACTED_SERVER : if the referenced server is not valid
FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE: if the kind of workload
of the server is FSF_OVERHEAD
]
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the referenced server is not valid
*/
 
int
fsf_bind_local_thread_to_server
(fsf_server_id_t server,
197,28 → 221,32
fsf_sched_params_t *sched_params);
 
// fsf_set_local_thread_sched_parameters: this function changes the
// local scheduling parameters of the thread to the value pointed to
// by sched_params. This value must be compatible with the scheduling
// policy of the server to which the thread is bound.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the given thread does not exist,
/**
\ingroup hiermodule
This function changes the local scheduling parameters of the thread
to the value pointed to by sched_params. This value must be
compatible with the scheduling policy of the server to which the
thread is bound.
 
@param [in] thread thread id
@param [in] sched_params scheduling parameters
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if the given thread does not exist,
or sched_params is NULL
FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE : if the thread is already bound
@retval FSF_ERR_SCHED_POLICY_NOT_COMPATIBLE if the thread is already bound
and the scheduling policy in sched_params is not compatible to the
one of the thread's server.
FSF_ERR_NOT_SCHEDULED_THREAD : if the given thread is not scheduled
@retval FSF_ERR_NOT_SCHEDULED_THREAD if the given thread is not scheduled
under the FSF
FSF_ERR_INTERNAL_ERROR : erroneous binding or malfunction of the FSF
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction of the FSF
main scheduler
FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD : if the thread is attached to
@retval FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD if the thread is attached to
an application defined scheduler different than the fsf scheduler
FSF_ERR_NOT_CONTRACTED_SERVER : if the thread is bound and its server
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the thread is bound and its server
is not valid
]
*/
 
int
fsf_set_local_thread_sched_parameters
(pthread_t thread,
225,18 → 253,21
const fsf_sched_params_t *sched_params);
 
 
// fsf_get_local_thread_sched_parameters: this function stores the
// local scheduling parameters of the specified thread in the variable
// pointed to by sched_params
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if sched_params is NULL or the thread does
not exist
FSF_ERR_NOT_SCHEDULED_THREAD : if the given thread is not scheduled
/**
\ingroup hiermodule
 
This function stores the local scheduling parameters of the
specified thread in the variable pointed to by sched_params
 
@param [in] thread thread id
@param [out] sched_params scheduling parameters
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if sched_params is NULL or the thread does
not exist
@retval FSF_ERR_NOT_SCHEDULED_THREAD if the given thread is not scheduled
under the FSF
]
*/
 
int
fsf_get_local_thread_sched_parameters
(pthread_t thread,
/shark/trunk/ports/first/fsf_include/fsf_shared_objects.h
55,20 → 55,26
// SHARED OBJECTS & OPERATIONS MANAGEMENT
/////////////////////////////////////////////////////
 
// fsf_init_shared_object: Initialization of shared objects. If the
// object identified by obj_id does not yet exist it is created, a
// handle to the object is returned in the variable pointed to by
// obj_handle, and the specified mutex is initialized with the
// appropriate attributes necessary for the current implementation.
// If the object already exists, the function fails.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if obj_id, obj_handle, or mutex are NULL
FSF_ERR_SHARED_OBJ_ALREADY_INITIALIZED : if the object identified
/**
\ingroup shobjmodule
 
Initialization of shared objects. If the object identified by
obj_id does not yet exist it is created, a handle to the object is
returned in the variable pointed to by obj_handle, and the
specified mutex is initialized with the appropriate attributes
necessary for the current implementation. If the object already
exists, the function fails.
 
@param [in] obj_id shared object id
@param [out] obj_handle pointer to a shared object handle
@param [out] mutex pointer to a mutex variable
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if obj_id, obj_handle, or mutex are NULL
@retval FSF_ERR_SHARED_OBJ_ALREADY_INITIALIZED if the object identified
by obj_id already exists
It may also return any of the error codes that are returned by the
pthread_mutex_init() POSIX function call
]
@retval others It may also return any of the error codes that are
returned by the pthread_mutex_init() POSIX function call
*/
int fsf_init_shared_object
(fsf_shared_obj_id_t obj_id,
76,43 → 82,53
pthread_mutex_t *mutex);
 
 
// fsf_get_shared_object_handle: getting the handle of shared
// objects. If the object already exists a handle to the object is
// returned in the variable pointed to by obj_handle. Otherwise, an
// error code is returned by the function.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if obj_id or obj_handle are NULL
FSF_ERR_SHARED_OBJ_NOT_INITIALIZED : if the shared object identified
/**
\ingroup shobjmodule
 
Getting the handle of shared
objects. If the object already exists a handle to the object is
returned in the variable pointed to by obj_handle. Otherwise, an
error code is returned by the function.
 
@param [in] obj_id shared object id
@param [out] obj_handle pointer to a shared object handle
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if obj_id or obj_handle are NULL
@retval FSF_ERR_SHARED_OBJ_NOT_INITIALIZED if the shared object identified
by obj_id does not exist
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
has been cancelled or it is not valid
It may also return any of the error codes that are returned by the
pthread_mutex_init() POSIX function call
]
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
running
@retval FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling
thread has been cancelled or it is not valid
*/
int fsf_get_shared_object_handle
(fsf_shared_obj_id_t obj_id,
fsf_shared_obj_handle_t *obj_handle);
 
// fsf_get_shared_object_mutex: getting the mutex of shared
// objects. If the object exists, a pointer to its associated mutex is
// returned in the variable pointed to by mutex. Otherwise, an error
// code is returned by the function.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if obj_handle or mutex are NULL
FSF_ERR_SHARED_OBJ_NOT_INITIALIZED : if the shared object identified
/**
\ingroup shobjmodule
Getting the mutex of shared objects. If the object exists, a
pointer to its associated mutex is returned in the variable pointed
to by mutex. Otherwise, an error code is returned by the function.
 
@param [in] obj_handle shared object handle
@param [out] mutex pointer to a pointer to a mutex variable,
(remember that the function give back a pointer to a mutex!)
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if obj_handle or mutex are NULL
@retval FSF_ERR_SHARED_OBJ_NOT_INITIALIZED if the shared object identified
by obj_id does not exist
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
]
*/
int fsf_get_shared_object_mutex
(fsf_shared_obj_handle_t obj_handle,
123,15 → 139,21
// CONTRACT PARAMETERS
/////////////////////////////////////////////////////
 
//fsf_set_contract_synchronization_parameters: The operation updates
//the specified contract parameters object by setting its critical
//sections to the specified input parameter.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if any of the pointers is NULL or
/**
\ingroup shobjmodule
The operation updates the specified contract parameters object by
setting its critical sections to the specified input parameter.
 
 
@param[in] contract the service contract
@param[in] critical_sections list of critical sections accessed by tasks
belonging to the contract
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT :if any of the pointers is NULL or
the size of the critical_sections structure is less than zero
or grater than FSF_MAX_N_CRITICAL_SECTIONS
]
*/
int
fsf_set_contract_synchronization_parameters
139,18 → 161,21
const fsf_critical_sections_t *critical_sections);
 
 
//fsf_get_contract_synchronization_parameters: The operation obtains
//from the specified contract parameters object its critical sections,
//and copies them to the places pointed to by the specified input
//parameter. Only those critical_section_data records that are in use
//in the critical_sections structure are copied (according to its size
//field).
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if any of the pointers is NULL
]
/**
\ingroup shobjmodule
 
The operation obtains from the specified contract parameters object
its critical sections, and copies them to the places pointed to by
the specified input parameter. Only those critical_section_data
records that are in use in the critical_sections structure are
copied (according to its size field).
 
@param[in] contract pointer to a contract
@param[out] critical_sections list of critical sections to be filled
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if any of the pointers is NULL
*/
 
int
fsf_get_contract_synchronization_parameters
(const fsf_contract_parameters_t *contract,
/shark/trunk/ports/first/fsf_include/fsf_spare_capacity.h
22,6 → 22,12
 
#define FSF_SPARE_CAPACITY_MODULE_SUPPORTED 1
 
 
#define FSF_MAX_QUALITY 100
#define FSF_MIN_QUALITY 0
#define FSF_MAX_IMPORTANCE 5
#define FSF_MIN_IMPORTANCE 1
 
//// The definition of this types is in fsf_basic_types.h
//
//// Granularity of spare capacity requirements
54,32 → 60,51
//#define FSF_NULL_UTILIZATION_SET (fsf_utilization_set_t *)NULL
//
 
//fsf_set_contract_reclamation_parameters: The operation updates the
//specified contract parameters object by setting its maximum usable
//budget, minimum period, granularity, utilization set, quality, and
//importance to the specified input parameters.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if contract is NULL or
(budget_max value is grater than period_max or smaller than budget_min) or
(period_min is smaller than budget_mint or larger than period_max) or
(granularity is neither FSF_CONTINUOUS nor FSF_DISCRETE) or
(granularity is FSF_CONTINUOUS and
utilization_set is not FSF_NULL_UTILIZATION_SET) or
(granularity is FSF_DISCRETE and
utilization_set is FSF_NULL_UTILIZATION_SET) or
(utilization_set is not FSF_NULL_UTILIZATION_SET and
(size of utilization_set less than 2 or greater
than FSF_MAX_N_UTILIZATION_VALUES) ) or
(quality < 0) or
(importance is less than 1 or greater than FSF_N_IMPORTANCE_LEVELS) or
(the utilization_set elements are not in increasing utilization order) or
(the first utilization value in the utilization_set does not match
the pair (budget_min, period_max) of the contract) or
(the last utilization value in the utilization_set does not match
the pair (budget_max, period_min) of the contract)
]
/**
\ingroup sparemodule
 
The operation updates the specified contract parameters object by
setting its maximum usable budget, minimum period, granularity,
utilization set, quality, and importance to the specified input
parameters.
 
@param [in] contract pointer ot the contract
@param [in] budget_max maximum budget this contract can obtain
@param [in] period_min minimum period this contract can obtain
@param [in] granularity can be either FSF_CONTINUOUS or FSF_DISCRETE
@param [in] utilization_set in case the granularity is set to
FSF_DISCRETE it contains a list possible pairs (budget,period)
@param [in] quality a number between FSF_MIN_QUALITY and FSF_MAX_QUALITY,
to control how the spare capacity is shared between
contracts with the same importance. The higher
is this number, the more likely we get a large increase
in the capacity
@param [in] importance a numer between FSF_MIN_IMPORTANCE and
FSF_MAX_IMPORTANCE, used to control how the spare capacity
is shared. The higher the number, the more likely we get
some spare capacity.
@retval 0 if the call is succesful
@retval FSF_ERR_BAD_ARGUMENT if contract is NULL or one of the
following conditions is true:
- (budget_max value is grater than period_max or smaller than
budget_min);
- (period_min is smaller than budget_mint or larger than period_max);
- (granularity is neither FSF_CONTINUOUS nor FSF_DISCRETE);
- (granularity is FSF_CONTINUOUS and
utilization_set is not FSF_NULL_UTILIZATION_SET)
- (granularity is FSF_DISCRETE and utilization_set is
FSF_NULL_UTILIZATION_SET)
- (utilization_set is not FSF_NULL_UTILIZATION_SET and
(size of utilization_set less than 2 or greater
than FSF_MAX_N_UTILIZATION_VALUES)
- (quality < 0)
- (importance is less than 1 or greater than FSF_N_IMPORTANCE_LEVELS)
- (the utilization_set elements are not in increasing utilization order)
- (the first utilization value in the utilization_set does not match
the pair (budget_min, period_max) of the contract);
- (the last utilization value in the utilization_set does not match
the pair (budget_max, period_min) of the contract).
*/
int
fsf_set_contract_reclamation_parameters
92,16 → 117,20
int importance);
 
 
//fsf_get_contract_reclamation_parameters: The operation obtains from
//the specified contract parameters object its granularity,
//utilization set, quality, and importance. Then copies them to the
//variables pointed to by the specified input parameters. Only the
//utilization_values of the utilization_set that are in use, are
//copied (according to its size field).
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if contract is NULL
]
/**
\ingroup sparemodule
 
The operation obtains from the specified contract parameters
object its granularity, utilization set, quality, and
importance. Then copies them to the variables pointed to by the
specified input parameters. Only the utilization_values of the
utilization_set that are in use, are copied (according to its size
field).
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT : if contract is NULL
 
@see fsf_set_contract_reclamation_parameters
*/
int
fsf_get_contract_reclamation_parameters
114,22 → 143,29
int *importance);
 
 
//fsf_request_change_quality_and_importance: The operation enqueues a
//request to change the quality and importance parameters of the
//specified server, and returns immediately. The change operation is
//performed as soon as it is practical; meanwhile the system operation
//will continue normally.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the value of the server argument is not in range or
(quality < 0) or
(importance is less than 1 or greater than FSF_N_IMPORTANCE_LEVELS)
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
/**
\ingroup sparemodule
 
The operation enqueues a request to change the quality and
importance parameters of the specified server, and returns
immediately. The change operation is performed as soon as it is
practical; meanwhile the system operation will continue normally.
 
@param server server id
@param new_importance the new importance
@param new_quality the new requested quality
@retval FSF_ERR_BAD_ARGUMENT if
- the value of the server argument is not in range or
- (quality < 0)
- (importance is less than 1 or greater than FSF_N_IMPORTANCE_LEVELS).
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server has been cancelled or it
is not valid
]
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server has been cancelled
or it is not valid
*/
int
fsf_request_change_quality_and_importance
138,47 → 174,54
int new_quality);
 
 
//fsf_get_total_quality: This operation calculates the sum of the
//quality parameters for all servers in the system of importance level
//equal to that of the specified server, and stores it in the variable
//pointed to by total_quality.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the value of the server argument is not in range or
total_quality is NULL
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
/**
\ingroup sparemodule
 
This operation calculates the sum of the quality parameters for all
servers in the system of importance level equal to that of the
specified server, and stores it in the variable pointed to by
total_quality.
 
@param [in] server server id
@param [out] total_quality the total quality in the system
@retval FSF_ERR_BAD_ARGUMENT if the value of the server argument
is not in range or total_quality is NULL
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server has been cancelled or it
is not valid
]
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server has been
cancelled or it is not valid
*/
 
int
fsf_get_total_quality
(fsf_server_id_t server, int *total_quality);
 
 
//fsf_get_available_capacity: This operation stores in the variable
//pointed to by capacity the spare capacity currently assigned to the
//importance level of the specified server. The capacity is the number
//obtained divided by UINT32_MAX, and it represents the processor or
//network utilization.
/*
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the value of the server argument is not in range or
capacity is NULL
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server has been cancelled or it
is not valid
]
/**
\ingroup sparemodule
 
This operation stores in the variable pointed to by capacity the
spare capacity currently available for the importance level of the
specified server. The capacity is the utilization (of the
processor or of the network) and it is represented by an integer
number between 0 (no utilization) and UINT32_MAX (all
utilization).
 
@retval FSF_ERR_BAD_ARGUMENT if the value of the server argument is
not in range or capacity is NULL
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server has been cancelled
or it is not valid
*/
 
int
fsf_get_available_capacity (
fsf_server_id_t server, uint32_t *capacity);
 
/* @} */
 
#endif // _FSF_SPARE_CAPACITY_H_
/shark/trunk/ports/first/fsf_include/fsf_core.h
11,33 → 11,10
// Basic FSF(FIRST Scheduling Framework) contract management
//================================================================
 
/**
\defgroup core Core module
 
This module includes the basic functions and services that are
provided by any FSF implementation. This module includes basic type
definitions, and functions to
 
- create a contract and initialize it
- set/get the basci parameters of a contract
- negotiate a service contract, obtaining a server id
- create and bind threads to servers
- create/destroy a synchronization object
- manage bounded workloads
*/
/*@{*/
 
/**
\file fsf_core.h
 
This file contains the types, definitions and function prototypes
for the core module of the First Scheduling Framework.
*/
 
#include <time.h>
#include <pthread.h>
#include <sys/types.h>
#include "stdbool.h"
#include <stdbool.h>
 
#include "fsf_configuration_parameters.h"
#include "fsf_opaque_types.h"
46,51 → 23,37
#ifndef _FSF_CORE_H_
#define _FSF_CORE_H_
 
/////////////////////////////////////////////////////////////////
// BASIC TYPES AND CONSTANTS in fsf_basic_types.h
/////////////////////////////////////////////////////////////////
 
//typedef enum {FSF_BOUNDED, FSF_INDETERMINATE}
// fsf_workload_t;
//////////////////////////////////////////////////////////////////////
// INITIALIZATION SERVICES
//////////////////////////////////////////////////////////////////////
 
//// Constants for assigning default values
//
//#define FSF_DEFAULT_WORKLOAD FSF_INDETERMINATE
//#define FSF_DEFAULT_D_EQUALS_T false
//#define FSF_DEFAULT_DEADLINE {0,0} //struct timespec
//
//
//// Constants for omitting the assignment of values
//// to specific arguments in calls to
//// initialization functions
//
//#define FSF_NULL_DEADLINE (struct timespec *)NULL
//#define FSF_NULL_SIGNAL 0
//
//
//// Error codes
//#define FSF_ERR_TOO_MANY_TASKS 2003001
//#define FSF_ERR_BAD_ARGUMENT 2003002
//#define FSF_ERR_INVALID_SYNCH_OBJ_HANDLE 2003003
//#define FSF_ERR_NO_RENEGOTIATION_REQUESTED 2003004
//#define FSF_ERR_CONTRACT_REJECTED 2003005
//#define FSF_ERR_NOT_SCHEDULED_CALLING_THREAD 2003006
//#define FSF_ERR_UNBOUND_THREAD 2003007
//#define FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD 2003008
//#define FSF_ERR_NOT_CONTRACTED_SERVER 2003009
//#define FSF_ERR_NOT_SCHEDULED_THREAD 2003010
//#define FSF_ERR_TOO_MANY_SERVICE_JOBS 2003011
//#define FSF_ERR_TOO_MANY_SYNCH_OBJS 2003012
//#define FSF_ERR_TOO_MANY_SERVERS_IN_SYNCH_OBJ 2003013
//#define FSF_ERR_TOO_MANY_EVENTS_IN_SYNCH_OBJ 2003014
//#define FSF_ERR_INTERNAL_ERROR 2003015
//#define FSF_ERR_TOO_MANY_SERVERS 2003016
//#define FSF_ERR_INVALID_SCHEDULER_REPLY 2003017
//#define FSF_ERR_TOO_MANY_PENDING_REPLENISHMENTS 2003018
//#define FSF_WRN_MODULE_NOT_SUPPORTED 2004001
//#define FSF_ERR_SYSTEM_ALREADY_INITIALIZED 2004002
//
/**
\ingroup coremodule
 
\defgroup core_init Initialization and utilities
 
@{
*/
 
/**
We cannot call any fsf functions before fsf_init. After calling
fsf_init, the main will be executing in the background. Then, it
can do the negotiations, create the threads and, if needed,
activate them via some user-specified synchronization mechanism. It
may also create a contract for itself. The second time this
function is called it fails.
 
@retval 0 if the system is initialized
@retval FSF_ERR_SYSTEM_ALREADY_INITIALIZED if the function has already
been called before
@retval others It may also return any of the errors that may be
returned by the underlying operating system primitives
required to perform the FSF system start up
*/
int fsf_init();
 
/**
This function converts an error code to an error message that is
stored in the buffer starting at the location pointed to by
100,18 → 63,20
truncated or not, a final zero character that marks the end of the
string is stored in the buffer. The function fails if the error
code passed does not correspond to any of the fsf error codes.
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : error is not a valid value
]
 
@retval FSF_ERR_BAD_ARGUMENT error is not a valid value
*/
int fsf_strerror (int error, char *message, size_t size);
 
/* @} */
 
/////////////////////////////////////////////////////////////
// CONTRACT PARAMETERS
/////////////////////////////////////////////////////////////
 
/**
\defgroup contract Contract Creation and Initialization.
\ingroup coremodule
\defgroup core_contract Contract Creation and Initialization.
 
These functions are used to create and initialize a contract, and
set its parameters.
129,21 → 94,17
The operation receives a pointer to a contract parameters object
and initializes it, setting it to the default values.
The default values are:
- budget min and max are set to 0
- period min and max are set to 0
- the workload is unbounded (FSF_INDETERMINATE)
- the server deadline is equal to the period
- the budget and deadline overrun are not notified
- the granularity is set to "continuous"
- the quality and importance are set to the default values
(PEPPE: implementation dependent??)
- the scheduling policy is FSF_NONE
- budget min and max are set to 0;
- period min and max are set to 0;
- the workload is unbounded (FSF_INDETERMINATE);
- the server deadline is equal to the period;
- the budget and deadline overrun are not notified;
- the granularity is set to "continuous";
- the quality and importance are set to the default values;
- the scheduling policy is FSF_NONE.
 
@param contract the pointer to the contract variable.
@returns (PEPPE: should not return anything! change to void??)
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : contract is NULL
]
@retval FSF_ERR_BAD_ARGUMENT contract is NULL
*/
int fsf_initialize_contract (fsf_contract_parameters_t *contract);
 
180,20 → 141,16
fsf_schedule_timed_job() operation), while indeterminate tasks are
not; therefore, their programming model is quite different).
 
@param contract the pointer to the contract object
@param contract the pointer to the contract object
@param [in] budget_min the minimum budget for the contract
@param [in] period_max the maximum period for the contract
@param [in] workload the kind of workload (can be FSF_BOUNDED,
FSF_INDETERMINATE or FSF_OVERHEAD)
@param [in] workload the kind of workload (can be FSF_BOUNDED or
FSF_INDETERMINATE)
@returns 0 if the operation is succesful
@returns FSF_ERR_BAD_ARGUMENT if some of the arguments is not in
the expected range
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if any of the pointers is NULL
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if any of the pointers is NULL
or if only one of the timespec values is 0, and also if the workload
is not a proper value (FSF_INDETERMINATE, FSF_BOUNDED, or FSF_OVERHEAD)
]
is not a proper value (FSF_INDETERMINATE or FSF_BOUNDED)
*/
int
fsf_set_contract_basic_parameters
202,7 → 159,6
const struct timespec *period_max,
fsf_workload_t workload);
 
 
/**
This operation obtains from the specified contract parameters
object its budget, period, and workload, and copies them to the
216,10 → 172,7
@param[out] workload pointer to the variable that will contain the
workload type
 
@returns (PEPPE: this should return nothing!)
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if contract is NULL
]
@retval FSF_ERR_BAD_ARGUMENT : if contract is NULL
*/
int
fsf_get_contract_basic_parameters
260,17 → 213,13
This parameters is not used if the budget_overrun_sig_notify
parameters is set to NULL_SIGNAL
@returns 0 if the operation is succesful
@returns FSF_BAD_ARGUMENT if some argument is out of range or not
admissible.
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if contract is NULL or
@retval 0 if the operation is succesful
@retval FSF_BAD_ARGUMENT if contract is NULL or
(d_equals_t is true and deadline is not FSF_NULL_DEADLINE) or
(budget_overrun_sig_notify is not a valid signal) or
(deadline_miss_sig_notify is not a valid signal) or
(d_equals_t is false but (deadline is FSF_NULL_DEADLINE or its value
is grater than the contract´s maximum period)))
]
is grater than the contract´s maximum period))
 
@see sigexplanation
*/
289,10 → 238,9
specified contract parameters object. If d_equals_t is true, the
deadline will not be updated.
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if contract is NULL
]
@retval FSF_ERR_BAD_ARGUMENT if contract is NULL
 
@see fsf_set_contract_timing_requirements
*/
int
fsf_get_contract_timing_requirements
312,7 → 260,23
 
 
/**
\defgroup synch Synchronization objects
\ingroup coremodule
 
\defgroup core_synch Synchronization objects
 
These objects are used to synchronize threads belonging to bounded
workload servers.
 
In the future we may add a broadcast operation that would signal a
group of synchronization objects. We have not included a broadcast
service in this version because it can be easily created by the
user by signalling individual synchronization objects inside a
loop.
 
Notice that for synchronization objects there is no naming service
like in shared objects because tasks that use synchronization are
not developed independently, as they are closely coupled.
 
*/
/*@{*/
/**
334,52 → 298,47
@param[out] pointer to the variable that will contain the handle to the
newly created synchronization object
 
@returns 0 if the operation is succesful
@returns FSF_ERR_TOO_MANY_SYNCH_OBJS if the number of synchronization
objects in the system has already exceeded the maximum
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if synch_handle is 0
FSF_ERR_TOO_MANY_SYNCH_OBJS : if the number of synchronization
objects in the system has already exceeded the maximum
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
]
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if synch_handle is 0
@retval FSF_ERR_TOO_MANY_SYNCH_OBJS if the number of synchronization
objects in the system has already exceeded the maximum
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong
or not running
*/
int
fsf_create_synch_obj
(fsf_synch_obj_handle_t *synch_handle);
 
/**
 
/**
This function sends a notification to the synchronization object
specified as parameter. If there is at least one thread waiting on
the synchronization object, it is awaken. If more than one thread
is waiting, just one of them is awaken. However, which one is
awaken is implementation dependent. If no thread is waiting on the
synchronization object, the notification is queued.
specified as parameter. If there is at least one server waiting on
the synchronization object, the corresponding thread is unblocked,
and the server rules for budget recharging apply.
 
[JULIO: all the ocurrrences of the word "thread" should be changed
by "server" in the paragraph above
]
If more than one server is waiting, just one of them is woken.
However, which one is woken is implementation dependent.
 
If no thread is waiting on the synchronization object, the
notification is queued.
 
@param [in] synch_handle the handle of the synchronization object to
notify.
 
@returns 0 if the operation is completed succesfully
@returns FSF_ERR_INVALID_SYNCH_OBJ_HANDLE is the handle is not valid
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if synch_handle is 0
FSF_ERR_INVALID_SYNCH_OBJ_HANDLE if the handle is not valid
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_TOO_MANY_EVENTS_IN_SYNCH_OBJ : if the number of events stored
in the synchronization object reaches the maximum defined in the
configuration parameter header file
]
@retval 0 if the operation is completed succesfully
@retval FSF_ERR_BAD_ARGUMENT if synch_handle is 0
@retval FSF_ERR_INVALID_SYNCH_OBJ_HANDLE if the handle is not valid
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread
is not scheduled under the FSF
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_TOO_MANY_EVENTS_IN_SYNCH_OBJ if the number of
events stored in the synchronization object reaches the
maximum defined in the configuration parameter header file
 
@sa fsf_schedule_triggered_job, fsf_timed_schedule_triggered_job
@see fsf_schedule_triggered_job, fsf_timed_schedule_triggered_job
*/
int
fsf_signal_synch_obj
395,33 → 354,22
@param synch_handle the handle to the synchronization object
to be destroyed
 
@returns 0 if the operation is succesful
@returns FSF_ERR_INVALID_SYNCH_OBJ_HANDLE is the handle is not valid
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if synch_handle is 0
FSF_ERR_INVALID_SYNCH_OBJ_HANDLE if the handle is not valid
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@retval 0 if the operation is succesful
@retval FSF_ERR_INVALID_SYNCH_OBJ_HANDLE is the handle is not valid
@retval FSF_ERR_BAD_ARGUMENT if synch_handle is 0
@retval FSF_ERR_INVALID_SYNCH_OBJ_HANDLE if the handle is not valid
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
]
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
 
@sa fsf_create_synch_obj
@see fsf_create_synch_obj
*/
int
fsf_destroy_synch_obj
(fsf_synch_obj_handle_t synch_handle);
 
// In the future we may add a broadcast operation that would signal a
// group of synchronization objects. We have not included a broadcast
// service in this version because it can be easily created by the
// user by signalling individual synchronization objects inside a
// loop.
 
// Notice that for synchronization objects there is no naming service
// like in shared objects because tasks that use synchronization are
// not developed independently, as they are closely coupled.
 
 
////////////////////////////////////////////////////
// SCHEDULING BOUNDED WORKLOADS
////////////////////////////////////////////////////
482,24 → 430,19
parameter is set to NULL, no action is
taken.
 
@returns 0 if the operation is succesful
@returns FSF_ERR_TIME_SPEC_IN_THE_PAST if the absolute time specification
is in the past.
[ERR@RETURNED:
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_INTERNAL_ERROR : erroneous binding or malfunction of the FSF
@retval 0 if the operation is succesful
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction of the FSF
main scheduler
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not scheduled
under the FSF
FSF_ERR_UNBOUND_THREAD : if the calling thread does not have a valid
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is
not scheduled under the FSF
@retval FSF_ERR_UNBOUND if the calling thread does not have a valid
server bound to it
FSF_ERR_BAD_ARGUMENT : if abs_time is NULL
FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE: if the kind of workload of the server
is not FSF_BOUNDED
]
@retval FSF_ERR_BAD_ARGUMENT if the workload of the server is not
FSF_BOUNDED
 
@sa fsf_schedule_triggered_job, fsf_timed_schedule_triggered_job
 
*/
int
fsf_schedule_timed_job
509,7 → 452,6
bool *was_deadline_missed,
bool *was_budget_overran);
 
 
/**
This operation is invoked by threads associated with bounded
workload servers to indicate that a job has been completed (and
520,34 → 462,62
server will wait upon the specified synchronization object, the
server's budget will be made zero for the remainder of the server's
period, and the implementation will not replenish the budget until
the specified synchronization object is signalled. At that time,
all pending budget replenishments (if any) are made effective. Once
the server has a positive budget and the scheduler schedules the
calling thread again, the call returns and at that time, except for
those parameters equal to NULL pointers, the system reports the
current period and budget for the current job, whether the deadline
of the previous job was missed or not, and whether the budget of
the previous job was overrun or not.
the specified synchronization object is signalled.
 
At that time, all pending budget replenishments (if any) are made
effective. Once the server has a positive budget and the scheduler
schedules the calling thread again, the call returns and at that
time, except for those parameters equal to NULL pointers, the
system reports the current period and budget for the current job,
whether the deadline of the previous job was missed or not, and
whether the budget of the previous job was overrun or not.
 
In a system with hierarchical scheduling, since this call makes the
budget zero, the other threads in the same server are not run. As
mentioned above, only when the call finishes the budget may be
replenished.
 
[ERR@RETURNED:
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_INTERNAL_ERROR : erroneous binding or malfunction of the FSF
main scheduler
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not scheduled
under the FSF
FSF_ERR_UNBOUND_THREAD : if the calling thread does not have a valid
server bound to it
FSF_ERR_BAD_ARGUMENT : if the synch_handle given is not valid
FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE: if the kind of workload of the server
is not FSF_BOUNDED
]
@param [in] synch_handle handle of the synchronization object
 
@param [out] next_budget upon return of this function, the variable
pointed by this function will be equal
to the current server budget. If this
parameter is set to NULL, no action is
taken.
@param [out] next_period upon return of this function, the variable
pointed by this function will be equal to
the current server period. If this parameter is
set to NULL, no action is taken.
 
@param [out] was_deadline_missed upon return of this function, the
variable pointed by this function will be
equal to true if the previous server deadline
was missed, to false otherwise. If this
parameter is set to NULL, no action is
taken.
 
@param [out] was_budget_overrun upon return of this function, the
variable pointed by this function will be
equal to true if the previous server budget was
overrun, to false otherwise. If this
parameter is set to NULL, no action is
taken.
 
@retval 0 if the operation is succesful
@retval FSF_ERR_INVALID_SYNCH_OBJ_HANDLE if the handle is not valid
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
running
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction of
the FSF main scheduler
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread
is not scheduled under the FSF
@retval FSF_ERR_UNBOUND if the calling thread does not have
a valid server bound to it
@retval FSF_ERR_BAD_ARGUMENT if the workload of the server is not
FSF_BOUNDED or the synch_handle given is not valid
 
@sa fsf_schedule_triggered_job, fsf_schedule_timed_job
 
*/
int
fsf_schedule_triggered_job
563,20 → 533,19
absolute timeout. The timed_out argument, indicates whether the
function returned because of a timeout or not
 
[ERR@RETURNED:
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_INTERNAL_ERROR : erroneous binding or malfunction of the FSF
main scheduler
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not scheduled
under the FSF
FSF_ERR_UNBOUND_THREAD : if the calling thread does not have a valid
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction
of the FSF main scheduler
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is
not scheduled under the FSF
@retval FSF_ERR_UNBOUND if the calling thread does not have a valid
server bound to it
FSF_ERR_BAD_ARGUMENT : if the synch_handle given is not valid or the
abs_timeout argument is NULL or its value is in the past
FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE: if the kind of workload of the server
is not FSF_BOUNDED
]
@retval FSF_ERR_BAD_ARGUMENT if the workload of the server is not
FSF_BOUNDED, the synch_handle given is not valid or the abs_timeout
argument is NULL or its value is in the past
 
@see fsf_schedule_triggered_job
*/
int
fsf_timed_schedule_triggered_job
588,9 → 557,6
bool *was_deadline_missed,
bool *was_budget_overran);
 
 
 
 
/*@}*/
 
///////////////////////////////////////////////////////////////////
598,8 → 564,10
///////////////////////////////////////////////////////////////////
 
/**
\defgroup negotiate Negotiate contract functions
\ingroup coremodule
 
\defgroup core_negotiate Negotiate contract functions
 
The following functions are used to create servers for a contract
parameters specification and also to assign one or more threads to
a server (Note: the current implementation only supports one thread
620,7 → 588,6
*/
typedef void * (*fsf_thread_code_t) (void *);
 
 
/**
The operation negotiates a contract for a new server. If the
on-line admission test is enabled it determines whether the
627,25 → 594,31
contract can be admitted or not based on the current contracts
established in the system. Then it creates the server and
recalculates all necessary parameters for the contracts already
present in the system. This is a potentially blocking operation; it
returns when the system has either rejected the contract, or
admitted it and made it effective. It returns zero and places the
server identification number in the location pointed to by the
server input parameter if accepted, or an error if rejected. No
thread is bound to the newly created server, which will be idle
until a thread is bound to it. This operation can only be executed
by threads that are already bound to an active server and therefore
are being scheduled by the fsf scheduler.
present in the system.
 
[ERR@RETURNED:
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_INTERNAL_ERROR : erroneous binding or malfunction of the FSF
main scheduler
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not scheduled
under the FSF
FSF_ERR_BAD_ARGUMENT : if the contract or server arguments are NULL
]
This is a potentially blocking operation; it returns when the
system has either rejected the contract, or admitted it and made it
effective. It returns zero and places the server identification
number in the location pointed to by the server input parameter if
accepted, or an error if rejected. No thread is bound to the newly
created server, which will be idle until a thread is bound to
it. This operation can only be executed by threads that are already
bound to an active server and therefore are being scheduled by the
fsf scheduler.
 
@param [in] contract pointer to the contract
@param [out] server server id
 
@retval 0 if the call is succesful
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
running
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction of the FSF
main scheduler
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD
if the calling thread is not scheduled
under the FSF
@retval FSF_ERR_BAD_ARGUMENT if the contract or server arguments
are NULL
*/
int
fsf_negotiate_contract
652,7 → 625,6
(const fsf_contract_parameters_t *contract,
fsf_server_id_t *server);
 
 
/**
This operation negotiates a contract for a new server, creates a
thread and binds it to the server. If the contract is accepted, the
661,26 → 633,32
POSIX function call, and attaches it to the fsf scheduler. Then, it
binds the created thread to the new server. It returns zero and
puts the server identification number in the location pointed to by
the server input parameter. The attr parameter is overwritten as
necessary to introduce the adequate scheduling policy and priority,
according to the preemption level given in the contract and the
fsf_priority_map() function defined by the user. If the contract is
rejected, the thread is not created and the corresponding error is
returned.
the server input parameter.
 
The attr parameter is overwritten as necessary to introduce the
adequate scheduling attributes, according to the information given
in the contract.
 
The server is created with the FSF_NONE scheduling policy, which
means no hierarchical scheduling, and only one thread per server,
except for the case of background tasks (see below)
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the contract or server arguments are NULL
FSF_ERR_CONTRACT_REJECTED : if the contract is rejected.
FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE: if the kind of workload
in the contract is FSF_OVERHEAD
If the contract is rejected, the thread is not created and the
corresponding error is returned.
 
@param [in] contract pointer to the contract
@param [out] server server id
@param [out] thread thread id
@param [in] attr threads attributes
@param [in] thread_code pointer to the function that implements
the thread
@param [in] arg arguments for the thread
 
@retval FSF_ERR_BAD_ARGUMENT if the contract or server arguments are NULL
@retval FSF_ERR_CONTRACT_REJECTED if the contract is rejected
It may also return all the errors that may be returned by the
pthread_create()POSIX function call
]
@retval others it may also return all the errors that may be returned
by the pthread_create()POSIX function call
 
*/
int
711,15 → 689,15
thread will have the SCHED_APP scheduling policy and will be
attached to the fsf scheduler.
 
[ERR@RETURNED:
FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD : if the thread is attached to
@param [in] contract pointer to the contract
@param [out] server id
@retval 0 if the contract negotation is succesful
@retval FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD if the thread is attached to
an application defined scheduler different than the fsf scheduler
FSF_ERR_BAD_ARGUMENT : if the contract or server arguments are NULL
FSF_ERR_CONTRACT_REJECTED : if the contract is rejected.
FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE: if the kind of workload
in the contract is FSF_OVERHEAD
]
 
@retval FSF_ERR_BAD_ARGUMENT if the contract or server arguments
are NULL
@retval FSF_ERR_CONTRACT_REJECTED if the contract is rejected.
*/
int
fsf_negotiate_contract_for_myself
728,17 → 706,13
 
 
/**
fsf_bind_thread_to_server: This operation associates a thread with
a server, which means that it starts consuming the server's budget
and is executed according to the contract established for that
server. If the thread is already bound to another server, it is
effectively unbound from it and bound to the specified one.
This operation associates a thread with a server, which means that
it starts consuming the server's budget and is executed according
to the contract established for that server. If the thread is
already bound to another server, and error is returned.
 
It fails if the server's policy is different than FSF_NONE, or if
there is already a thread bound to this server
[JULIO: it should not fail if the thread is bound to other thread
in this case the server shall be unbind and bind to the given one
]
 
Implementation dependent issue: In order to allow the usage of
application defined schedulers, the given thread must not have the
745,17 → 719,19
scheduling policy SCHED_APP and at the same time be attached to an
application scheduler different than the fsf scheduler.
 
[ERR@RETURNED:
FSF_ERR_INTERNAL_ERROR : erroneous binding or malfunction of the FSF
main scheduler
FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD : if the thread is attached to
@param [in] server id
@param [in] thread id
 
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction
of the FSF main scheduler
@retval FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD if the thread is attached to
an application defined scheduler different than the fsf scheduler
FSF_ERR_BAD_ARGUMENT : if the server value does not complain with the
@retval FSF_ERR_BAD_ARGUMENT if the server value does not complain with the
expected format or valid range or the given thread does not exist
FSF_ERR_NOT_CONTRACTED_SERVER : if the referenced server is not valid
FSF_ERR_SERVER_WORKLOAD_NOT_COMPATIBLE: if the kind of workload
of the server is FSF_OVERHEAD
]
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the referenced server
is not valid
@retval FSF_ERR_ALREADY_BOUND if the thread is already bound to
another server.
 
*/
int
776,18 → 752,18
application scheduler, the thread is still attached to the fsf
scheduler, but suspended.
 
[ERR@RETURNED:
FSF_ERR_INTERNAL_ERROR : erroneous binding or malfunction of the FSF
@param [in] thread thread id
 
@retval 0 if the operation is succesful
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction of the FSF
main scheduler
FSF_ERR_BAD_ARGUMENT : if the given thread does not exist
FSF_ERR_NOT_SCHEDULED_THREAD : if the given thread is not scheduled
@retval FSF_ERR_BAD_ARGUMENT if the given thread does not exist
@retval FSF_ERR_NOT_SCHEDULED_THREAD if the given thread is not scheduled
under the FSF
FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD : if the thread is attached to
@retval FSF_ERR_UNKNOWN_APPSCHEDULED_THREAD if the thread is attached to
an application defined scheduler different than the fsf scheduler
FSF_ERR_UNBOUND_THREAD : if the given thread does not have a valid
@retval FSF_ERR_NOT_BOUND if the given thread does not have a valid
server bound to it
]
 
*/
int
fsf_unbind_thread_from_server (pthread_t thread);
798,15 → 774,16
an error if the thread does not exist, it is not under the control
of the scheduling framework, or is not bound.
 
[ERR@RETURNED:
FSF_ERR_NOT_SCHEDULED_THREAD : if the given thread is not scheduled
@param [in] thread thread id
@param [out] server server
 
@retval 0 if the operation is succesful
@retrun FSF_ERR_NOT_SCHEDULED_THREAD if the given thread is not scheduled
under the FSF
FSF_ERR_UNBOUND_THREAD : if the given thread does not have a valid
@retrun FSF_ERR_UNBOUND if the given thread does not have a valid
server bound to it
FSF_ERR_BAD_ARGUMENT : if the given thread does not exist or the
@retrun FSF_ERR_BAD_ARGUMENT if the given thread does not exist or the
server argument is NULL
]
 
*/
int
fsf_get_server
818,16 → 795,18
with the specified server in the variable pointed to by
contract. It returns an error if the server id is incorrect.
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the contract argument is NULL or the value
of the server argument is not in range
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@param [in] server server id
@param [out] contract pointer to the contract structure
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if the contract argument is
NULL or the value of the server argument is not in range
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
]
 
*/
int
fsf_get_contract
840,15 → 819,16
remaining in the system. This is a potentially blocking operation;
it returns when the system has made the changes effective.
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the value of server is not in range
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
has been cancelled or it is not valid
]
@param [in] server server id
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if the value of server is not in range
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
*/
int
fsf_cancel_contract (fsf_server_id_t server);
866,16 → 846,18
either rejected the new contract, or admitted it and made it
effective.
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the new_contract argument is NULL or the
@param [in] new_contract a pointer to the new contract
@param [in] server server id
 
@retval 0 if the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if the new_contract argument is NULL or the
value of the server argument is not in range
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
]
 
*/
int
fsf_renegotiate_contract
882,34 → 864,44
(const fsf_contract_parameters_t *new_contract,
fsf_server_id_t server);
 
 
/**
The operation enqueues a renegotiate operation for an existing
server, and returns immediately. The renegotiate operation is
performed asynchronously, as soon as it is practical; meanwhile the
system operation will continue normally. When the renegotiation is
made, if the on-line admission test is enabled it determines
whether the contract can be admitted or not based on the current
contracts established in the system. If it cannot be admitted, the
old contract remains in effect. If it can be admitted, it
recalculates all necessary parameters for the contracts already
present in the system. When the operation is completed,
notification is made to the caller, if requested, via a signal. The
status of the operation (in progress, admitted, rejected) can be
checked with the get_renegotiation_status operation. The argument
sig_notify can be NULL_SIGNAL (no notification), or any posix
signal; and in this case sig_value is to be sent with the signal.
performed asynchronously and the calling thread may continue
executing normally. Of course, wheter the operation is performed
immediately or not depends on the relative priority of the service
thread and the calling thread, on the scheduler used, etc.
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the new_contract argument is NULL, the
When the renegotiation is completed, if the on-line admission test
is enabled it determines whether the contract can be admitted or
not based on the current contracts established in the system. If it
cannot be admitted, the old contract remains in effect. If it can
be admitted, it recalculates all necessary parameters for the
contracts already present in the system. When the operation is
completed, notification is made to the caller, if requested, via a
signal. The status of the operation (in progress, admitted,
rejected) can be checked with the get_renegotiation_status
operation. The argument sig_notify can be NULL_SIGNAL (no
notification), or any POSIX signal; and in this case sig_value is
to be sent with the signal.
 
@param [in] new_contract pointer to the new contract to be negotiated
@param [in] server server id
@param [in] sig_notify NULL (no signal) or any POSIX signal
@param [in] sign_value a sigval structure that contains values to be
passed to the signal handler. Valid only if sig_notify
is different from NULL.
 
@retval 0 if the call is succesful
@retval FSF_ERR_BAD_ARGUMENT if the new_contract argument is NULL, the
value of the server argument is not in range or sig_notify is
neither NULL nor a valid POSIX signal
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
]
 
*/
int
933,16 → 925,18
after notification of the completion of such operation, if
requested.
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the renegotiation_status argument is
@param [in] server server id
@param [out] renegotiation_status the status of the renegotiation;
 
@retval 0 if succesful completion;
@retval FSF_ERR_BAD_ARGUMENT if the renegotiation_status argument is
NULL or the value of the server argument is not in range
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
]
 
*/
int
fsf_get_renegotiation_status
949,6 → 943,62
(fsf_server_id_t server,
fsf_renegotiation_status_t *renegotiation_status);
 
 
//Data types
 
/// List of contracts to negotiate
typedef struct {
int size;
fsf_contract_parameters_t* contracts[FSF_MAX_N_SERVERS];
} fsf_contracts_group_t;
 
/// List of servers to cancel
typedef struct {
int size;
fsf_server_id_t servers[FSF_MAX_N_SERVERS];
} fsf_servers_group_t;
 
 
/**
This operation analizes the schedulability of the context that
results from negitiating the contracts specified in the
contracts_up list and cacelling the contracts referenced by the
servers_down list. If the overall negotiation is successful, a new
server will be created for each of the elements of the contracts_up
group, the servers in servers_down will be cancelled, the list of
new server ids will be returned in the variable pointed to by
servers_up, and the variable pointed to by accepted will be made
true. Otherwise, this variable will be made false, and no other
effect will take place. The function returns the corresponding
error code if any of the contracts is not correct or any of the
server is is not valid.
 
@param [in] contracts_up list of contracts to negotiate
@param [in] contracts_down list of contracts to be canceled
@param [out] servers_up list of server ids that have been created, they are
given in the same order as the contract_up list of contracts;
@param [out] accepted if the operation is succesful;
 
@retval 0 if succesful completion;
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_INTERNAL_ERROR erroneous binding or malfunction of the FSF
main scheduler
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is
not scheduled under the FSF
@retval FSF_ERR_BAD_ARGUMENT if any of the servers_up or accepted arguments
is NULL, if the contracts_up and servers_down arguments are both NULL,
or any of them has erroneous size or its elements are NULL or not in the
valid range respectively
*/
int
fsf_negotiate_group
(const fsf_contracts_group_t *contracts_up,
const fsf_servers_group_t *severs_down,
fsf_servers_group_t *severs_up,
bool *accepted);
 
 
/*@}*/
 
 
958,9 → 1008,20
 
 
/**
Returns true if the system is
configured with the on-line admission test enabled, or false
otherwise.
\ingroup coremodule
 
\defgroup core_sched_info Obtaining information from the scheduler.
 
This group of function is used to get informations from the
scheduler, like execution time of a task, remaining budget of a
server, etc.
 
@{
*/
 
/**
Returns true if the system is configured with the on-line admission
test enabled, or false otherwise.
*/
bool
fsf_is_admission_test_enabled();
970,16 → 1031,20
threads bound to the specified server in the variable pointed to by
cpu_time.
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the value of the server argument is not in range or
cpu_time is NULL
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@param [in] server server id
@param [out] cpu_time pointer to a timespec structure that will contain
the cpu time consumed by the threads that are bound to the
specific server, since its creation.
 
@retval 0 if succesful completion
@retval FSF_ERR_BAD_ARGUMENT if the value of the server argument is
not in range or cpu_time is NULL
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
]
 
*/
int
fsf_get_cpu_time
989,18 → 1054,21
/**
This function stores in the variable pointed to by budget the
remaining execution-time budget associated with the specified
server
server.
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the value of the server argument is not in range or
budget is NULL
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@param [in] server server id
@param [out] budget pointer to a timespec structure that will
contain the remaining budget
 
@retval 0 if succesful completion
@retval FSF_ERR_BAD_ARGUMENT if the value of the server argument is
not in range or budget is NULL
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
]
 
*/
int
fsf_get_remaining_budget
1009,21 → 1077,24
 
 
/**
This function stores in the variables
pointed to by budget and period, the execution-time budget and the
period respectively associated with the specified server. If any of
these pointers is NULL, the corresponding information is not stored.
This function stores in the variables pointed to by budget and
period, the execution-time budget and the period respectively
associated with the specified server. If any of these pointers is
NULL, the corresponding information is not stored.
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if the value of the server argument is not in range,
budget is NULL or period is NULL
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@param [in] server server id
@param [out] budget budget available for the current server instance
@param [out] period period available for the current server instance
 
@retval 0 if succesful completion
@retval FSF_ERR_BAD_ARGUMENT if the value of the server argument is
not in range, budget is NULL or period is NULL
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or not
running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
]
 
*/
int
fsf_get_budget_and_period
1031,47 → 1102,66
struct timespec *budget,
struct timespec *period);
 
/* @} */
 
 
/////////////////////////////////////////////////////////////////////
// SERVICE THREAD TUNING
/////////////////////////////////////////////////////////////////////
 
/**
This function allows the application to
change the period and budget of the service thread that makes the
\ingroup coremodule
 
\defgroup core_service_thread Service Thread
 
These functions are to the initialization and tuning of the service
thread.
 
@todo specify that the default budget and periods are in the
configuration file.
 
Implementation dependency: in the fixed priority implementation of
fsf, the default priority is lower than the priority of any server,
but higher than the background. According to the
implementation-dependent module the priority is adjustable by means
of a function that changes its preemption level.
 
@{
*/
 
 
/**
This function allows the application to change the period and
budget of the service thread that makes the
negotiations. Increasing the utilization of this thread makes the
negotiations faster, but introduces additional load in the system
that may decrease the bandwidth available for the servers. For this
call, the system will make a schedulability analysis to determine if
the new situation is acceptable or not. This is reported back in the
variable pointed to by accepted. If the new service thread data is
accepted, the system will reassign budgets and periods to the
servers according to the new bandwidth available, in the same way as
it does for a regular contract negotiation.
call, the system will make a schedulability analysis to determine
if the new situation is acceptable or not. This is reported back in
the variable pointed to by accepted. If the new service thread data
is accepted, the system will reassign budgets and periods to the
servers according to the new bandwidth available, in the same way
as it does for a regular contract negotiation.
When its budget is exhausted, the service thread may run in the
background
background.
 
The service thread starts with a default budget and period that are
configurable
configurable.
Implementation dependency: in the fixed priority implementtaion of
fsf, the default priority is lower than the priority of any server,
but higher than the background. According to the
implementation-dependent module the priority is adjustable by means
of a function that changes its preemption level
@param [in] budget budget for the service thread
@param [in] period for the service thread
@param [out] accepted true is the change has been accepted
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if any of the pointer arguments is NULL or
 
@retval 0 is the operation is succesful
@retval FSF_ERR_BAD_ARGUMENT if any of the pointer arguments is NULL or
the budget value is greater than the period value
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong or
not running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
]
 
*/
int
fsf_set_service_thread_data
1083,16 → 1173,17
this function returns in the variables pointed by budget and
period, respectively, the current budget and period of the service
thread.
@param [out] budget current budget of the service thread
@param [out] period current period of the service thread
 
[ERR@RETURNED:
FSF_ERR_BAD_ARGUMENT : if any of the pointer arguments is NULL
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not
@retval FSF_ERR_BAD_ARGUMENT if any of the pointer arguments is NULL
@retval FSF_ERR_NOT_SCHEDULED_CALLING_THREAD if the calling thread is not
scheduled under the FSF
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_NOT_CONTRACTED_SERVER : if the server of the calling thread
@retval FSF_ERR_INVALID_SCHEDULER_REPLY the scheduler is wrong
or not running
@retval FSF_ERR_NOT_CONTRACTED_SERVER if the server of the calling thread
has been cancelled or it is not valid
]
 
*/
int
fsf_get_service_thread_data
1099,110 → 1190,32
(struct timespec *budget,
struct timespec *period);
/* @} */
 
////////////////////////////////////////////////////////////////////////
// BACKGROUND MANAGEMENT
////////////////////////////////////////////////////////////////////////
 
//A round-robin background scheduling policy is available for those
//threads that do not have real-time requirements. Because some of
//these threads may require sharing information with other threads run
//by regular servers, special background contracts may be created for
//specifying the synchronization requirements.
 
//The way of specifying a background contract is by setting budget_min
//= period_max = 0. Negotiation may fail if the contract uses
//shared_objects. If the contract has no shared_objects the returned
//server id represents the background and may be used to bind more
//than one thread. If the contract has shared objects a server is
//created to keep track of them, but the associated threads are
//executed in the background, together with the other background
//threads
 
 
////////////////////////////////////////////////////////////////////////
// CHANGE OF MODE: GROUPS OF CONTRACTS
////////////////////////////////////////////////////////////////////////
 
//Data types
 
//list of contracts to negotiate
typedef struct {
int size;
fsf_contract_parameters_t* contracts[FSF_MAX_N_SERVERS];
} fsf_contracts_group_t;
 
//list of servers to cancel
typedef struct {
int size;
fsf_server_id_t servers[FSF_MAX_N_SERVERS];
} fsf_servers_group_t;
 
 
/**
This operation analizes the schedulability of
the context that results from negitiating the contracts specified in
the contracts_up list and cacelling the contracts referenced by the
servers_down list. If the overall negotiation is successful, a new
server will be created for each of the elements of the contracts_up
group, the servers in servers_down will be cancelled, the list of
new server ids will be returned in the variable pointed to by
servers_up, and the variable pointed to by accepted will be made
true. Otherwise, this variable will be made false, and no other
effect will take place. The function returns the corresponding error
code if any of the contracts is not correct or any of the server ids
is not valid.
[JULIO: I think it would be clarifying to say that, in order to be
able to receive the returned arguments, the calling thread's server
should not be in the servers_down list.
 
[ERR@RETURNED:
FSF_ERR_INVALID_SCHEDULER_REPLY : the scheduler is wrong or not running
FSF_ERR_INTERNAL_ERROR : erroneous binding or malfunction of the FSF
main scheduler
FSF_ERR_NOT_SCHEDULED_CALLING_THREAD : if the calling thread is not scheduled
under the FSF
FSF_ERR_BAD_ARGUMENT : if any of the servers_up or accepted arguments
is NULL, if the contracts_up and servers_down arguments are both NULL,
or any of them has erroneous size or its elements are NULL or not in the
valid range respectively
]
A round-robin background scheduling policy is available for those
threads that do not have real-time requirements. Because some of
these threads may require sharing information with other threads
run by regular servers, special background contracts may be created
for specifying the synchronization requirements.
 
*/
int
fsf_negotiate_group
(const fsf_contracts_group_t *contracts_up,
const fsf_servers_group_t *severs_down,
fsf_servers_group_t *severs_up,
bool *accepted);
The way of specifying a background contract is by setting
budget_min = period_max = 0. Negotiation may fail if the contract
uses shared_objects. If the contract has no shared_objects the
returned server id represents the background and may be used to
bind more than one thread. If the contract has shared objects a
server is created to keep track of them, but the associated threads
are executed in the background, together with the other background
threads
 
 
//////////////////////////////////////////////////////////////////////
// INITIALIZATION SERVICES
//////////////////////////////////////////////////////////////////////
 
 
/**
We cannot call any fsf functions before fsf_init. After calling
fsf_init, the main will be executing in the background. Then, it
can do the negotiations, create the threads and, if needed,
activate them via some user-specified synchronization mechanism. It
may also create a contract for itself. The second time this
function is called it fails.
 
[ERR@RETURNED:
FSF_ERR_SYSTEM_ALREADY_INITIALIZED : if the function has already
been called before
It may also return any of the errors that may be returned by the
underlying operating system primitives required to perform the
FSF system start up
]
 
@todo [PEPPE: this will be put in the general description of the core
module]
*/
int fsf_init();
 
/*@}*/
 
 
#endif // _FSF_CORE_H_