Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Multithreading vs. Forks

On Sat, Sep 29, 2001 at 11:55:31PM +1000, Scott Howard wrote:
> applications where it suits (and it doesnt always suit). The overhead of
> a context switch is always going to be greater than that of switching
> between threads (which all occur within the same context).

I was under the impression that a different thread *is* a different
context... it has its own stack, its own registers, and probably can
have its own memory address space too.  They're basically like
processes, except they tend to share an awful lot of their memory with
other threads of the same "process".

In this case, I fail to see why it would be significantly faster to
switch between threads than it is to switch between processes.  I should
probably write a program to benchmark this to find out for certain, I

I could well be incorrect about all this... if so, I would greatly
appreciate it if someone could please enlighten me.