Java限制资源使用 [英] Java limiting resource usage

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

问题描述

有没有办法限制java使用的核心数量?

Is there a way to limit both the number of cores that java uses?

并且同样可以限制核心的数量是多少正在使用?

And in that same vein, is it possible to limit how much of that core is being used?

推荐答案

您可以在linux上使用taskset。您也可以降低进程的优先级,但除非CPU(S)忙,否则进程将获得尽可能多的CPU。

You can use taskset on linux. You can also lower the priority of a process, but unless the CPU(S) are busy, a process will get as much CPU as it can use.

我有一个用于将线程专用于核心的库,称为Java Thread Affinity,但它可能与您的想法有不同的目的。你能澄清一下你为什么要这样做吗?

I have a library for dedicating thread to a core, called Java Thread Affinity, but it may have a different purpose to what you have in mind. Can you clarify why you want to do this?

这篇关于Java限制资源使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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