This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RTOS : Task switch during a time tick

Dear all,

I have to work with RL-RTX, and I have first look at the RTX traffic example. There is something I do not understand about task switching. Some years ago, I was working on a home-made RTOS, and the switch from a task to another could only occured at "kernel time" (that means at every time tick). If a task only used 50% of a tick time, the rest of the tick time was for "idle", and next task only starts after the kernel time at the end of the tick.
With the traffic example, it seems that when a task is delayed (by instance with os_dly_wait) during a tick time, another "ready" task can directly start, without waiting for the end of the tick time when the kernel will run.
Is it right? If yes, can you explain me how it works? (maybe the kernel runs to switch the tasks even if the time tick is not finished?)
Thanks !
Best regards

Parents
  • When a task is "blocked" for some reason the next task in the ready queue is run. The idle task is considered just another task that can run that is always ready. Task switching is not actually tied to the timer tick. There are cases that the timer tick MAY cause a task switch (a delay terminates, other waiting items timeout, but these timeouts are process, the tasks are placed in the ready queue and when the tick processing is over the highest priority ready task is run. The OS actually does not do a full saving of state of the task unless there is actually a task switch.

Reply
  • When a task is "blocked" for some reason the next task in the ready queue is run. The idle task is considered just another task that can run that is always ready. Task switching is not actually tied to the timer tick. There are cases that the timer tick MAY cause a task switch (a delay terminates, other waiting items timeout, but these timeouts are process, the tasks are placed in the ready queue and when the tick processing is over the highest priority ready task is run. The OS actually does not do a full saving of state of the task unless there is actually a task switch.

Children