applications forking / not threading

Aaron BRICE aaron.brice at st.com
Thu Dec 9 14:18:36 PST 2004


zareh at dslextreme.com wrote:
> For example, when I compile monit on my LFS system, I see that its running
> multiple processes, each one monitoring one of the pids I've told it to
> monitor. When I compile it on my Fedora Core 1 system, I see it running as
> 1 process with multiple threads. I'd like to know why this is.
> 
> The main reason why I'd like to find this out has to do with mimedefang.
> On my LFS system the main process forks 2 child processes, but the main
> mimedefang process will not die unless I kill the last child process, this
> causes a problem in that I will not know what the pid for the last child
> will be.
> 
> mimedefang compiled inside Fedora Core 1 launches 1 process with multiple
> threads and I can simply kill the main mimedefang process witout a
> problem.
> 
> I'd like to know why I cannot compile these 2 applications to use threads.
> 
> Matthias B.
> 

What's your LFS system?

Fedora Core uses NPTL (Native POSIX Thread Library) which was introduced 
with 2.6 kernel.  I'm guessing your LFS system is not as new and uses a 
2.4 kernel with the LinuxThreads library.  Under the LinuxThreads 
library, separate threads have a different PID so they look like 
separate processes in ps output, but they are threads.  With NPTL the 
threads share a PID.

To update your LFS system, theoretically you'll have to update to 2.6 
kernel and recompile glibc with nptl support.

Aaron




More information about the blfs-support mailing list