18,11 → 18,11 |
|
/** |
------------ |
CVS : $Id: posixstar.c,v 1.1 2003-06-18 08:13:02 trimarchi Exp $ |
CVS : $Id: posixstar.c,v 1.2 2003-08-01 13:20:38 trimarchi Exp $ |
|
File: $File$ |
Revision: $Revision: 1.1 $ |
Last update: $Date: 2003-06-18 08:13:02 $ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-08-01 13:20:38 $ |
------------ |
|
This file contains the scheduling module compatible with POSIX |
128,7 → 128,8 |
|
if ((proc_table[p].control & CONTROL_CAP) && |
(proc_table[p].avail_time <= 0)) { |
proc_table[p].avail_time += proc_table[p].wcet; |
if (proc_table[p].avail_time<=0) |
proc_table[p].avail_time += proc_table[p].wcet; |
//kern_printf("RR policy"); |
iq_extract(p,&lev->ready[prio]); |
iq_insertlast(p,&lev->ready[prio]); |
142,7 → 143,7 |
if (lev->activated != NIL ) { |
level_table[ lev->scheduling_level ]-> |
private_extract(lev->scheduling_level, lev->activated); |
//kern_printf("CBS ext %d", lev->activated); |
//kern_printf("CBS ext %d",p); |
} |
lev->activated = p; |
|
149,10 → 150,7 |
if (p != NIL) { |
BUDGET_TASK_MODEL b; |
budget_task_default_model(b, lev->budget); |
// viene inserito nel CBS |
//#ifdef POSIXSTAR_DEBUG |
//kern_printf("CBS Ins %d",p); |
//#endif |
//kern_printf("(Act %d",p); |
level_table[ lev->scheduling_level ]-> |
private_insert(lev->scheduling_level, p, (TASK_MODEL *)&b); |
} |
234,7 → 232,7 |
POSIXSTAR_level_des *lev = (POSIXSTAR_level_des *)(level_table[l]); |
|
//#ifdef POSIXSTAR_DEBUG |
//kern_printf("PDisp:%d(%d)",p, lev->activated); |
|
//#endif |
|
/* the task state is set EXE by the scheduler() |
241,9 → 239,12 |
we extract the task from the ready queue |
NB: we can't assume that p is the first task in the queue!!! */ |
//iq_extract(p, &lev->ready[lev->priority[p]]); |
if (p==lev->activated) { |
//if (!nostop) { |
//kern_printf("PDisp:%d(%d)",p, lev->activated); |
if (p==lev->activated) |
level_table[lev->scheduling_level]->private_dispatch(lev->scheduling_level, p, nostop); |
} |
//} else |
// kern_printf("PDisp:%d(%d)",p, lev->activated); |
} |
|
static void POSIXSTAR_public_epilogue(LEVEL l, PID p) |
250,7 → 251,7 |
{ |
POSIXSTAR_level_des *lev = (POSIXSTAR_level_des *)(level_table[l]); |
//#ifdef POSIXSTAR_DEBUG |
//kern_printf("PEpic:%d(%d)",p, lev->activated); |
//kern_printf("PEpic:%d",p); |
//#endif |
if (p==lev->activated) { |
if (lev->yielding) { |
269,16 → 270,23 |
iq_insertlast(p,&lev->ready[lev->priority[p]]); |
//level_table[lev->scheduling_level]->private_extract(lev->scheduling_level,p); |
//lev->activated=NIL; |
|
POSIXSTAR_private_scheduler(lev); |
if (p==lev->activated) |
level_table[lev->scheduling_level]->private_epilogue(lev->scheduling_level,p); |
|
} |
else { |
//iq_insertfirst(p,&lev->ready[lev->priority[p]]); |
level_table[lev->scheduling_level]->private_epilogue(lev->scheduling_level,p); |
|
} |
|
proc_table[p].status = POSIXSTAR_READY; |
|
} |
} |
|
|
} |
|
static void POSIXSTAR_internal_activate(POSIXSTAR_level_des *lev, PID p) |
319,6 → 327,7 |
the task is */ |
|
/* Insert task in the coPOSIXect position */ |
//kern_printf("PU:%d", p); |
proc_table[p].status = POSIXSTAR_READY; |
iq_insertlast(p,&lev->ready[lev->priority[p]]); |
POSIXSTAR_private_scheduler(lev); |
325,7 → 334,9 |
} |
|
static void POSIXSTAR_public_block(LEVEL l, PID p) |
{ |
{ |
POSIXSTAR_level_des *lev = (POSIXSTAR_level_des *)(level_table[l]); |
|
/* Extract the running task from the level |
. we have already extract it from the ready queue at the dispatch time. |
. the capacity event have to be removed by the generic kernel |
338,6 → 349,9 |
//#ifdef POSIXSTAR_DEBUG |
//kern_printf("PB:%d", p); |
//#endif |
iq_extract(p,&lev->ready[lev->priority[p]]); |
POSIXSTAR_private_scheduler(lev); |
|
} |
|
static int POSIXSTAR_public_message(LEVEL l, PID p, void *m) |
347,6 → 361,7 |
if (lev->nact[p] > 0) { |
/* continue!!!! */ |
lev->nact[p]--; |
iq_extract(p,&lev->ready[lev->priority[p]]); |
iq_insertfirst(p,&lev->ready[lev->priority[p]]); |
proc_table[p].status = POSIXSTAR_READY; |
} |
355,7 → 370,7 |
|
} |
//#ifdef POSIXSTAR_DEBUG |
//kern_printf("PM:%d",p); |
kern_printf("PM:%d",p); |
//#endif |
//jet_update_endcycle(); /* Update the Jet data... */ |
//trc_logevent(TRC_ENDCYCLE,&exec_shadow); /* tracer stuff */ |