workspace structure
Catalin Morosan
catalin.morosan at gmail.com
Fri Apr 18 12:23:04 UTC 2008
Hi.
I've been trying to understand what exactly is the structure of the
workspace in memory, especially where are the information for the
threads and where are the stacks kept. I understand that the workspace
is allocated at the end of the memory and is like a separate heap.
After doing some debugging of an application with 4 tasks I deduced this:
---beginning of workspace
...
Task 4 stack
Task 3 stack
Task 2 stack
Task 1 stack
Task idle stack
..
Task 1 control block
Task 2 control block
Task 3 control block
Task 4 control block
Task idle control block
..
--- end of workspace
Is this accurate?
Also, I don't understand why it has this structure because
_Workspace_Allocate() takes only the size of memory to be allocated and
in turn, it calls _Heap_Allocate() with the size and the information for
the workspace. Doesn't allocation start from the beginning of the
workspace and continues to the end? Why is the task idle control block
after the control blocks of the other tasks although the idle task is
created first? etc. There is something I am missing but I can't see it
right now.
Thanks for any input.
More information about the users
mailing list