Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1176 → Rev 1175

/demos/trunk/first/posixstar.c
File deleted
/demos/trunk/first/makefile
7,7 → 7,7
endif
include $(BASE)/config/config.mk
 
PROGS= test1 test2 test3 test4 test5 test6 test7 testiq
PROGS= test1 test2 test3 test4 test5 test6 testiq
 
include $(BASE)/config/example.mk
 
29,8 → 29,5
test6:
make -f $(SUBMAKE) APP=test6 INIT= OTHEROBJS="rmstar.o cbsstar.o" OTHERINCL= SHARKOPT=__OLDCHAR__
 
test7:
make -f $(SUBMAKE) APP=test7 INIT= OTHEROBJS="posixstar.o cbsstar.o" OTHERINCL= SHARKOPT=__OLDCHAR__
 
#testiq:
# make -f $(SUBMAKE) APP=testiq INIT= OTHEROBJS="iqueue.o " OTHERINCL=
/demos/trunk/first/cbsstar.c
20,11 → 20,11
 
/*
------------
CVS : $Id: cbsstar.c,v 1.5 2003-06-18 08:13:01 trimarchi Exp $
CVS : $Id: cbsstar.c,v 1.4 2003-01-07 17:10:16 pj Exp $
 
File: $File$
Revision: $Revision: 1.5 $
Last update: $Date: 2003-06-18 08:13:01 $
Revision: $Revision: 1.4 $
Last update: $Date: 2003-01-07 17:10:16 $
------------
 
Read CBSSTAR.h for general details.
75,8 → 75,10
* DEBUG stuffs begin
*/
 
#ifdef CBSSTAR_DEBUG_OLD
//#define CBSSTAR_DEBUG
 
#ifdef CBSSTAR_DEBUG
 
static __inline__ void fake_printf(char *fmt, ...) {}
 
//#define cbsstar_printf kern_printf
87,8 → 89,8
#define cbsstar_printf2 fake_printf
#define cbsstar_printf3 fake_printf
 
#if 0
void cbsstar_printq(IQUEUE *q)
#if 0
void cbsstar_printq(QQUEUE *q)
{
PID p;
kern_printf("[");
104,7 → 106,7
static __inline__ void cbsstar_printq(QQUEUE *q) {}
#endif
 
#if 0
#if 0
static __inline__ void cbsstar_printblob(int x) { if (x) cputc('±'); else cputc('Û'); }
#else
static __inline__ void cbsstar_printblob(int x) {}
121,7 → 123,7
struct budget_struct {
TIME Q; /* budget */
TIME T; /* period */
 
struct timespec dline; /* deadline */
int dline_timer; /* oslib event for budget reactivation*/
int avail; /* current budget */
142,8 → 144,6
int tb[MAX_PROC]; /* link task->budget (used in guest_end) */
 
bandwidth_t U; /*+ the used bandwidth by the server +*/
int cap_lev;
 
LEVEL scheduling_level;
 
185,11 → 185,10
*/ /* we modify the deadline ... */
TIMESPEC_ASSIGN(&b->dline, acttime);
ADDUSEC2TIMESPEC(b->T, &b->dline);
 
/* and the capacity */
b->avail = b->Q;
 
 
#ifdef CBSSTAR_DEBUG
cbsstar_printf3("±%d±",lev->tb[p]);
cbsstar_printblob(lev->tb[p]);
202,7 → 201,7
#ifdef CBSSTAR_DEBUG
cbsstar_printf("(C:iact p%d %ld.%ld av=%d)",p,b->dline.tv_sec,b->dline.tv_nsec/1000, b->avail);
#endif
//kern_printf("Pid %d, Act %d, Dd %d", p,acttime->tv_nsec/1000,(b->dline).tv_nsec/1000);
 
/* and, finally, we reinsert the task in the master level */
job_task_default_model(job, b->dline);
job_task_def_noexc(job);
260,7 → 259,7
article because if there is only the standard scheduling policy
this never apply) we reassign the deadline */
 
if ( TIMESPEC_A_LT_B(&b->dline, &schedule_time) ) {
if ( TIMESPEC_A_LT_B(&b->dline, &schedule_time) ) {
/* we kill the current activation */
level_table[ lev->scheduling_level ]->
private_extract(lev->scheduling_level, p);
277,6 → 276,7
cbsstar_printf3("±%d±",lev->tb[p]);
cbsstar_printblob(lev->tb[p]);
#endif
 
/* and, finally, we reinsert the task in the master level */
job_task_default_model(job, b->dline);
job_task_def_noexc(job);
292,7 → 292,6
return 0;
}
 
 
static void CBSSTAR_private_insert(LEVEL l, PID p, TASK_MODEL *m)
{
/* A task has been activated for some reason. Basically, the task is
382,14 → 381,6
iq_extract(p, &lev->b[lev->tb[p]].tasks);
}
 
static void capacity_handler()
{
//kern_printf("!");
event_need_reschedule();
}
 
 
static void CBSSTAR_private_dispatch(LEVEL l, PID p, int nostop)
{
CBSSTAR_level_des *lev = (CBSSTAR_level_des *)(level_table[l]);
413,8 → 404,8
if (!nostop) {
TIMESPEC_ASSIGN(&ty, &schedule_time);
ADDUSEC2TIMESPEC(lev->b[lev->tb[p]].avail,&ty);
lev->cap_lev = kern_event_post(&ty, capacity_handler, NULL);
}
cap_timer = kern_event_post(&ty, capacity_timer, NULL);
}
}
 
static void CBSSTAR_private_epilogue(LEVEL l, PID p)
422,16 → 413,12
CBSSTAR_level_des *lev = (CBSSTAR_level_des *)(level_table[l]);
struct budget_struct *b = &lev->b[lev->tb[p]];
 
#ifdef CBSSTAR_DEBUG
#ifdef CBSSTAR_DEBUG
cbsstar_printf("(C:gepi %d",p);
#endif
#endif
 
CBSSTAR_account_capacity(lev,p);
 
if (lev->cap_lev!=NIL)
kern_event_delete(lev->cap_lev);
lev->cap_lev=NIL;
 
/* we have to check if the capacity is still available */
if (b->avail > 0) {
/* there is capacity available, maybe it is simply a preemption;
438,11 → 425,10
the task have to return to the ready queue */
level_table[ lev->scheduling_level ]->
private_epilogue(lev->scheduling_level,p);
#ifdef CBSSTAR_DEBUG
cbsstar_printf(" *av=%d", b->avail);
#endif
#ifdef CBSSTAR_DEBUG
cbsstar_printf2(" *av=%d", b->avail);
#endif
} else {
 
/* The capacity is exausted; the deadline have to be postponed and
the task have to be reinserted in the master module */
JOB_TASK_MODEL job;
457,14 → 443,15
while (b->avail <= 0) {
ADDUSEC2TIMESPEC(b->T, &b->dline);
b->avail += b->Q;
#ifdef CBSSTAR_DEBUG
cbsstar_printf("±%d±",b->avail);
#endif
#ifdef CBSSTAR_DEBUG
cbsstar_printf3("±%d±",lev->tb[p]);
cbsstar_printblob(lev->tb[p]);
#endif
}
 
#ifdef CBSSTAR_DEBUG
kern_printf(" %ld.%ld av=%d",b->dline.tv_sec,b->dline.tv_nsec/1000, b->avail);
#endif
#ifdef CBSSTAR_DEBUG
cbsstar_printf2(" %ld.%ld av=%d",b->dline.tv_sec,b->dline.tv_nsec/1000, b->avail);
#endif
/* and, finally, we reinsert the task in the master level */
job_task_default_model(job, b->dline);
475,7 → 462,6
#ifdef CBSSTAR_DEBUG
cbsstar_printf(")");
#endif
}
 
 
524,11 → 510,12
 
lev->n = n;
lev->freebudgets = 0;
 
for (i=0; i<MAX_PROC; i++)
lev->tb[i] = NIL;
 
lev->U = 0;
lev->cap_lev=NIL;
 
lev->scheduling_level = master;
 
return l;
/demos/trunk/first/edfstar.c
18,11 → 18,11
 
/**
------------
CVS : $Id: edfstar.c,v 1.5 2003-06-18 08:13:02 trimarchi Exp $
CVS : $Id: edfstar.c,v 1.4 2003-01-07 17:10:16 pj Exp $
 
File: $File$
Revision: $Revision: 1.5 $
Last update: $Date: 2003-06-18 08:13:02 $
Revision: $Revision: 1.4 $
Last update: $Date: 2003-01-07 17:10:16 $
------------
**/
 
264,7 → 264,7
return 0; /* OK, also if the task cannot be guaranteed... */
}
 
static int EDFSTAR_public_eligible(LEVEL l, PID p)
static int EDFSTAR_task_eligible(LEVEL l, PID p)
{
EDFSTAR_level_des *lev = (EDFSTAR_level_des *)(level_table[l]);
 
586,7 → 586,6
lev->l.private_epilogue = EDFSTAR_private_epilogue;
 
lev->l.public_guarantee = NULL;
lev->l.public_eligible = EDFSTAR_public_eligible;
lev->l.public_create = EDFSTAR_public_create;
lev->l.public_end = EDFSTAR_public_end;
lev->l.public_dispatch = EDFSTAR_public_dispatch;