I think many RTOSs do switch in/out when system calls are called.
But freeRTOS does not switch in/out on system calls.
freeRTOS switches in/out in the followings.
1.a tick interruput occurs
2.a task become to be blocked
Am i correct?
I would say that most RTOSes I have used (for this class of processor) don’t use a context switch for calls into the OS. That sort of switch is needed for a ‘Protected Mode’ OS, where the OS runs in a higher privelidge state than most of the user program. FreeRTOS supports somethng like this in the MPU ports, where most system calls, if made within a restricted task, need to transition the system state to unrestricted.
In FreeRTOS, the following things will initiate a task switch,
- Any interrupt (including the tick) that unblocks a task so it becomes the highest priority task (or suspends the highest priority task) (only if preempton is enabled)
- The current running task blocks on something, delays itself, suspends itself or deletes itself. (Something to make it not able to run right now)
- The current running task yields (Will do a task switch to the next ready task of the same priority if there is one)
- The current running task makes some other task ready and of higher priority. (Will switch to the new highest priority task(
I think that is the complete list.
An expression was inaccurate for my question.
Your answer is what I wanted to know. I didn’t know that there is a condition of No.4 of your answer in FreeRTOS.
When a manual was read after having your response, I noticed being written on a manual this certainly. This No.1-No.4 also matches my former experience.
Thank you very much.