“不错"吗?影响Java线程的优先级 [英] Does "nice" affect the priority of Java threads

查看:287
本文介绍了“不错"吗?影响Java线程的优先级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Unix系统上,可以使用nice命令以较低的CPU优先级运行进程:

On a Unix system, you can run a process at lower CPU priority using the nice command:

 nice program

您可以使用它来运行JVM进程:

And you could use that to run a JVM process:

 nice java -jar program.jar

该JVM进程运行的Java程序将启动多个线程.

The Java program run by that JVM process will start multiple threads.

nice更改是否会影响那些Java线程的调度?也就是说,当Java线程以以下方式运行时,其CPU优先级是否会降低

Does the nice change affect the scheduling of those Java threads? That is, will the Java threads have a lower CPU priority when run as

 nice java -jar program.jar

以...方式运行时

 java -jar program.jar

通常,这将取决于系统,因此我对Linux的情况很感兴趣.

In general, this will be system dependent, so I am interested in teh Linux case.

推荐答案

实际上...根据POSIX.1,尼斯性是应用程序的一个属性.这是更详细的帖子. 是nice(),用于更改线程优先级还是进程优先级?

Actually...Niceness is a property of the application according to POSIX.1. Here is a more detailed post. is nice() used to change the thread priority or the process priority?

这篇关于“不错"吗?影响Java线程的优先级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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