Description of the issue:
I created three tasks, Task A, Task B and Task C. All tasks are based on RTEMS_TIMESLICE | RTEMS_PREEMPT , Task A has a higher priority than other tasks, Task B has the same priority as Task C.
Tasks B and C loop forever, Task A sleeps 1 TICK on an endless loop. When I test, I find that task C is not scheduled.

Hope result:
I was expecting tasks A, B, and C to be scheduled. Task A can preempt task B and C. Tasks B and C can switch to each other when the time slice runs out.

Actual result:
When task A preempts task B and run out its timeslice, then switch to task B, task B's timeslice will reset to _Watchdog_Ticks_per_timeslice.
While the task B is still running, Task A preempts task B again. Task A will pick up task B as heir task and reset task B's timeslice.
This will cause task C never be scheduled.

My doubts :
1. Why must reset the time slice every time when switch tasks.
2. Why the scheduler only pick up Task B as heir task?
3. Can I comment the following code in _Thread_Do_dispatch()? Is there any problem if I change it this way?
    if ( heir->budget_algorithm == THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE )
        heir->cpu_time_budget = rtems_configuration_get_ticks_per_timeslice();
4. I found that only in POSIX can I use the algorithm THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE , RTEMS classics api only can use THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE.
   Can I use THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE in RTEMS classics api.nd rtems_task_mode.
5. Can anyone give some suggestions to solve the problem? thanks!
_______________________________________________
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users

Reply via email to