Feature request: ability to use libeio with multiple event loops
Hongli Lai
hongli at phusion.nl
Wed Dec 28 17:14:51 CET 2011
On Thu, Dec 22, 2011 at 8:05 AM, Hongli Lai <hongli at phusion.nl> wrote:
> According to that same Wikipedia article, some CPUs have multiple
> register files in order to reduce thread switching time, i.e. what you
> describe as extra support for multiple contexts. According to the
> article, that idea came in the late 1990s to x86 desktop CPUs when
> Intel introduced HyperThreading. So it looks like we're talking about
> the same thing.
>
>
>>> Let me get this right before continuing the discussion. Are you saying
>>> that this program (in pseudo code):
>>
>> Thats not all I am saying, but I would say that for these programs, yes.
>
> I agree that threads tend to be overhyped compared to processes, but
> I'm here to learn the truth, which is why I'm asking these things.
>
> It's true that the second program adds an extra layer of indirection
> (the 'data' variable). However:
> 1. If the data is accessed frequently then both the pointer and the
> ThreadData that it points to should be cached by the CPU cache, making
> the indirection very cheap.
> 2. Suppose the system has two cores and N = 4, so two processes or two
> threads will be scheduled on a single core. A context switch to
> another thread on the same core should be cheaper because 1) the MMU
> register does not have to swapped and 2) no existing TLB entries have
> to be invalidated.
>
> I think that (1) and (2) are sufficiently beneficial that the program
> should run faster overall, even with the extra indirection. Do you not
> think so?
Hi Marc, would you like to tell me your thoughts on this? I would
really appreciate it if I can get an opinion from an expert on this
matter.
- Hongli
--
Phusion | Ruby & Rails deployment, scaling and tuning solutions
Web: http://www.phusion.nl/
E-mail: info at phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)
More information about the libev
mailing list