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

RTX51 full: os_wait() returns too early

Hello!

Assuming an OS timer tick interval of 5ms, os_wait() returns exactly after 5ms with the code as follows:

while (1) {
    os_wait(K_TMO, 1, 0);
}

However, with the code like that:

while (1) {
    os_wait(K_SIG, 255, 0);
    os_wait(K_TMO, 1, 0);
}

the second call to os_wait returns after something beetween 0 and 5ms.

I have read somewhere that os_wait(K_TMO, 1, 0) only waits until the next timer tick but why only in the second case?

Regards,
Markus

Parents
  • Yes, I meant one ms. If the timer isn't synchronized, a one ms delay may end immediately just as well as after one ms.

    Many OS runs their system clock at a higher resolution than the task time-slice frequency, so that a thread that forces a task switch after 95% of the slice time will not result in the following task only getting the remaining 5% of the task slice.

Reply
  • Yes, I meant one ms. If the timer isn't synchronized, a one ms delay may end immediately just as well as after one ms.

    Many OS runs their system clock at a higher resolution than the task time-slice frequency, so that a thread that forces a task switch after 95% of the slice time will not result in the following task only getting the remaining 5% of the task slice.

Children
No data