Sponsored Content
Full Discussion: Threads and stack size
Top Forums Programming Threads and stack size Post 302444700 by dawwin on Thursday 12th of August 2010 02:03:56 PM
Old 08-12-2010
Threads and stack size

Can someone explain me, why when I create new threads with stack bigger than default (using pthread_attr_setstacksize()) i can create more? Each thread has it's own stack, so how bigger stack can cause possibility to create more threads?
 

8 More Discussions You Might Find Interesting

1. Programming

How to increase the size of the stack

Hi!!, could someone tell me how to increase the stack size in HP-UX? Thanx (7 Replies)
Discussion started by: jyotipg
7 Replies

2. UNIX for Advanced & Expert Users

Stack size of Apps ?

hi all, I need to find out the Stack usage of an App which is basically an mpeg4 decoder. We are plannin to port the codec to an RTOS. so is there any way to find out the max stack size while the codec is running? saTs (1 Reply)
Discussion started by: satish_somu
1 Replies

3. Programming

How to find out the stack size occupied for a process?

Hi, In Linux how to find out what will be the stack size allocated for a process? Actually i have to fork n number of processess, and will call exec. I will be execing an executable which is already multithreaded and each thread size is defined. My doubt is how to know if the size of the... (2 Replies)
Discussion started by: rvan
2 Replies

4. Programming

How to read max stack size -Xss that is set/default for a java program?

I need to know what is the maximum stack size i.e. -Xss my java program is running with. Is there a way to find that out from inside my java program code and outside of it. What i am looking for is to read whatever the current set max limit -Xss (stack sie) is for a particular JVM(not... (3 Replies)
Discussion started by: mohtashims
3 Replies

5. UNIX for Advanced & Expert Users

How to identify maximum stack size?

Hi All, I have set max stack size as 4KB for my thread, but it always using very less. So I like to know what is the maximum stack size is used by my thread. I tried with gcc -fstack-usage command line option, but its not supported by mips. Kindly suggest me the way to find the max stack... (6 Replies)
Discussion started by: rajamohan
6 Replies

6. Linux

Linux Thread Stack Size pthread_attr_setstacksize

I have MultiThreaded Application in Linux. I am Setting the stack size using pthread_attr_setstacksize. The stack size i set is greter than PTHREAD_STACK_MIN i.e. 16384 bytes for my system. i am setting the stack size to 17408 bytes, and my application crashes due to insufficient stack size.... (1 Reply)
Discussion started by: Kedar Sabnis
1 Replies

7. Shell Programming and Scripting

How to find stack size at runtime?

hi, I just wondering is there any way that I can record the stack size of shell script at runtime. (2 Replies)
Discussion started by: yc962frank
2 Replies

8. Red Hat

Cannot set 'soft limits' for 'maximum stack size' for a standard user

Hi Guys, I'm trying to install Oracle Database on to Oracle Linux 7.6 but when the database install package checks the OS set-up, it keeps on failing on the soft limits for the stack. It's default value is 8192 but I'm trying to set it to 10240. This is what I added to... (2 Replies)
Discussion started by: ASGR
2 Replies
PTHREAD_ATTR_SETSTACKSIZE(3)				     Linux Programmer's Manual				      PTHREAD_ATTR_SETSTACKSIZE(3)

NAME
pthread_attr_setstacksize, pthread_attr_getstacksize - set/get stack size attribute in thread attributes object SYNOPSIS
#include <pthread.h> int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize); int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize); Compile and link with -pthread. DESCRIPTION
The pthread_attr_setstacksize() function sets the stack size attribute of the thread attributes object referred to by attr to the value specified in stacksize. The stack size attribute determines the minimum size (in bytes) that will be allocated for threads created using the thread attributes object attr. The pthread_attr_getstacksize() function returns the stack size attribute of the thread attributes object referred to by attr in the buffer pointed to by stacksize. RETURN VALUE
On success, these functions return 0; on error, they return a nonzero error number. ERRORS
pthread_attr_setstacksize() can fail with the following error: EINVAL The stack size is less than PTHREAD_STACK_MIN (16384) bytes. On some systems, pthread_attr_setstacksize() can fail with the error EINVAL if stacksize is not a multiple of the system page size. VERSIONS
These functions are provided by glibc since version 2.1. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +-----------------------------+---------------+---------+ |Interface | Attribute | Value | +-----------------------------+---------------+---------+ |pthread_attr_setstacksize(), | Thread safety | MT-Safe | |pthread_attr_getstacksize() | | | +-----------------------------+---------------+---------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008. NOTES
For details on the default stack size of new threads, see pthread_create(3). A thread's stack size is fixed at the time of thread creation. Only the main thread can dynamically grow its stack. The pthread_attr_setstack(3) function allows an application to set both the size and location of a caller-allocated stack that is to be used by a thread. BUGS
As at glibc 2.8, if the specified stacksize is not a multiple of STACK_ALIGN (16 bytes on most architectures), it may be rounded downward, in violation of POSIX.1, which says that the allocated stack will be at least stacksize bytes. EXAMPLE
See pthread_create(3). SEE ALSO
getrlimit(2), pthread_attr_init(3), pthread_attr_setguardsize(3), pthread_attr_setstack(3), pthread_create(3), pthreads(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2017-09-15 PTHREAD_ATTR_SETSTACKSIZE(3)
All times are GMT -4. The time now is 03:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy