Re: Detecting Number of Available CPU Threads

2010-02-11 Thread Daniel Werner
On Feb 9, 2:37 am, Wardrop t...@tomwardrop.com wrote:
 That seems like what I'm after, thanks. I assume this would be pretty
 reliable across all platforms running the JVM.

In .NET, on the other hand, this value is stored in
System.Environment.ProcessorCount. Perhaps it would be worthwhile to
make oft-requested information like this available via a standard API
so ClojureCLR and any future ports can maintain consistency?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Detecting Number of Available CPU Threads

2010-02-11 Thread Meikel Brandmeyer
Hi,

On Feb 9, 9:29 pm, Chouser chou...@gmail.com wrote:

 It may be worth noting that using 'send' to dispatch actions to
 an agent already takes into account the number of CPUs available.
 This essentially means it's safe to queue up sends on as many
 agents as you want -- hundreds, even thousands of agents --
 regardless of how many CPUs are on your current host.

I think hiding this information is a good thing. It allows to
implement strategies like grand central dispatch. Just because there
are x CPUs on a system, does not mean that they are to our disposal.
(No. We are *not* the only running process in the world.)

Sincerely
Meikel


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Detecting Number of Available CPU Threads

2010-02-09 Thread Chouser
On Mon, Feb 8, 2010 at 8:37 PM, Wardrop t...@tomwardrop.com wrote:
 That seems like what I'm after, thanks. I assume this would be pretty
 reliable across all platforms running the JVM.

 By the way, I did google the Java API with various keywords but never
 cam across this object property.

It may be worth noting that using 'send' to dispatch actions to
an agent already takes into account the number of CPUs available.
This essentially means it's safe to queue up sends on as many
agents as you want -- hundreds, even thousands of agents --
regardless of how many CPUs are on your current host.

The same is *not* true of 'send-off' or 'future', which do not
have bounds on their thread pool.

--Chouser
http://joyofclojure.com/

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Detecting Number of Available CPU Threads

2010-02-08 Thread Wardrop
I'm wondering if there's anyway in Clojure, that one can detect the
number of available processoring threads (ie. 4 core cpu with
hyperthreading would equal 8 available threads). This will allow me to
have a scalable processing app which can run on a single core CPU, or
250 core processor, without overwhelming the single core CPU with 250
threads (as an example).

Cheers

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Detecting Number of Available CPU Threads

2010-02-08 Thread Timothy Pratley
On 9 February 2010 11:29, Wardrop t...@tomwardrop.com wrote:
 I'm wondering if there's anyway in Clojure, that one can detect the
 number of available processoring threads

(.availableProcessors (Runtime/getRuntime)) might be what you are after?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Detecting Number of Available CPU Threads

2010-02-08 Thread Wardrop
That seems like what I'm after, thanks. I assume this would be pretty
reliable across all platforms running the JVM.

By the way, I did google the Java API with various keywords but never
cam across this object property.

Thanks

On Feb 9, 11:33 am, Timothy Pratley timothyprat...@gmail.com wrote:
 On 9 February 2010 11:29, Wardrop t...@tomwardrop.com wrote:

  I'm wondering if there's anyway in Clojure, that one can detect the
  number of available processoring threads

 (.availableProcessors (Runtime/getRuntime)) might be what you are after?

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en