Java线程到Linux线程(LWP)的一对一映射 [英] One to one mapping of Java Thread to Linux thread (LWP)

查看:587
本文介绍了Java线程到Linux线程(LWP)的一对一映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java Thread 对象和OS线程(轻量级进程)之间是否存在一对一映射。也就是说,如果我有一个 Thread 对象,我是否可以始终确定一个关联的OS线程,并且我是否总是拥有相同的关联OS线程?通常这是依赖于操作系统和JVM的,因此我将使用Oracle和Open JDK JVM将问题限制在Linux。

Is there a one to one mapping between Java Thread objects and OS threads (Lightweight processes). That is, if I have a Thread object, can I always identify precisely one associated OS thread, and will I always have the same associated OS thread? In general this is OS and JVM dependent, so I'll restrict the question to Linux with the Oracle and Open JDK JVMs.

<$ c $的情况如何? c> sleep ing或等待线程?还有未开始运行的线程和已经完成运行的线程的极端情况?

What about the cases of sleeping or waiting threads? And the corner cases of threads that have not started running and those that have finished running?

推荐答案


Java Thread对象和OS线程之间是否有一对一的映射(

Is there a one to one mapping between Java Thread objects and OS threads (

是的,自Java 1.2以来就已存在。

Yes there is, it has been since Java 1.2.

Java 1.2之前使用了一个绿色线程模型,它将几个Java线程映射到一个OS线程。

Prior to Java 1.2 a "green threads" model were used which mapped several Java threads to one OS thread.

这篇关于Java线程到Linux线程(LWP)的一对一映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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