On Sat, Mar 21, 2020 at 11:51 PM Megha Sinha <
sinha.m...@gmail.com> wrote:
>
> Hello
>
> I am relatively new to RTOS concepts, so please excuse my ignorance.
> I am studying Nuttx as part of my project along side other RTOSes
>
> I found two major difference between Nuttx and other RTOSes.
>
> 1. Nuttx uses SVC for context switch while most other RTOSes uses PendSV. PendSV in other RTOSes are obviously very low priority, while in Nuttx SVS priority is raised.
>
Several reasons what I can imagine:
1.PendSV only exist on Cortex-M as far as I know, it's hard to apply
the functionality to other architecture(e.g. Cortex-A/R).
2.NuttX support syscall from userspace(most other RTOS lack this
functionality), SVC unify the implementation of the context switch and
syscall.
3.The unused PendSV can be used for Zero Latency Interrupts:
https://cwiki.apache.org/confluence/display/NUTTX/High+Performance%2C+Zero+Latency+Interrupts
but the user has to find other mechanism if RTOS(e.g. FreeRTOS) use
PendSV for scheduling.
> 2. It is a common practice to keep stack pointer for the TCB as the first entry of TCB structure. In Nuttx this is different. If I understood correctly, stack_alloc_ptr is the stack pointer which is relatively somewhere in the middle of the task structure.
>
stack_alloc_ptr always point to the begining of the stack(the lowest
address), not at the middle of the stack. TCB is allocated from the
global heap not from the stack(some RTOS reserve TCB from the
begin/end of stack).
> Can someone please explain to me the above two changes and the significance of why it is designed like this?
>
>
> Thank you
>
> --
> You received this message because you are subscribed to the Google Groups "NuttX" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
nuttx+un...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/nuttx/b2b23cfe-f2ad-424d-904f-9b85df206e21%40googlegroups.com.