Feature request: ability to use libeio with multiple event loops

Ben Noordhuis info at bnoordhuis.nl
Wed Dec 21 03:37:48 CET 2011


On Wed, Dec 21, 2011 at 01:46, Marc Lehmann <schmorp at schmorp.de> wrote:
> On Tue, Dec 20, 2011 at 09:26:28PM +0100, Hongli Lai <hongli at phusion.nl> wrote:
>> I would like to know more about this claim. It's not that I don't
>> believe you, but I'm genuinely interested in this area and I hear all
>> kinds of (often contradicting) information about threads vs processes.
>> What is it about processes that are more efficient than threads? For
>> the sake of simplicity let's limit ourselves to x86 Linux and x86_64
>> Linux. I don't really care about other platforms.
>
> Well, threads were originally invented because single cpus only had a single
> set of registers, and swapping these can be costly (especially with vm
> state).

You either have an overly broad definition of or simply the wrong idea
about what CPU registers are. What do you think happens when a thread
on a UP system is swapped for another one?

The benefit that threads have over processes on UP systems is that
they share the same address space. There should be no or fewer TLB
misses provided the operating system doesn't flush the TLB cache on
each task switch. But guess what, that's something x86_64 linux
kernels always do. Apparently it's faster than invalidating ranges of
individual pages.



More information about the libev mailing list