Re: binaries not portable from Debian to RedHat

From: David Schwartz (davids_at_webmaster.com)
Date: 07/16/05


Date: Sat, 16 Jul 2005 13:25:27 -0700


"Kasper Dupont" <kasperd@daimi.au.dk> wrote in message
news:42D9140A.D61E2451@daimi.au.dk...

> Problem solved. Somehow I doubt any standard says
> you are not allowed to have a ps command, if there
> isn't a way to tell a difference between threads
> and processes. In fact in Linux they are the same.

    No, they're not the same. Processes consist of one or more threads.
Threads are KSEs handled by the kernel. If a process has ten threads, saying
that processes and threads are the same is saying that ten threads is the
same as one thread.

>> >> It's based on the definition of "process". Modern "ps"
>> >> implementations
>> >> are smart enough to know that they're supposed to show *processes*,
>> >> not
>> >> KSEs. Older ones aren't so smart.

>> > Try an old ps on a new kernel, and try a new ps on
>> > an old kernel.

>> Eww. I hope they didn't 'fix' the kernel, because there really wasn't
>> anything wrong with it.

> No, there was nothing wrong with it. It worked
> perfectly fine, it just wasn't complying with any
> standards. So a few changes were made to make it
> compliant with Posix.

>> The ideal solution would be for the kernel to
>> identify which KSEs share vm and for 'ps' to use this information to
>> prepare
>> the correct display.

> Could be handy, but AFAIK the kernel does not any
> way to tell if two tasks share vm.

    If true, then there would be no way to tell which KSEs are part of the
same thread and it would be impossible to implement 'ps' correctly. That is,
unless the kernel provides some other way to distinguish which threads are
part of the same process.

>> Configuring the kernel to suppress what threads is,
>> IMO, an inferior solution.
>
> Seems like you actually don't know how it works.

    I don't know how 'ps' now tells how KSEs map to processes. I was under
the impression RedHat had modified 'ps' to suppress all but the first KSE of
a process through some kind of hack. I'm not sure where I got that
impression but it's certainly possible that it's incorrect.

    It really doesn't matter how it does it though. If the kernel was
changed or ps was find, either way, the bug was fixed. For 'ps' to show the
threads inside a process by default is a bug. The 'ps' command should hide
implementation details of the kernel and/or threading library and provide
the user with a *list* of *processes*, regardless of how many threads they
have.

    DS



Relevant Pages