Threads and processes
nick at byu.edu
Tue Mar 1 15:13:57 MST 2005
On Tuesday 01 March 2005 03:02 pm, David Smith wrote:
> Here are two process questions for the kernel heads:
> 1. I am developing a multi-threaded app in C++ for Linux. Under RHEL 3.0,
> when I do 'ps -A', my app shows up just once, but under Debian Unstable,
> 'ps -A' shows 10 (the number of threads I have). Can someone explain why
> this is? I remember studying kernel-level threads and user-level threads
> in my OS class, but why would two Linux kernels behave differently? Is it
> just a matter of differing ps options perhaps?
The kernels are not behaving differently, only the reporting is different.
Some utilities (ps/top) don't expand threads by default.
> 2. The one process on RHEL has a VSZ that is about double the Debian VSZ
> (as shown by 'ps -eo vsz'). I would have expected it to be 10 times as
> large, since it is "hiding" 10 processes in 1.
The size may have more to do with the tool chain and version of the libraries
linked than the number of threads. Additional threads won't expand the vsize
proportional to the process--only by the size of the stack (approximately)
since all of the code pages are shared.
Sales Team Automation, LLC
1335 West 1650 North, Suite C
Springville, UT 84663 +1 801.853.4090
More information about the PLUG