Java线程,绿色还是本机? [英] Java threads, green or native?

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

问题描述

如果我有多核计算机,Java线程是否在不同的处理器核上运行?换句话说,如果我运行Thread.start(),该线程是绿色的还是本地的?

are Java Threads running on different processors core if I have multi-cores machine? In other words, if I run Thread.start(), is this thread green or native?

谢谢

推荐答案

在Java 1.1中,至少在Solaris上,绿色线程是JVM使用的唯一线程模型.由于绿色线程与本地线程相比有一些局限性,因此后续的Java版本放弃了绿色线程,转而使用本地线程.

In Java 1.1, green threads were the only threading model used by the JVM, at least on Solaris. As green threads have some limitations compared to native threads, subsequent Java versions dropped them in favor of native threads.

Squawk虚拟机是一个例外,它是低功耗设备的操作系统和Java虚拟机之间的混合体.它使用绿色线程来将本地代码保持在绝对最低限度并支持其隔离的迁移.

An exception to this is the Squawk virtual machine, which is a mixture between an operating system for low-power devices and a Java virtual machine. It uses green threads in order to keep the native code to an absolute minimum and to support the migration of its isolates.

维基百科这样说.

这篇关于Java线程,绿色还是本机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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