Operating System - Linux
1752727 Members
5655 Online
108789 Solutions
New Discussion юеВ

How can we access process info

 
SOLVED
Go to solution
Sudheer Kumar
Occasional Contributor

How can we access process info

Hi,
In Linux, How can we find out number of threads in a process? In SPARC, We can use /proc file commands. How can we do in LINUX?
We make the difference
2 REPLIES 2
Panos Agoros
Advisor
Solution

Re: How can we access process info

Hi Sudheer,


you should try in your favorite linux distribution the ps command with the "-m" or "m" switch. I tried it out in redhat 7.1, but I get a "ps: error: Thread display not implemented" error message. Maybe it is implemented in your distrib though...

if you want the thread details of a C program of your own, then you should compile it with the "-g" option, execute it under gdb & you will be able to get thread information with the "info threads" command.

hope this helps
"This is how the world works: all energy flows according to the wills of the great magnet... What a fool was I to defy him!" (Johnny Depp/Fear+Loathing In Las Vegas)
Robert Binkley
Advisor

Re: How can we access process info

Top Command

To allow users to increase their file descriptor limits, change the following configuration files:
In /etc/security/limits.conf, add the lines:

* soft nofile 1024
* hard nofile 4096

In /etc/pam.d/login, add:

session required /lib/security/pam_limits.so

To increase the system-wide file descriptor limit, add the following three lines to the /etc/rc.d/rc.local startup script:
# Increase system-wide file descriptor limit.
echo 8192 > /proc/sys/fs/file-max
echo 24576 > /proc/sys/fs/inode-max

#######################################
Limitations on threads are tightly tied to both file descriptor limits, and process limits.

Under Linux, threads are counted as processes, so any limits to the number of processes also applies to threads. In a heavily threaded app like a threaded TCP engine, or a java server, you can quickly run out of threads.

For starters, you want to get an idea how many threads you can open. The `thread-limit` util mentioned in the Tuning Utilities section is probabaly as good as any.

The first step to increasing the possible number of threads is to make sure you have boosted any process limits