/shark/trunk/ports/first/include/comm_message.h |
---|
File deleted |
/shark/trunk/ports/first/include/posix.h |
---|
File deleted |
/shark/trunk/ports/first/include/grubstar.h |
---|
0,0 → 1,182 |
/* |
* Project: S.Ha.R.K. |
* |
* Coordinators: |
* Giorgio Buttazzo <giorgio@sssup.it> |
* Paolo Gai <pj@gandalf.sssup.it> |
* |
* Authors : |
* Paolo Gai <pj@gandalf.sssup.it> |
* Massimiliano Giorgi <massy@gandalf.sssup.it> |
* Luca Abeni <luca@gandalf.sssup.it> |
* (see the web pages for full authors list) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
* http://retis.sssup.it |
* http://shark.sssup.it |
*/ |
/* |
------------ |
CVS : $Id: grubstar.h,v 1.1 2003-09-30 09:26:57 giacomo Exp $ |
File: $File$ |
Revision: $Revision: 1.1 $ |
Last update: $Date: 2003-09-30 09:26:57 $ |
------------ |
This file contains the budget support for the multiapplication |
scheduling algorithm proposed in the framework of the FIRST Project |
Title: |
CBSSTAR |
Task Models Accepted: |
None! |
Guest Models Accepted: |
BUDGET_TASK_MODEL - A task that is attached to a budget |
int b; --> the number of the budget which the task is attached to |
Description: |
This module schedule its tasks following the CBS scheme. |
Every task is inserted using the guest calls. |
The module defines a limited set of budgets that the application |
can use. Every guest task will use a particular budget; FIFO |
scheduling is used inside a budget to schedule more than one ready |
task attached to the same budget. |
The tasks are inserted in an EDF level (or similar) with a JOB_TASK_MODEL, |
and the CBS level expects that the task is scheduled with the absolute |
deadline passed in the model. |
This module tries to implement a simplified version of the guest |
task interface: |
- To insert a guest task, use guest_create |
- When a task is dispatched, use guest_dispatch |
- When a task have to be suspended, you have to use: |
-> preemption: use guest_epilogue |
-> synchronization, end: use guest_end |
Remember: no check is done on the budget number passed with the model!!! |
Exceptions raised: |
XUNVALID_TASK |
This level doesn't support normal tasks, but just guest tasks. |
When a task operation is called, an exception is raised. |
Restrictions & special features: |
- This level doesn't manage the main task. |
- At init time we have to specify: |
. guarantee check |
(when all task are created the system will check that the task_set |
will not use more than the available bandwidth) |
- A function to return the used bandwidth of the level is provided. |
- A function is provided to allocate a buffer. |
*/ |
/* |
* Copyright (C) 2002 Paolo Gai |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#ifndef __CBSSTAR_H__ |
#define __CBSSTAR_H__ |
#include <kernel/kern.h> |
//#include <ll/ll.h> |
//#include <kernel/config.h> |
//#include <sys/types.h> |
//#include <kernel/types.h> |
//#include <modules/codes.h> |
/* ----------------------------------------------------------------------- |
BUDGET_TASK_MODEL: a model for guest tasks |
----------------------------------------------------------------------- */ |
#define BUDGET_PCLASS 0x0600 |
typedef struct { |
TASK_MODEL t; |
int b; |
} BUDGET_TASK_MODEL; |
#define budget_task_default_model(m,buf) \ |
task_default_model((m).t, BUDGET_PCLASS), \ |
(m).b = (buf); |
/* some constants for registering the Module in the right place */ |
#define CBSSTAR_LEVELNAME "CBSSTAR" |
#define CBSSTAR_LEVEL_CODE 106 |
#define CBSSTAR_LEVEL_VERSION 1 |
typedef struct { |
int command; |
void *param; |
} CBSSTAR_command_message; |
typedef struct { |
int budget; |
TIME T,Q; |
} CBSSTAR_mod_budget; |
/* Registration function: |
int N Maximum number of budgets allocated for the applications |
LEVEL master the level that must be used as master level for the |
CBS tasks |
*/ |
LEVEL CBSSTAR_register_level(int n, LEVEL master); |
/* Allocates a budget to be used for an application. |
Input parameters: |
Q The budget |
T The period of the budget |
Return value: |
0..N The ID of the budget |
-1 no more free budgets |
-2 The budgets allocated locally to this module have bandwidth > 1 |
-3 wrong LEVEL id |
*/ |
int CBSSTAR_setbudget(LEVEL l, TIME Q, TIME T, LEVEL local_scheduler_level, int scheduler_id); |
int CBSSTAR_removebudget(LEVEL l, int budget); |
int CBSSTAR_adjust_budget(LEVEL l, TIME Q, TIME T, int budget); |
int CBSSTAR_getbudgetinfo(LEVEL l, TIME *Q, TIME *T, int budget); |
int CBSSTAR_was_budget_overran(LEVEL l, int budget); |
int CBSSTAR_is_active(LEVEL l, int budget); |
int CBSSTAR_get_local_scheduler_level_from_budget(LEVEL l, int budget); |
int CBSSTAR_get_local_scheduler_level_from_pid(LEVEL l, PID p); |
int CBSSTAR_get_local_scheduler_id_from_budget(LEVEL l, int budget); |
int CBSSTAR_get_local_scheduler_id_from_pid(LEVEL l, PID p); |
#endif |
/shark/trunk/ports/first/include/fsf_contract.h |
---|
18,8 → 18,6 |
#include "fsf_configuration_parameters.h" |
#include "fsf_opaque_types.h" |
#include "posix.h" |
#include "cbsstar.h" |
#include "edfstar.h" |
#include "rmstar.h" |
#include "posixstar.h" |
28,7 → 26,7 |
#define _FSF_CONTRACT_H_ |
/* S.Ha.R.K. Init */ |
int FSF_register_module(int posix_level, int cbsstar_level); |
int FSF_register_module(int server_level); |
////////////////////////////////////////////////////////////////// |
// BASIC TYPES AND CONSTANTS |
92,12 → 90,10 |
#define FSF_ERR_NO_RENEGOTIATION_REQUESTED 2003006 |
#define FSF_ERR_CONTRACT_REJECTED 2003007 |
#define FSF_ERR_TOO_MANY_SERVERS 2003008 |
#define FSF_ERR_BIND_THREAD 2003009 |
#define FSF_ERR_UNBIND_THREAD 2003010 |
#define FSF_ERR_CREATE_THREAD 2003011 |
#define FSF_ERR_SERVER_USED 2003012 |
#define FSF_ERR_INVALID_SERVER 2003013 |
#define FSF_ERR_CREATE_SERVER 2003014 |
#define FSF_ERR_CREATE_THREAD 2003009 |
#define FSF_ERR_SERVER_USED 2003010 |
#define FSF_ERR_INVALID_SERVER 2003011 |
#define FSF_ERR_CREATE_SERVER 2003012 |
////////////////////////////////////////////////////////////// |
// CONTRACT PARAMETERS |
246,11 → 242,15 |
(fsf_contract_parameters_t *contract, |
fsf_scheduler_id_t local_scheduler_id); |
//Description: Set the local scheduler |
int |
fsf_get_local_scheduler_parameter |
(const fsf_contract_parameters_t *contract, |
fsf_scheduler_id_t *local_scheduler_id); |
//Description: Get the local scheduler |
////////////////////////////////////////////////////////////// |
// SYNCHRONIZATION OBJECTS |
////////////////////////////////////////////////////////////// |
334,84 → 334,20 |
//are being scheduled by the fsf scheduler. |
int |
fsf_negotiate_contract_for_new_thread |
(const fsf_contract_parameters_t *contract, |
fsf_server_id_t *server, |
fsf_create_thread |
(fsf_server_id_t server, |
pthread_t *thread, |
pthread_attr_t *attr, |
fsf_thread_code_t thread_code, |
void *arg, |
void *rt_arg); |
void *local_scheduler_arg); |
//Description: This operation negotiates a contract for a new server, |
//creates a thread and binds it to the server. If the contract is |
//accepted, the operation creates a thread with the arguments thread, |
//attr, thread_code and arg as they are defined for the |
//pthread_create() 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. |
//Description: This operation creates a new thread inside a specific |
//server. The local_scheduler_arg parameter is used to pass specific |
//parameters to local scheduler. These parameters are application |
//depented. |
int |
fsf_negotiate_contract_for_myself |
(const fsf_contract_parameters_t *contract, |
fsf_server_id_t *server, |
void *rt_arg); |
//Description: This operation negotiates a contract for a new |
//server, and binds the calling thread to it. If the contract is |
//accepted it returns zero and copies the server identification |
//number in the location pointed to by the server input parameter. |
//If it is rejected, an error is returned. |
//Implementation dependent issue: In order to allow the usage of |
//application defined schedulers, the calling thread must not have the |
//SCHED_APP scheduling policy and at the same time be attached to an |
//application scheduler different than the fsf scheduler; in such case, |
//an error is returned. After a successful call the calling thread |
//will have the SCHED_APP scheduling policy and will be attached to |
//the fsf scheduler. |
int |
fsf_bind_thread_to_server |
(fsf_server_id_t server, |
pthread_t thread, |
void *rt_arg); |
//Description: 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. |
//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. |
//FIRST project development issue: In this phase of the project, only |
//one thread is allowed to be bound to a server, sharing a server by |
//multiple threads is planned to be allowed in the next phase of |
//the project. |
int |
fsf_unbind_thread_from_server (pthread_t thread); |
//Description: This operation unbinds a thread from a server. |
//Since threads with no server associated are not allow to execute, |
//they remain in a dormant state until they are either eliminated or |
//bound again. |
//Implementation dependent issue: in the implementation with an |
//application scheduler, the thread is still attached to the fsf |
//scheduler, but suspended. |
int |
fsf_get_server |
(fsf_server_id_t *server, |
pthread_t thread); |
/shark/trunk/ports/first/include/fsf_server.h |
---|
0,0 → 1,33 |
#ifndef _FSF_SERVER_H_ |
#define _FSF_SERVER_H_ |
#define FSF_CBSSTAR |
#ifdef FSF_CBSSTAR |
#include "cbsstar.h" |
#define SERVER_setbudget CBSSTAR_setbudget |
#define SERVER_adjust_budget CBSSTAR_adjust_budget |
#define SERVER_removebudget CBSSTAR_removebudget |
#define SERVER_get_local_scheduler_id_from_budget CBSSTAR_get_local_scheduler_id_from_budget |
#define SERVER_get_local_scheduler_id_from_pid CBSSTAR_get_local_scheduler_id_from_pid |
#define SERVER_get_local_scheduler_level_from_budget CBSSTAR_get_local_scheduler_level_from_budget |
#define SERVER_get_local_scheduler_level_from_pid CBSSTAR_get_local_scheduler_level_from_pid |
#define SERVER_getbudgetinfo CBSSTAR_getbudgetinfo |
#endif |
#ifdef FSF_GRUBSTAR |
#include "grubstar.h" |
#define SERVER_setbudget GRUBSTAR_setbudget |
#define SERVER_adjust_budget GRUBSTAR_adjust_budget |
#define SERVER_removebudget GRUBSTAR_removebudget |
#define SERVER_get_local_scheduler_id_from_server GRUBSTAR_get_local_scheduler_id_from_server |
#define SERVER_get_local_scheduler_id_from_pid GRUBSTAR_get_local_scheduler_id_from_pid |
#define SERVER_get_local_scheduler_level_from_server GRUBSTAR_get_local_scheduler_level_from_server |
#define SERVER_get_local_scheduler_level_from_pid GRUBSTAR_get_local_scheduler_level_from_pid |
#endif |
#endif |