64,10 → 64,6 |
|
int slice; /*+ the level's time slice +*/ |
|
// the multiboot is not usefull for this module |
// struct multiboot_info *multiboot; /*+ used if the level have to insert |
// the main task +*/ |
|
int maxpriority; /*+ the priority are from 0 to maxpriority |
(i.e 0 to 31) +*/ |
|
82,8 → 78,6 |
|
} POSIXSTAR_level_des; |
|
|
|
static void capacity_handler(void *l) |
{ |
POSIXSTAR_level_des *lev = l; |
118,8 → 112,7 |
} |
} |
|
if (/* (proc_table[p].control & CONTROL_CAP ) && */ |
(proc_table[p].avail_time <= 0)) { |
if (proc_table[p].avail_time <= 0) { |
while (proc_table[p].avail_time<=0) |
proc_table[p].avail_time += proc_table[p].wcet; |
iq_extract(p,&lev->ready[prio]); |
161,18 → 154,16 |
|
static void POSIXSTAR_account_capacity(POSIXSTAR_level_des *lev, PID p) |
{ |
struct timespec ty; |
TIME tx; |
struct timespec ty; |
TIME tx; |
|
SUBTIMESPEC(&schedule_time, &lev->cap_lasttime, &ty); |
tx = TIMESPEC2USEC(&ty); |
SUBTIMESPEC(&schedule_time, &lev->cap_lasttime, &ty); |
tx = TIMESPEC2USEC(&ty); |
|
proc_table[p].avail_time -= tx; |
//kern_printf("avail time pid %d , %d", p, proc_table[p].avail_time); |
proc_table[p].avail_time -= tx; |
|
} |
|
|
static int POSIXSTAR_public_create(LEVEL l, PID p, TASK_MODEL *m) |
{ |
POSIXSTAR_level_des *lev = (POSIXSTAR_level_des *)(level_table[l]); |
202,9 → 193,6 |
proc_table[p].avail_time = proc_table[exec_shadow].avail_time; |
proc_table[p].wcet = proc_table[exec_shadow].wcet; |
|
proc_table[p].control = (proc_table[p].control & ~CONTROL_CAP); //| |
//(proc_table[exec_shadow].control & CONTROL_CAP); |
|
lev->nact[p] = (lev->nact[exec_shadow] == -1) ? -1 : 0; |
} |
else { |
220,11 → 208,7 |
proc_table[p].avail_time = lev->slice; |
proc_table[p].wcet = lev->slice; |
} |
/* |
if (nrt->policy == NRT_RR_POLICY) { |
proc_table[p].control |= CONTROL_CAP; |
} |
*/ |
|
#if defined POSIXSTAR_DEBUG |
kern_printf("(slice %d)", proc_table[p].wcet); |
#endif |
235,7 → 219,10 |
|
} |
|
return 0; /* OK */ |
proc_table[p].control = (proc_table[p].control & ~CONTROL_CAP); |
|
return 0; |
|
} |
|
static void POSIXSTAR_public_dispatch(LEVEL l, PID p, int nostop) |
276,46 → 263,36 |
#endif |
|
if (lev->cap_lev!=NIL) { |
kern_event_delete(lev->cap_lev); |
lev->cap_lev=NIL; |
kern_event_delete(lev->cap_lev); |
lev->cap_lev=NIL; |
} |
|
if (/* p==exec && lev->activated==p */ |
proc_table[exec].task_level==l ) { |
POSIXSTAR_account_capacity(lev,exec); |
if (lev->yielding) { |
lev->yielding = 0; |
iq_extract(p,&lev->ready[lev->priority[exec]]); |
iq_insertlast(p,&lev->ready[lev->priority[exec]]); |
} |
/* check if the slice is finished and insert the task in the coPOSIXect |
qqueue position */ |
else if (/* proc_table[p].control & CONTROL_CAP && */ |
proc_table[exec].avail_time <= 0) { |
if (proc_table[exec].task_level==l ) { |
|
POSIXSTAR_account_capacity(lev,exec); |
|
iq_extract(exec,&lev->ready[lev->priority[exec]]); |
iq_insertlast(exec,&lev->ready[lev->priority[exec]]); |
|
if (lev->yielding) { |
lev->yielding = 0; |
iq_extract(p,&lev->ready[lev->priority[exec]]); |
iq_insertlast(p,&lev->ready[lev->priority[exec]]); |
} |
/* check if the slice is finished and insert the task in the coPOSIXect |
qqueue position */ |
else if (proc_table[exec].avail_time <= 0) { |
|
POSIXSTAR_private_scheduler(lev); |
|
if (exec==lev->activated) |
level_table[lev->scheduling_level]->private_epilogue(lev->scheduling_level,p); |
|
} |
else { |
|
level_table[lev->scheduling_level]->private_epilogue(lev->scheduling_level,p); |
|
//POSIXSTAR_private_scheduler(lev); |
|
} |
level_table[lev->scheduling_level]->private_epilogue(lev->scheduling_level,p); |
} else { |
level_table[lev->scheduling_level]->private_epilogue(lev->scheduling_level,p); |
} |
|
proc_table[exec].status = POSIXSTAR_READY; |
proc_table[exec].status = POSIXSTAR_READY; |
|
} else |
} else |
level_table[proc_table[exec].task_level]->public_epilogue(proc_table[exec].task_level,p); |
|
|
|
} |
|
static void POSIXSTAR_internal_activate(POSIXSTAR_level_des *lev, PID p) |
385,7 → 362,6 |
#endif |
|
iq_extract(p,&lev->ready[lev->priority[p]]); |
//if (p==lev->activated) lev->activated = NIL; |
POSIXSTAR_private_scheduler(lev); |
|
} |
585,11 → 561,7 |
if (proc_table[p].task_level != l) |
return ENOSYS; |
|
//if (proc_table[p].control & CONTROL_CAP) |
*policy = NRT_RR_POLICY; |
//else |
// *policy = NRT_FIFO_POLICY; |
|
*policy = NRT_RR_POLICY; |
*priority = ((POSIXSTAR_level_des *)(level_table[l]))->priority[p]; |
|
return 0; |
605,14 → 577,6 |
|
if (proc_table[p].task_level != l) |
return ENOSYS; |
/* |
if (policy == SCHED_RR) |
proc_table[p].control |= CONTROL_CAP; |
else if (policy == SCHED_FIFO) |
proc_table[p].control &= ~CONTROL_CAP; |
else |
return EINVAL; |
*/ |
if (lev->priority[p] != priority) { |
if (proc_table[p].status == POSIXSTAR_READY) { |
iq_extract(p,&lev->ready[lev->priority[p]]); |