public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Process vs. Threads
@ 2001-03-06 17:01 Dan Kegel
  2001-03-06 17:32 ` Ulf Carlsson
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Kegel @ 2001-03-06 17:01 UTC (permalink / raw)
  To: jorge_ortiz, linux-kernel@vger.kernel.org

jorge_ortiz@hp.com wrote:
> I have been trying to differenciate threads and process in Linux. As 
> I am sure you already know, other OS, namely HPUX, implement threads 
> in a different way. ...
> Of course, I am talking about kernel 2.2.x, but AFAIK this has not 
> changed in the new kernels.

It's starting to change a bit; see the discussion following
  http://boudicca.tux.org/hypermail/linux-kernel/2000week36/0903.html
  ("thread group comments").

Can someone summarize the state of the thread changes in 2.4?  
A lot seemed to happen, but from what I gather, nothing user-visible yet.

- Dan

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: Process vs. Threads
@ 2001-03-08  0:17 Hank Leininger
  2001-03-09  9:48 ` Albert D. Cahalan
  0 siblings, 1 reply; 9+ messages in thread
From: Hank Leininger @ 2001-03-08  0:17 UTC (permalink / raw)
  To: linux-kernel

On 2001-03-07, "Albert D. Cahalan" <acahalan@cs.uml.edu> wrote:

> Then for proper ps and top output, you need a reasonably efficient
> way to grab all threads as a group. This could be as simple as
> ensuring that /proc directory reads return related tasks together.
> This works too:   /proc/42/threads/98 -> ../../98

For this (but not for other "proper thread support" things you mention)
would it be enough to have /proc publish some token that represent unique
->fs, ->mm, etc pointers?  (The kernel-space address of each would work,
though that might be leaking too much info; the least userspace must treat
such values as opaque canary tokens.)  This does not give you the most
efficient "ps --threads 231" but it does let ps, top, (fuser?), etc group
processes with the same vm, files, etc, no?  ...I'm kinda surprised such a
thing doesn't already exist actually.  Unless of course, it does exist, but
is not enough :-P

--
Hank Leininger <hlein@progressive-comp.com> 
  

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Process vs. Threads
@ 2001-03-06 16:28 Jorge David Ortiz Fuentes
  2001-03-06 16:58 ` Gregory Maxwell
  0 siblings, 1 reply; 9+ messages in thread
From: Jorge David Ortiz Fuentes @ 2001-03-06 16:28 UTC (permalink / raw)
  To: linux-kernel

Hello everybody:

  I have been trying to differenciate threads and process in Linux. As
I am sure you already know, other OS, namely HPUX, implement threads
in a different way.  There is a thread id (TID) field in the structure
that is used by the scheduler and it is used to identify uniquely each
"task" that can be run.  Using this structure makes easier to identify
which threads belong to the same process and tools such as ps or top
show the TID as a field.

  I understand that changing this in the Linux kernel would mean that:
* some tools will have to be modified.
* the proc filesystem should create a directory using the TID instead
of the PID.
* some features as VM handling, signaling or exec()ing from a thread
would be more difficult to implement.
* compatibility will be broken.

  However, I miss some way to indicate that two processes are, in
fact, threads of the same process.  Maybe there is something I'm
missing.  Let me elaborate this.

  If you run 'top' (sorted by memory usage) and, lets say, you have 9
threads, you see the SIZE of these 4 threads 

 10:40am  up  1:23,  1 user,  load average: 0.26, 0.22, 0.10
52 processes: 51 sleeping, 1 running, 0 zombie, 0 stopped
CPU states:  0.0% user,  3.1% system,  0.0% nice, 96.8% idle
Mem:   322464K av,  306284K used,   16180K free,   16876K shrd,   32432K
buff
Swap:  530136K av,    8064K used,  522072K free                   13660K
cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT  LIB %CPU %MEM   TIME COMMAND
  745 root       0   0  224M 217M  1596 S       0  0.0 68.9   0:00
traffic_mana
  840 root      15   0  224M 217M  1596 S       0  0.0 68.9   0:00
traffic_mana
  841 root       0   0  224M 217M  1596 S       0  0.0 68.9   0:13
traffic_mana
  846 root       0   0  224M 217M  1596 S       0  0.0 68.9   0:00
traffic_mana
  848 root       0   0  224M 217M  1596 S       0  0.0 68.9   0:00
traffic_mana
  850 root       0   0  224M 217M  1596 S       0  0.0 68.9   0:00
traffic_mana
  855 root       0   0  224M 217M  1596 S       0  0.0 68.9   0:00
traffic_mana
  856 root       0   0  224M 217M  1596 S       0  0.0 68.9   0:00
traffic_mana
  857 root       0   0  224M 217M  1596 S       0  0.0 68.9   0:00
traffic_mana

  This information is missleading since there is no way to know that
these 9 threads are sharing memory. If you run 'ps axl' you can see
the hierarchy as if it was a multiprocess program, i.e. no difference
to show you that they are threads.  Not even reading
/proc/<pid>/status you get info about these being threads.

  Of course, I am talking about kernel 2.2.x, but AFAIK this has not
changed in the new kernels.

  Would it make sense to include this as an entry of the /proc/<pid>?

  Thanks for reading,

    Jorge


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-03-09  9:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-06 17:01 Process vs. Threads Dan Kegel
2001-03-06 17:32 ` Ulf Carlsson
  -- strict thread matches above, loose matches on Subject: below --
2001-03-08  0:17 Hank Leininger
2001-03-09  9:48 ` Albert D. Cahalan
2001-03-06 16:28 Jorge David Ortiz Fuentes
2001-03-06 16:58 ` Gregory Maxwell
2001-03-07  9:01   ` Helge Hafting
2001-03-07 23:30     ` Albert D. Cahalan
2001-03-08  3:09     ` David Schwartz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox