Chinaunix首页 | 论坛 | 博客
  • 博客访问: 610266
  • 博文数量: 197
  • 博客积分: 7001
  • 博客等级: 大校
  • 技术积分: 2155
  • 用 户 组: 普通用户
  • 注册时间: 2005-02-24 00:29
文章分类

全部博文(197)

文章存档

2022年(1)

2019年(2)

2015年(1)

2012年(100)

2011年(69)

2010年(14)

2007年(3)

2005年(7)

分类: Java

2011-01-09 23:56:01

恐龙书(第6版)5.8节对此有简单讨论

http://unix.derkeiler.com/Mailing-Lists/FreeBSD/current/2006-10/msg00550.html
Wrong. Java used to be N:M ("green threads") a long time ago, and all actual versions (1.4, 1.5, future 1.6) uses 1:1 model.

http://unix.derkeiler.com/Mailing-Lists/FreeBSD/current/2006-10/msg00555.html
Since 1.4 (or 1.3 if you used "native" threads with it, which we didn't by default) its been 1:1. Green threads was a userland threading implementation entirely in the JVM, much like libc_r.
It wasn't M:N but rather M:1 (since there were no system threads, just the JVMs own internal threads).

http://unix.derkeiler.com/Mailing-Lists/FreeBSD/current/2006-10/msg00575.html
I ran some simple tests with the 1.4.2 JVM. It appears that, at least in my simple test cases, all threads created in the JVM are exposed to the OS. Typically this appears to be about n+8 to n+9 threads, where n is the number of threads created by the application itself, and 8/9 is the number created by the JVM.

http://unix.derkeiler.com/Mailing-Lists/FreeBSD/current/2006-10/msg00586.html
If you really want to know, just send the running process a SIGQUIT and it will dump the currently running threads to stdout. But yes, 1.4 and 1.5 both use "native" threads which correspond 1:1 with OS threads (plus there are threads the JVM creates itself, as you note). The JVM threads
include garbage collection and AWT event handlers at least.

另外,参见
关于Java线程的实现
阅读(994) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~