comp.lang.ada
 help / color / mirror / Atom feed
From: Paul Rubin <no.email@nospam.invalid>
Subject: Re: Large number of tasks slows down my program (using debian) - any fix?
Date: Fri, 30 Mar 2018 13:46:10 -0700
Date: 2018-03-30T13:46:10-07:00	[thread overview]
Message-ID: <87h8ox1ect.fsf@nightsong.com> (raw)
In-Reply-To: p9kuig$lq8$1@gioia.aioe.org

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> It is a simple calculation. Assuming a context switch were around
> 1000ns. x 500 tasks / 4 cores = 125ms if all tasks are busy. 125ms is
> a long time.

It's 125 microseconds or 1/8th of a millisecond, not that bad at all.  I
assume that's what you meant by ms.  I'm used to ms denoting
milliseconds while microseconds are written us.

Also keep in mind that 4-core Intel boxes typically have 8 hardware
threads ("hyperthreads" or logical cores) and there is basically no
context switch time between hyperthreads on a core.  They speed up total
cpu throughput because they allow another thread to run during the time
that the first thread is blocked on a hardware cache miss waiting for a
RAM operation.

> ...  Assuming the time quant is 10ms...: 10 x 500 / 4 = 1.25s [+125ms]
> is the time a task gets back to a core. 1.3s is an eternity.

Sure, if all 500 tasks are cpu-busy then things are in a dreadful state,
but usually the reason to use so many tasks is concurrent i/o, i.e. most
of the threads are blocked awaiting input.


  reply	other threads:[~2018-03-30 20:46 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 18:06 Large number of tasks slows down my program (using debian) - any fix? reinert
2018-03-28 18:49 ` Dennis Lee Bieber
2018-03-28 19:06 ` Paul Rubin
2018-03-28 19:21 ` Dmitry A. Kazakov
2018-03-28 20:17   ` reinert
2018-03-29  8:46     ` reinert
2018-03-29  9:18       ` Dmitry A. Kazakov
2018-03-29 15:39       ` Jeffrey R. Carter
2018-04-15  5:20         ` reinert
2018-03-29 22:33 ` Shark8
2018-03-30  9:04   ` Dmitry A. Kazakov
2018-03-30 20:46     ` Paul Rubin [this message]
2018-03-31  0:09       ` Randy Brukardt
2018-03-31  6:00         ` Paul Rubin
2018-03-31  9:37           ` Jacob Sparre Andersen
2018-03-31 10:44             ` Dmitry A. Kazakov
2018-04-02  3:35           ` Randy Brukardt
2018-04-02  6:23     ` alby.gamper
2018-04-02  7:12       ` alby.gamper
2018-04-05 14:07       ` Brad Moore
2018-04-05 15:09         ` Dmitry A. Kazakov
2018-04-07  4:16           ` Brad Moore
2018-04-05 15:30         ` Jeffrey R. Carter
2018-04-05 19:33           ` Spiros Bousbouras
2018-04-05 19:44           ` Simon Wright
2018-04-05 20:25             ` Jeffrey R. Carter
2018-04-06  5:58         ` Benchmarks Game: Thread ring (Was: Large number of tasks slows down my program (using debian) - any fix?) Jacob Sparre Andersen
2018-04-07  4:28           ` Brad Moore
2018-04-06 15:48         ` Large number of tasks slows down my program (using debian) - any fix? Jeffrey R. Carter
2018-04-07  4:39           ` Brad Moore
2018-04-07  8:15             ` Jeffrey R. Carter
2018-04-07 16:28               ` Brad Moore
2018-04-07 18:41                 ` Jeffrey R. Carter
2018-04-08  0:29                   ` Brad Moore
2018-04-08  8:25                     ` Jeffrey R. Carter
2018-04-08  0:06                 ` Robert I. Eachus
2018-04-07 16:51               ` Brad Moore
2018-04-07 12:21         ` Simon Wright
2018-04-07 16:57           ` Brad Moore
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox