[dtrace-discuss] Detect stack size
deepti dhokte
Deepti.Dhokte at Sun.COM
Mon Dec 4 17:34:29 PST 2006
deepti dhokte wrote:
> Casper.Dik at Sun.COM wrote:
>>> why not? as far as I understand, getrlimit and setrlimit are in
>>> standard C lib as welland they have been used to dynamically get the
>>> soft an hard
>>> limit of the resources in the context of the current process.
>>>
>>
>> Yes, but they don't work for the stack size parameters.
>>
> they work for stack size as well as cpu time,maximum file size, data
> size, core file size etc.
> are all resources that are allowed to be tuned in the given process's
> context.
> I recall only use of RLIMIT_STACK resource so far.
I just checked solaris's man page on getrlimit.
apart from typical RLIMIT_STACK and company that are implemented by
typical unices,
since version 8, Solaris has RLIMIT_AS and RLIMIT_VMEM to increase
process's total
address space. cool.
-Deepti
>
>> The stack limit determines the area of virtual memory reserved for
>> the stack;
> agree. stack grows within the allocated virtual memory /process
> address space for the given process.
>> Solaris maps the lshared libraries directly under it, so
>> it is *impossible* to grow the stack limit for the current process.
>>
> actually the syscall implementation cares for this detail such as if
> resource allocation is resulting
> intruding into shared library region or any other region, then further
> growing of stack size
> would result into error (-1) and stack will not be allowed to be grown
> (thus setrlimit would return -1
> with errno EINVAL).
> since shared libraries are mapped into one of the processes (and not
> all) and all other user processes
> keep address of this shared lib, not all processes are giong to have
> lshared lib in their address space.
>
> so you are right, it is impossible to grow beyond hard limit (hard
> limits are settable only by su).
> and sucess of setrlimit system call is limited by per attribute
> specific hard limit as well total address
> space of the process.
> but still its a better option for processes/theads to efficiently
> utilize the whatever space available.
>> The thread stacks are mapped at thread started; they are
>> not governed by any stack resource limits .
>>
> it is implementation dependent. also, threads are initialized with
> default stack size,
> and newer libs and standards allow threads/processes to tweak these
> attributes/resources.
> pthread_attr_g/setstacksize and/or g/setrlimit are useful syscalls.
> -Deepti
>> Casper
>> _______________________________________________
>> dtrace-discuss mailing list
>> dtrace-discuss at opensolaris.org
>>
>
>
More information about the dtrace-discuss
mailing list