Martijn van Oosterhout wrote:

Now you've piqued my curiosity. You have two threads of control (either
two processes or two threads) which shared a peice of memory. How can
the threads syncronise easier than processes, what other feature is
there? AFAIK the futexes used by Linux threads is just as applicable
and fast between two processes as two threads. All that is required is
some shared memory.


Agree. On Linux, this is not a big issue. Linux is rather special though, since the whole kernel is built in a way that more or less puts an equal sign between a process and a thread. This is changing though. Don't know what relevance that will have on this issue.

Shared Memory and multiple processes have other negative impacts on performance since you force the CPU to jump between different memory spaces. Switching between those address spaces will decrease the CPU cache hits. You might think this is esoteric and irrelevant, but the fact is, cache misses are extremely expensive and the problem is increasing. While CPU speed has increased 152 times or so since the 80's, the speed on memory has only quadrupled.

Or are you suggesting the only difference is in switching time (which
is not that significant).


"not that significant" all depends on how often you need to switch. On most OS'es, a process switch is significantly slower than switching between threads (again, Linux may be an exception to the rule).

Regards,
Thomas Hallgren



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to