RE: Who changed /proc// in 2.6.0-test5-bk9?

Linus Torvalds
2003-10-07T23:26:27Z

On Tue, 7 Oct 2003, Robert White wrote:
>
> I can say that (virtually) any programmer who does a lot of threads work is
> going to presume that he may pass file handles between threads safely.
>
> IMHO it would be exceptionally bad to break this assumption.

That's not true.

It's true that if you use the pthreads model, you'll pass fd's between
threads freely.

But there are lots of other valid thread usages. Many of the original uses
of Linux threading were for special-case apps which used the clone()
interface directly. Some were games, where the native threading stuff was
doing things like sound etc in the background.

And when you have _that_ kind of model (with assymetric specialized
threads), it makes perfect sense for the threads to have independent file
descriptors.

> At the purist level, when I pass an abstraction (data structure etc) around
> between my threads, having done my due-diligence WRT locking and such, I
> expect that when the abstraction gets there it will still be valid.

And that is what you get with pthreads.

But the native Linux threading has never been pthreads. It's been about a
much more generic thing, where the user is in control of what he does.

And that, btw, implies that thread nazis that only use pthreads do _not_
get to determine what the rest of the world does.

Linus