I am new to FreeRTOS and the concepts of RTOS in general. I was wondering, in this situation:
When a RTOS is running and an interrupt arrives, which subsequently invokes a yeidlFromISR() function, does that constitute a “context switch” as per in the normal Time sharing desktop systems ?
I have been looking around for awhile but have yet to find the definitive answer on this. To me, as long as an execution context is preempted and can be restored for execution subsequently is considered a context switch. Am I mistaken in my understanding?
Thanks alot in advance, any help in understanding is appreciated
When a RTOS is running and an interrupt arrives, which subsequently invokes a yeidlFromISR() function, does that constitute a “context switch” as per in the normal Time sharing desktop systems ?
Calling portYIELD_FROM_ISR() from an interrupt context switches the context of the task that was interrupted, to the task that should run when the interrupt completes. That means, the interrupt interrupts one task, but potentially returns to another. The task that was interrupted will run again, but only when it is the highest priority ready state task. So yes, that is a context switch, but the context switch does not switch the interrupt context but the task context. I don’t know how that relates to your question about time sharing desktop systems though.
I didn’t want to start a new thread and flood the forum so I decided to continue off from here.
I am new to FreeRTOS and the concepts of RTOS in general. I am wondering, if this is what happens during the execution of the Kernel on a Renesas RSK RX62N or any other MCUs in general:
1) Kernel is running and sets the Interrupt Priority Level(IPL) to configKERNEL_INTERRUPT_PRIORITY. (Other than the times where the Kernel is accessing Kernel data and needs to disable all interrupts by setting the IPL to configMAX_SYSCALL_INTERRUPT_PRIORITY)
2) When an interrupt arrives, the MCU will check against the current IPL levels to check if the interrupt is allowed to be accepted.
3) If interrupt is accepted: Kernel is preempted and the MCU will switch to the Interrupt Stack Pointer. When the interrupt handler completes, the PC and the Processor Status Word (PSW) is popped off the interrupt stack and finally, Kernel continues executing from where it left of.