[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: [rtl] Scheduling 2 tasks
Volker Zahn wrote:
> Hi RT-Freaks!
>
> I've got a question about scheduling of periodic tasks.
> I tested an example with two periodic tasks, first one has a
> scheduling time of 500us, second of 2000us withan offset of 250us
> between them, so that they never come at the same time:
>
> rt_task_make_periodic(&task1, now + 3000, TIME_US(2000));
> rt_task_make_periodic(&task2, now + 3250, TIME_US(500));
>
> I tested the execution times by toggling bits on the parallel port
> an watching them with an oszilloscope. Worked! :)
>
> But now I tested what happens, if task1 calculates longer than 250us.
> I thought, task2 should interrupt task1, but it didn't. It came to
> execution after the task_wait of task1. Is this correct, or do I things
> wrong?
>
> Of course, task2 is of higher priority, but I did change priorities with
> same result.
>
It is correct if the second task is less important (lower priority, i.e.
higher priority number), it is questionable, in my opinion wrong, if the
second task has the same priority.
If you agree the fix to the latter is simple. Just edit rt_prio_sched.c
and look at the "preemptor" search in function "rt_schedule" ,change
"task->priority < prio" into "task->priority <= prio".
Ciao, Paolo.
--- [rtl] ---
For more information on Real-Time Linux see:
http://www.rtlinux.org/