1820483 Members
2413 Online
109624 Solutions
New Discussion юеВ

stack size

 
SOLVED
Go to solution
dhanish
Regular Advisor

stack size

Hi,
I want to know what stack value signifies in in ulimit -a o/p.I have given this command in two machines
one has stack=65536 (kb) and other has 8192 kb ..is it related to kernel param.How can i increase that..is it possible...

Never Say Die
4 REPLIES 4
Alan Casey
Trusted Contributor

Re: stack size

To change Stack Size:

Document Id : A4606375


Problem Description

How do I limit csh data and stack size?

Configuration Info

Operating System -HP-UX
Version -10.01
Hardware System -I70

Solution

There is no way to limit the csh data and stack size unless it
is programmed with setrlimit. setrlimit() sets a limit on
consumption of system resources by the current process and
each process it creates.

However, ksh and sh can be changed by:

ulimit -d (new size)
ulimit -s (new size)

It can be verified with:

ulimit -a

Alan Casey
Trusted Contributor

Re: stack size

Document Id : A5390409


PROBLEM

How do I increase the values of stack and
data size in the shell?


CONFIGURATION
Operating System - HP-UX
Version - 10.20
Hardware System - HP 9000
Series - T600

RESOLUTION

You can use "ulimit -a" to display the
current values of the data and stack size, as in the
following example:

ulimit -a

set to:
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 16000
stack(kbytes) 65536
memory(kbytes) unlimited
coredump(blocks) 4290772993
nofiles(descriptors) 2048

The ulimit for the user can be changed at the command line
or in the profile for that user.

The data is reference to the maxdsiz kernel parameter
and the stack is reference to maxssiz kernel parameter.
These parameters can only be changed within the kernel which
requires a reboot.

Another good way to determine the current system configuration
is the following:

echo "maxssiz/D" | adb -k /stand/vmunix /dev/kmem

echo "4 * 20396" | bc

(this is because /dev/kmem values are in plain terms)


A. Clay Stephenson
Acclaimed Contributor
Solution

Re: stack size

Hi:

There are three related kernel parameters (6 if you count each of their _64bit cousins) which act as resource limits for individual processes. These values do not consume resources themselves but serve to prevent any one process from grabbing all the memory in sight.

1) Maxtsiz - maximum size of a process text segment; i.e. it's executable instructions

2) Maxdsiz - maximum size of a process data segment including dynamic memory

3) Maxssiz - maximum size of a process stack segment

Of these 3, maxssiz is usually the least important and can usually remain at the default 8MB and in almost all cases 32-64MB is plenty even if you need to run very large programs. The reason for this is that the stack segment is used to store 'auto' variables and function parameters. No sane or competant programmer is going to declare a 32MB array as an auto declared variable. Something like that will either be a global variable (ok) or dynamically allocated (better) - in both of these cases that space then comes from the data segment. The other reason to not have a huge stack segment is to prevent runaway recursion. There are probably some exceptions but I have not had to exceed 32MB maxssiz in many years. In the few cases where a large stack size was requested for a software package, I have made polite calls to the software developers and asked a few pointed questions. In those cases, the need for the large stack segments disappeared with the next release.

Regards, Clay
If it ain't broke, I can fix that.
dhanish
Regular Advisor

Re: stack size

Hi Thanks for you response.So when i give ulimit -a ..it gives the value of data ,stack and text ..are these values for 32 bir or 64 bit as ..i have configured both in /stand/system..


thnks
Never Say Die