Stack requirements, why is it so big?

Joel Sherrill joel.sherrill at
Thu May 4 17:43:06 UTC 2000

Leon Pollak wrote:
> Hello, all.
>     My application has 16 tasks, which means that, using default
> STACK_MINIMUM_SIZE definition (which is 8K for powerpc cpu MPC860), I
> must have RTEMS workspace size >> 112K.

I would suspect that 8K may be too conservative but I don't have any

The intent of the minimum stack size is to be able to run a "reasonable"
task -- whatever that is.  Typically it means being able to call printf.

If you can define STACK_CHECKER_ON and turn on stack checking, then
you can call a routine to print the actual stack usage for each task
in the system after it has run a while.  You should be able to 
locally lower that value then to be safe for your application.

I recall that 8K is needed to run some of the network demos.  But that
doesn't mean that every task is going to use the network services
or that every network service is stack intensive.

The old m68020 manual is referring to ONLY RTEMS services (and 
no POSIX or ITRON at that).  It does not take much take space 
to call RTEMS servces but libc, libm, support libraries, etc.
are a different matter.

>     I can't use less because the 'thread create" process checks this and
> forces the default minimum size to be used.
>     Having the following numbers for code:
> librtems_g - 86K
> libcsupport - 14k
> libc    - 10k
> my application 110K
> my data - 145K
>     this means that I have no memory in my 512K RAM. And all this before
> the networking, which I didn't incorporate yet (but for which I have
> another bank of 512K RAM).
>     Now, in this connection, I have two questions:
> 1. What are the ideas behind this default definition of the stack to 8K?
> The old version of C Application Supplement for 68020 that I have says
> that 331 byte is enough. I wasn't able to find the corresponding
> document for powerpc. Does it exist?
> 2. If the figures I mentioned are approximately correct, how do the
> people use networking? How much RAM do you have?
> I shall be very thankful for the clarification.
> leonp at

Joel Sherrill, Ph.D.             Director of Research & Development
joel at                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

More information about the users mailing list