Java线程在哪个处理器上运行? [英] Java thread running on which processor?
本文介绍了Java线程在哪个处理器上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用Java本机线程找出运行线程的处理器(在单个系统上还是在多个系统上)?如果没有,是否有任何图书馆可以帮助您?
Is there a way to find out which processor (either on a single system or mutliple systems) your thread is running on, using Java native threads? If not, is there any library which could help?
推荐答案
JVM的线程调度程序是特定于JVM的,因此没有通用"解决方案.据我所知,没有可用的现成可用,而是使用:
The JVM's thread scheduler is JVM-specific, so there is no 'universal' solution. As far as I know there is nothing available out-of-the-box, but perhaps using:
- Sun JVM;
- Solaris-或Mac,如 Tom Hawtin-粗线所指出;
- DTrace . >
- the Sun JVM;
- Solaris - or Mac, as Tom Hawtin - tackline points out;
- DTrace.
您可能会有些运气:
- 跟踪
thread-start
探针,其探针为args[3]
本机/OS线程ID.这是由主机操作系统分配的ID" - 使用Solaris特定的实用程序将本机/OS线程ID映射到CPU.
- trace a
thread-start
probe, which has asargs[3]
the "The native/OS thread ID. This is the ID assigned by the host operating system " - map the native/OS thread ID to a CPU, using Solaris-specific utilities.
这篇关于Java线程在哪个处理器上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文