comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: How many hardware threads?
Date: Mon, 12 Jul 2010 02:38:45 +0000 (UTC)
Date: 2010-07-12T02:38:45+00:00	[thread overview]
Message-ID: <i1dv7k$b07$1@speranza.aioe.org> (raw)
In-Reply-To: 4c3a65d7$0$2405$4d3efbfe@news.sover.net

> I'm about to write a simple program that decomposes into parallel,
> compute-bound tasks quite nicely. How many such tasks should I create? I
> could ask the user to provide the number as a command line argument or
> in a configuration file. Yet it seems like the program should just be
> able to figure it out. Does Ada have a standard way of doing that?
  In MS Windows you can call GetProcessAffinityMask and count the ones
in your process's mask.
  But just knowing how many CPUs there are is just the beginning.  Are
there other programs running on the machine and should you leave some CPUs
for them, or grab them all for your program?  What about cache?  It tends
to be small and if you (or your program plus any others running on the
system) actually try to use all the CPUs simultaneously you may thrash.
Thread overhead goes up with thread count.  The best algorithm may not be
the most straightforward.
  In the early days of virtual memory some people thought "I have a giant
memory, which I can access as I wish".  They soon found they needed to
consider access patterns or their program could thrash horribly.
Similarly for multi-core CPUs.



  parent reply	other threads:[~2010-07-12  2:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12  0:47 How many hardware threads? Peter C. Chapin
2010-07-12  2:31 ` Jeffrey R. Carter
2010-07-12 17:04   ` Pascal Obry
2010-08-16 19:36     ` Yannick Duchêne (Hibou57)
2010-08-17  3:45       ` Randy Brukardt
2010-08-17  9:27       ` Pascal Obry
2010-07-12  2:38 ` tmoran [this message]
2010-07-12  7:40 ` Dmitry A. Kazakov
2010-07-12 17:14   ` Warren
2010-07-13  0:01   ` Gene
2010-07-13  1:09     ` Shark8
2010-07-12 10:08 ` anon
2010-07-12 11:04 ` Ludovic Brenta
2010-07-12 11:47 ` Egil Høvik
replies disabled

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