multi-core software
Jon Harrop
jon at ffconsultancy.com
Sun Jun 7 11:21:58 EDT 2009
Paul Rubin wrote:
> "Jeff M." <massung at gmail.com> writes:
>> > > Even the lightest weight
>> > > user space ("green") threads need a few hundred instructions,
>> > > minimum, to amortize the cost of context switching....
>> There's always a context switch. It's just whether or not you are
>> switching in/out a virtual stack and registers for the context or the
>> hardware stack/registers.
>
> I don't see the hundreds of instructions in that case.
>
>
http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&lang=ghc&id=3
>
> shows GHC doing 50 million lightweight thread switches in 8.47
> seconds, passing a token around a thread ring. Almost all of that is
> probably spent acquiring and releasing the token's lock as the token
> is passed from one thread to another. That simply doesn't leave time
> for hundreds of instructions per switch.
And Haskell is not exactly fast...
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
More information about the Python-list
mailing list