rtel wrote on Wednesday, January 09, 2013:
The stack variable are indirectly part of the the task context because the stack pointer is one of the registers saved by portSAVE_CONTEXT() and restored by portRESTORE_CONTEXT().
If a task places variables (local non static variables) on the stack, gets switched out, then gets switched back in again, its execution context will not have changed - everything will be exactly as it was when it was switched out - including the variables on its stack. If another task runs the stack pointer will have been moved to point to the stack (and variables on the stack) that is unique to that task.
these variables are located on the main heap
Only memory allocated by malloc() uses the heap - whether you have an RTOS or not.