Why stack size is passed while spawning a task - VxWorks
This is a discussion on Why stack size is passed while spawning a task - VxWorks ; For spawnig a task, taskSpawn() requires stack size as a paramter.
Is the stack size needed to limit the usage of memory by the task?
Cant the system allow the tasks to use how much ever memory it wants?
Please ...
-
Why stack size is passed while spawning a task
For spawnig a task, taskSpawn() requires stack size as a paramter.
Is the stack size needed to limit the usage of memory by the task?
Cant the system allow the tasks to use how much ever memory it wants?
Please let me know the answer.
Senthil KAS
-
Re: Why stack size is passed while spawning a task
Yes to the first.
Not really for the second. The memory for the task stack is allocated
when you do the spawn, and it comes out the the total memroy allocated
to your partition.
After you do the spawn and have your system running, do a checkStack
and you can see the max usage of your stack. Then you can "tune" that
task stack down to something smaller. Start out at a good size
allocation, and trim it later when you can get a good handle on the
usage.
Good luck,
LC
senthil wrote:
> For spawnig a task, taskSpawn() requires stack size as a paramter.
> Is the stack size needed to limit the usage of memory by the task?
> Cant the system allow the tasks to use how much ever memory it wants?
> Please let me know the answer.
> Senthil KAS
-
Re: Why stack size is passed while spawning a task
Hi,
What could be a proper value for the size of a task stack?
(normalUsed)*120% ?
On 1月22日, 下午11时44分, "LarryC" wrote:
> Yes to the first.
>
> Not really for the second. The memory for the task stack is allocated
> when you do the spawn, and it comes out the the total memroy allocated
> to your partition.
>
> After you do the spawn and have your system running, do a checkStack
> and you can see the max usage of your stack. Then you can "tune" that
> task stack down to something smaller. Start out at a good size
> allocation, and trim it later when you can get a good handle on the
> usage.
>
> Good luck,
> LC
>
>
>
> senthil wrote:
> > For spawnig a task, taskSpawn() requires stack size as a paramter.
> > Is the stack size needed to limit the usage of memory by the task?
> > Cant the system allow the tasks to use how much ever memory it wants?
> > Please let me know the answer.
> > Senthil KAS- 隐藏被引用文字 -- 显示引用的文字 -
-
Re: Why stack size is passed while spawning a task
jeanwelly wrote:
> Hi,
> What could be a proper value for the size of a task stack?
> (normalUsed)*120% ?
>
The proper value would be to set it to the maximum value it will ever
need. Ideally you do this by determining the max stack size using some
sort of tool (e.g.
http://www.embeddedtechjournal.com/n...0061031_02.htm)
If you can't do that, then things are a little harder. 120% might be
fine or it could be horribly inadequate. You need to understand all of
the code before you can make that judgement. If you are avoiding
recursion (this is probably a little too strong of a statement) and have
reason to believe that you stack frame size is not really variable
depending on "input" data, 120% is fine.
If you have memory to spare and don't understand your code, I'd use
something more like normalUsed * 10 (actually, I'd recommend
understanding the code....but..if that is not possible for some reason...)