Runtime.getRuntime().availableProcessors() 淡淡的烟草味﹌ 2022-11-20 09:54 71阅读 0赞 \*\*java.lang.Runtime.availableProcessors() 方法: 返回可用处理器的Java虚拟机的数量。 \*\* 就是返回处理器是几核几线程的,i594000f返回的是6,因为是6核6线程的 这个值可以在虚拟机中的某个调用过程中改变。应用程序是可用的处理器数量敏感,因此应该偶尔查询该属性,并适当调整自己的资源使用情况。 package com.vrv.linkdood_util; /** * <B>说 明<B/>: * * @author 作者名:冯龙淼 * E-mail:fenglongmiao@vrvmail.com.cn * * @version 版 本 号:1.0.<br/> * 创建时间:2018年2月28日 下午3:53:47 */ public class RuntimeMain{ public static void main(String arg[]){ // check the number of processors available System.out.println(""+Runtime.getRuntime().availableProcessors()); } }
还没有评论,来说两句吧...