Java如何处理多线程? [英] How does Java handle multithreading?

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

问题描述

Java如何决定分配线程或进程的核心?有没有办法控制它?防止两个大线程在同一个核心上执行?

How does Java decide which core to assign a thread or a process? Is there any way to control that? to prevent two large threads from executing on the same core?

基本上我要问的是有关多线程如何在Java中工作或如何控制的更多信息它在Java中。

Basically what I am asking is for further information on either how multi-threading works in Java, or how to control it within Java.

推荐答案

您无法为特定线程设置处理器关联。但是,如果将程序拆分为两个进程,则应该能够将这些进程分配给操作系统级别的特定处理器。

You can't set processor affinity for specific Threads. But if you split your program into two processes, you should be able to assign those processes to specific processors at the OS level.

http://www.cyberciti.biz/tips/setting-processor-affinity-certain -task-or-process.html

这篇关于Java如何处理多线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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