[lkml]   [2000]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Thread Questions
Tigran Aivazian writes:
> On Wed, 23 Aug 2000, Patrick Narkinsky wrote:

>> Currently, working through /proc, we are
>> seeing each thread as a separate process and are thus claiming that
>> applications are using far more memory than they actually are.

This whole idea is flawed. The "top" program used to make a
similar error in %CPU handling. You simply must not attempt
to sum up the resources of multiple processes.

Consider processes that are created and killed before they
are seen. They will not count towards the total resource usage.

> I think Andi Kleen suggested something similar to this:
> You could enhance a file /proc/<pid>/stat (or some other, or invent
> a new one) to export a VM cookie (sorry, working with Mark made the
> word "cookie" my favourite one and I can't think of a better :)
> which is nothing other than a current->mm value, i.e. a kernel
> virtual address. Then you can easily detect CLONE_VM threads.

Note that this isn't a proper way to detect threads.

Consider two tasks that share everything but address space.
They share all file descriptors, the current working directory,
signal handlers, and parent. Are these tasks distinct processes?
I certainly think not; they are non-POSIX threads of a single

BTW, lots of other people need a solution to this problem.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:38    [W:0.087 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site