Sobakava
Full Member level 6
scheduler implementation
Hi all,
I'm implementing a Real-Time Task Scheduler using NXP LPC 2148 ARM7 CPU using GCC-Winarm.
The scheduler will be Rate Monotonic ( tasks with shorter periods have higher priorities ) and pre-emptive.
I already implemented rate-monotonism but I've problems with preemption. The scheduler runs with hardware timer interrupt. Then scheduler runs by interrupt, it checks the task list and task status list then decides which task to run.
but,
for instance, ( @ t = at time)
@ 0 : Timer interrupt occurs, scheduler starts TASK1 . Let's say it will run for 10 miliseconds.
@ 1 : Timer interrupt again. Scheduler decides TASK1 can continue. Returns from interrupt. ( It'll return to TASK1(); function )
@ 2: same as 1
@ 3: same as 1
.
.
@ 11: Timer interrupt. Scheduler decides TASK1 should wait and TASK2 should run immediately... Changes the task list. HERE: Now I've to return from interrupt. But it will return to TASK1();
void TASK1( void ) {
do something
do something
--- >>> interrupt ( task1 should continue)
do something
do something
--- >>> interrupt ( task1 should continue)
do something
do something
--- >>> interrupt ( task1 should continue)
do something
do something
--- >>> interrupt ( task1 should be preempted and TASK2 should run! )
do something
do something
do something
do something
}
I need a suggestion on how to let the scheduler manage the task and itself. First interrupt based approach seemed good to me but I can not figure out how to do it now. Any help will be appreciated.
Best Regards
Hi all,
I'm implementing a Real-Time Task Scheduler using NXP LPC 2148 ARM7 CPU using GCC-Winarm.
The scheduler will be Rate Monotonic ( tasks with shorter periods have higher priorities ) and pre-emptive.
I already implemented rate-monotonism but I've problems with preemption. The scheduler runs with hardware timer interrupt. Then scheduler runs by interrupt, it checks the task list and task status list then decides which task to run.
but,
for instance, ( @ t = at time)
@ 0 : Timer interrupt occurs, scheduler starts TASK1 . Let's say it will run for 10 miliseconds.
@ 1 : Timer interrupt again. Scheduler decides TASK1 can continue. Returns from interrupt. ( It'll return to TASK1(); function )
@ 2: same as 1
@ 3: same as 1
.
.
@ 11: Timer interrupt. Scheduler decides TASK1 should wait and TASK2 should run immediately... Changes the task list. HERE: Now I've to return from interrupt. But it will return to TASK1();
void TASK1( void ) {
do something
do something
--- >>> interrupt ( task1 should continue)
do something
do something
--- >>> interrupt ( task1 should continue)
do something
do something
--- >>> interrupt ( task1 should continue)
do something
do something
--- >>> interrupt ( task1 should be preempted and TASK2 should run! )
do something
do something
do something
do something
}
I need a suggestion on how to let the scheduler manage the task and itself. First interrupt based approach seemed good to me but I can not figure out how to do it now. Any help will be appreciated.
Best Regards