Solved

Processor Identification

Posted on 2010-11-21
3
403 Views
Last Modified: 2012-05-10
Is there a way in Java to identify the processor that the current thread is assigned to?
0
Comment
Question by:jjcamachosanchez
  • 2
3 Comments
 
LVL 35

Expert Comment

by:mccarl
ID: 34184909
No, and it wouldn't make sense anyway. There is never a guarantee that the same processor/core will always execute the code for a particular thread. Therefore if there were such a call, the result would be useless as by the time it returns a result to your code, the code may be executing on a different processor/core!
0
 

Author Comment

by:jjcamachosanchez
ID: 34185245
I probably stated the question in the wrong way. What I want is to assess how many processors are executing threads of my program.
0
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 34185296
OK, but still it is something very JVM/OS/machine specific and so I doubt there is any way to do it in Java. I would say that your best bet would be to look at it from the other way, get you OS to tell you where/when threads of your java app are scheduled. Eg. a simple windows based approach is to check out Task Manager and look at the load on the processor cores. I am sure that are other methods available for other OS's and that are more sophisticated ways of doing it too.

Basically, it's the OS's scheduler that determines where threads run (java threads or others alike) and so that is where you need to hook to get that information, and since that would be OS specific, it is highly unlikely that Java would be able to get the info.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now