Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Runtime.availableProcessors() question...

807589Dec 29 2008 — edited Dec 29 2008
So, i have a class that will take in Runnable objects, and send them to be processed when a processor opens.

So far, i have been dealing with a single-processor model. However, now i want to upgrade my code to be able
to handle multiple processors. These jobs will not step on each others toes, so they can run concurrently with
no problems. My question is: when i run the Runtime.availableProcessors() method, what does that number it
returns mean to me? Is it the number of processors available on the System in general, or the number of
processors available at the time of the call, to accept jobs? So, if i have 5 processes in the queue, and i have a 2
processor machine, i farm out the first 2 processes, and that method will return 0 until one of these processes
finishes? something tells me its not that easy.

any info given is very much appreciated. thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 26 2009
Added on Dec 29 2008
6 comments
266 views