Re: gthread: how many cores do I have?
- From: Tor Lillqvist <tml iki fi>
- To: jcupitt gmail com
- Cc: gtk-devel-list <gtk-devel-list gnome org>
- Subject: Re: gthread: how many cores do I have?
- Date: Mon, 15 Mar 2010 13:36:21 +0200
> I'd my program (a threaded image processing system based on gthread)
> to be able to find out how many cores the host machine has.
First a terminological nit: Don't confuse "cores" with "processors".
There were machines with a high degree of symmetrical multiprocessing
(i.e. lots of processors) a *long* time before multi-core chips
appeared on the market.
> int g_thread_get_cores( void );
Well, firstly the function name should use "processors" and not
"cores". But I think that in general such a function would be too
simplistic, and just look at things from the perspective of the
current low end of the market.
Whether it's worth to try to design a suitable GLib abstraction for
such things, I don't know. In serious parallelism, you need more
advanced API anyway, you need to consider things like NUMA, asymmetric
multiprocessing etc. (Note, I am certainly not an expert here.) You
will almost certainly need some platform-dependent code, surely? Or
use other libraries that already do it for you?
--tml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]