-
December 15th, 2018, 03:14 AM
#1
Finding Number of Cores in Java
How can I find the number of cores available to my application from within Java code?
-
December 15th, 2018, 07:43 PM
#2
Re: Finding Number of Cores in Java
Look at the Runtime class's methods.
Norm
-
December 17th, 2018, 05:35 AM
#3
Re: Finding Number of Cores in Java
Finding Number of Cores in Java
int cores = Runtime.getRuntime().availableProcessors();
If cores is less than one, either your processor is about to die, or your JVM has a serious bug in it, or the universe is about to blow up.
Last edited by 2kaud; December 17th, 2018 at 08:17 AM.
Reason: removed site advert
-
December 17th, 2018, 04:20 PM
#4
Re: Finding Number of Cores in Java
Originally Posted by kadammanali987
If cores is less than one, either your processor is about to die, or your JVM has a serious bug in it, or the universe is about to blow up.
Or a divine power is giving you a sign not to make your application dependent on the number of cores.
-
December 18th, 2018, 08:56 AM
#5
Re: Finding Number of Cores in Java
Originally Posted by wolle
Or a divine power is giving you a sign not to make your application dependent on the number of cores.
Again, why are you reposting old threads from StackOverflow. This is the third one now.
https://stackoverflow.com/questions/...-cores-in-java
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|