Subj : Re: Threads and processes on Linux To : Generic Usenet Account From : James McIninch Date : Wed Mar 30 2005 01:39 pm The answer depends on the kernel version. Older versions use the lightwieght process thread model, newer versions use a more distinct thread model. Both are different than processes, but the lightweight process model does make each thread appear as a separate process in the process list. Both models are consistent with the POSIX thread API. Generic Usenet Account wrote: > I have often heard that in a Linux environment there is no difference > between threads and processes. I want to know if that is merely > "rhetoric" or if that is really so. For example, I have seen that > getpid() in all threads returns the same value (as I think it should). > This means from the perspective of operations associated with processes > (ps, signal etc.), all the threads are viewed as a single entity. > > Also, if the spawning thread terminates (e.g. it does not do a join on > the spawned thread), the spwaned thread also seems to terminate. In > other words, the lifetime of a spawned thread does not seem to exceed > the lifetime of the spawning thread. This is quite different from > processes, where the lifetime of a spawned process is completely > independent from the lifetime of the spawning process. In fact, if the > spawning process terminates before the spawned process, the root > process assumes ownership of the spawned process. > > So what exactly are we saying when we state that "there is no > difference between threads and processes on Linux"? I think it merely > means that unlike in the past, where tasks and light-weight processes > did not have visibility outside the application, threads in Linux have > limited visibility outside the application process and they are > scheduled in the same way as processes are. However, I am not sure if > my thinking is correct. > > Any insight will be appreciated. > > Thanks, > Gus -- Remove '.nospam' from e-mail address to reply by e-mail .