Runtime.availableProcessors() question...
807589Dec 29 2008 — edited Dec 29 2008So, 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