Stephen Tweedie said exactly the same thing :)
> but I haven't actually tried that out..
> > There are probably some changes that could be made to the kernel to
> > lower the overhead of switching between two threads of the same
> > process. The one that I can think of is sharing of all thread invariant
> > task_struct data. When the clone() ( do_fork() ) routine is called
> > a new struct task_struct is allocated, and the clone()'ing process's
> > entire task_struct is copied.
> No. Only the per-thread data is copied, and the thread-invariant stuff is
> already shared. Look at the "struct mm_struct", "struct files_struct" and
> "struct signal_struct" etc pointers in the task structure. A clone() that
> shares those structures just increments a usage pointer instead of copying
I had seen the "struct mm_struct", and the other structs that get pointed
to when the clone() is done, but I guess that since the task_struct was
rather large, and I don't really know what most of it is for, I thought
that there could be more done to optimize it for threads. I didn't
really know what, and really was only suggesting the possibility. I also
think that I assumed the linux context switch was expensive, because it's
expensive on some other systems.
-- Peeter Joot TOROLAB(PJOOT) firstname.lastname@example.org IBM Canada Tie Line 778-3186 Phone 416-448-3186