Re: Threading NOT working as expected
- From: Ted Zlatanov <tzz@xxxxxxxxxxxx>
- Date: Mon, 03 Mar 2008 13:38:12 -0600
On Sat, 1 Mar 2008 18:09:32 +0100 Martijn Lievaart <m@xxxxxxxxxxxxxxxx> wrote:
ML> On Sat, 01 Mar 2008 17:04:08 +0100, Peter J. Holzer wrote:
On 2008-02-26 16:39, Ted Zlatanov <tzz@xxxxxxxxxxxx> wrote:
In a multithreaded setup, the CPU has a chance to run several threads
while memory and I/O fetches are happening.
Multithreading won't help for memory fetches. Firstly because CPUs don't
have a way to inform the OS of a slow memory access, and secondly
because the overhead of switching to a different thread would be much
too high for such a (relatively) short wait. There is one exception:
So-called multi-threading CPUs can keep the state of a fixed (and
usually low) number of thrads on the CPU and switch between them. But
these are really just multi-core CPUs which share some of their units.
You are completely right about I/O of course.
ML> Not even. If all those I/Os are going to the same disk, you run the risk
ML> of thrashing, and overall performance goes down instead of up.
That's very application-dependent. Note my original statement: the CPU
has a chance to run several threads while fetches are happening. It
doesn't mean that I/O will work better than way, but that's not a
multithreading problem. The elevator algorithm introduced fairly
recently in Linux kernels (IIRC) addresses this kind of I/O contention
in the right place, outside the application.
Ted
.
- References:
- Re: Threading NOT working as expected
- From: Peter J. Holzer
- Re: Threading NOT working as expected
- From: Martijn Lievaart
- Re: Threading NOT working as expected
- Prev by Date: Re: Spread***::ParseExcel - How to get certain Cells
- Next by Date: Re: FAQ 4.53 How do I manipulate arrays of bits?
- Previous by thread: Re: Threading NOT working as expected
- Next by thread: FAQ 4.57 How do I look up a hash element by value?
- Index(es):
Loading