General :: How To Get Stack Size Of Running Process?
Apr 17, 2011
Can anyone tell me that how to get information about stack, allocated by kernel to a running process? for this ,is there any api function,any system call is available in ubuntu 8.04 ?
I am trying to find the dyanmic heap size and stack size of a running process in rhel5.5 and rhel6.I read that the 23rd parameter in the file /proc/pid/stat gives the heap size.Can you elaborate more on this.Also is there any other way to do this?
Why is it in Linux that there is a stack size set by default? And why is it so small? (My system is set to 8192 kbytes.) And why is there a default limit on the stack size when the max memory and virtual memory size are, by default, unlimited? (Aren't they both fed from the same place ultimately?)
Reason I ask: I want to use recursive functions in my programming a lot more. Problem is, if the language (or implementation) doesn't happen to support tail-call recursion, then I can be pretty well certain that the first huge problem that gets thrown at my function is going to kill my program because the stack size limit is going to be quickly reached. Obviously, I can change the stack size limit for my own computers, but it doesn't feel so great knowing that most of the people who copy and execute my code will have probably have overlooked this. Anyway, does anyone know: is this small default stack size limit just one of those historical artifacts, or is there some technical reason for it?
I seem to only be able to set my stack size on my linux server to 15000. If I increase it to 20000 I get a Segmentation Fault. how I can get the linux OS to increase the stack size? Code: threadRet |= pthread_attr_setstacksize( &m_ThreadAttributes, 15000 );
If I issue the following and the process doesn't quit, is there a way to view what it's doing with the SIGTERM signal on the stack? Is this done via the pstack command?kill -s SIGTERM <PID>
Desperate to reduce RAM usage of my tiny VPS running Ubuntu 9.04 and Apache2.2.11, here I saw that: On Linux, each child process will use 8MB of memory by default. This is probably unnecessary. You can decrease the overall memory used by Apache by setting ThreadStackSize used by Apache by setting ThreadStackSize to 1MB in.
So I tried to give the suggestion a try. But when I append: ThreadStackSize 1000000 in my /etc/apache2/httpd.conf <IfModule mpm_prefork_module> directive, and restarted apache, it failed with this message: Invalid command 'ThreadStackSize', perhaps misspelled or defined by a module not included in the server configuration
So I figured out that the relevant modules are neither enabled nor available on apache2. Now I am wondering whether there is a way to decrease the ThreadStackSize without the need to compile apache from source? If not, what should I do?
Why the thread stack size can not be changed after calling pthread_attr_setstacksize & pthread_create in a dynamic library? Detail: I write a file thread_factory.c and plan to build it and produce a dynamic library (libthread_factory.so) In the thread_factory.c , there is a routine
[Code]....
And after this, there is application, it will call fct_thread_create(STACK_SIZE_256KB), and then call pthread_attr_getstacksize(), but the stack size return always be a fixed value 0xa01000. (I tried this on Fedora12) But if I build the application source code with the file thread_factory.c directly, the stack size return is right as my expect. I checked the source code of glibc about the routine pthread_create() as below:
i'm getting messages like these in my bash console
Code: STACK size: 98222 [0x7f665dbe4e00 0x7f665db25090] and i'm not quite sure what they mean, so far it looks it's related to the shell stack limit set by ulimit, however i've tried to change it (increasing it) however this message still persists.
i have an application that launches several pthreads, i know that the default size used by Linux is 8Mb for each pthread. However i would like to optimize the total memory usage by my application by decreasing the default stack size of each pthread to the needed resources. My questions:
- Are there any rules to set the pthread stack size. - How to compute the memory needed by each thread. - Is the malloc call inside a thread counted from the stack size of the same pthread?
I mistakenly ran 'iptables restart' on a server that was not set to run iptables. Immediately, the server quit making outgoing connections on port 80. It has problems completing a traceroute when another machine on the same VM Host can do everything just fine. One of our best networking technicians diagnosed it as issues with the TCP/IP stack on the OS.
I know that iptables is off, allowing all trafffic incoming/outgoing.
I have Centos 5.3 installed on my pc. I have mysql, PHP and apache server running on my computer too.Is there any way I can test my website on my pc without running any stack ( lampp )?
The aim of this script is, when the folder reaches 20M then attributes will be set to that particular folder so that no newfiles and folders cannot be created or copied to that samplefolder. whenever i copy a file morethan 20M to that folder its getting copied fully and then the attributes were applied. But i dont want this to happen, when the folder reaches its maximum current write operation to that folder should be stopped automatically with a error.
Is it possible, using ps, to determine where a process is running from? I have two applications, both are identical and running in parallel directories, such as /app1/start.sh and /app2/start.sh. If I run ps -ef then I'm unable to tell the difference between the two
Using ps (or alternative), how can I tell that PID 123 belongs to app1?
How can i get the notification of process which are currently running?
We wrote one script which is being fired for every minute, instead of that is there any to trigger the event from linux core implicitly if there is any change in my process(pid)?
How do you move a running process to the background? For example, type the command sleep 60 on the command line and try moving that process to the background.
Possible Duplicate: Finding the process that is using a certain port in Linux I'm using Ubuntu Linux 11.04. How do I write a shell script expression that will find the process running on port 4444 and then kill the process?
I have a game server running using java, and it tends to crash sometimes, and only way to start it now is manually, so i thought i could create a script to check periodically if java is running, and if it isn't, run my startup script for the game server also, if it's possible it should log when it actually started the server startup script into a text file or something, so i can check why it crashed.
In short our required is that we are creating a share library which can be loaded by a process and that share library analysis the process which load it. Since share library is in address space of the process so I need to find out how many threads created by the process and what is status of their stack trace etc.
So I am looking for a way to get list of threads in running process.
I'd like to start a background job using the sudo command and route its output to a file. This presents a problem because the prompt for the password doesn't work properly. It looks something like this when I try it:
Basically I'm not properly prompted for the password and as soon as I type anything in my background job fails because it didn't receive the password. Is there any way to execute a sudo command by supplying the password on the same line as the command?