Electronics > Beginners
RTO basics
(1/1)
gogoman:
Hi when a RTOS is paused and the system tick timer is set to 20ms, my understanding is the task remains idle for 20ms.
What happens if a interrupt occurs or other task need to be service in this 20ms window, are they ignored
I'm new to this subject so take it easy.
thanks
mikerj:
Do you mean a Task is in a blocked state (e.g. it's waiting for a system delay to end or on a mutex/semaphore to become available) rather than the entire RTOS scheduler being suspended? If so then the the RTOS will immediately switch to highest priority task in the Ready state if one is available.
If the RTOS waited around until the end of the ticker tick interval it would waste lots of CPU time. The timer tick will preempt a task if a higher priority task is ready.
rstofer:
Hardware interrupts cause hardware action regardless of the state of the scheduler. So, the system will vector to the interrupt handler. What happens after that is a matter of code. It could be a device like a USART and the vector is for data received. The interrupt service routine will grab the character, probably put it in a circular buffer (queue) and set a semaphore. When the interrupt handler is done, it will notify the scheduler to potentially switch contexts depending, of course, on priority. It could be that some task is waiting on the semaphore for data available and, again, depending on priority, that task will get dispatched. At the least, it is on the pending list.
The scheduler tick is usually around 1 ms not 20.
FreeRTOS has a lot of documentation and is pretty much the standard in the industry at this point:
https://www.freertos.org/Documentation/RTOS_book.html
MANY development boards/tools (STM, PSOC, etc) come with FreeRTOS examples.
Navigation
[0] Message Index
Go to full version