Java:JVM可用的核心? [英] Java: Cores available to the JVM?

查看:391
本文介绍了Java:JVM可用的核心?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java中有方法 Runtime.getRuntime()。availableProcessors()其中包含以下Javadoc:

In Java there's the method Runtime.getRuntime().availableProcessors() which has the following Javadoc:


返回Java虚拟机可用的处理器数。
在特定的虚拟机调用期间,此值可能会更改。

值如何实际更改?在什么情况下,JVM可用的处理器比实际安装的处理器少?

How can the value actually change? Under what circumstances would there be less processors available to the JVM than physically installed for example?

Jonas

推荐答案

Linux命令 taskset(1)可用于强制进程使用特定的CPU或特定的CPU集合;修改正在运行的程序以强制它到一个或多个处理器非常容易。例如,

The Linux command taskset(1) can be used to force processes to use a specific CPU or specific sets of CPUs; it is pretty easy to modify a running program to force it to one or more processors. For example,

taskset -p `pidof java` --cpu-list 0,5,7,9-11

这篇关于Java:JVM可用的核心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆