博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
difference between -Xss and -XX:ThreadStackSize
阅读量:6262 次
发布时间:2019-06-22

本文共 2536 字,大约阅读时间需要 8 分钟。

hot3.png

There's basically no difference between -Xss and -XX:ThreadStackSize, exceptthat the former dates before HotSpot became the default JVM in Sun's JDK,where as the latter is an internal VM flag of HotSpot. In effect, the formeris support in a lot of other JVMs, but the latter is specific to HotSpot.As an historical aside, the command line arguments for Sun JDK 1.0.x and1.1.x had these:-ss
set the C stack size of a process-oss
set the JAVA stack size of a processThese arguments got deprecated by -Xss and -Xoss in later versions of JDK.Non-internal flags either get processd by the java launcher (such as-server, -client, -verbosegc, etc.) or get converted into VM internal flagsby HotSpot. See hotspot/src/share/vm/runtime/arguments.cpp for details.For example, see this version:the launcher part: lines 1052 - 1058,and the VM part: lines 2227 - 2240.As you can see, -Xss gets converted into ThreadStackSize before the VM getsto use it.If the user did specify -ss or -Xss in command line arguments, that'll getpicked up directly by the launcher to run the main Java thread. Otherwise,the launcher asks the VM for a preferred stack size, and HotSpot will returnThreadStackSize, see here: lines 3286 - 3295.That should explain how they've been implemented to be basically equivalentin HotSpot.One thing, though: because the -Xss/-XX:ThreadStackSize argument is handledby the VM, *after* the primordial thread has been created, so they won'tcover the stack size of the primordial thread. In order to control stacksize correctly, Oracle/Sun's JDK doesn't run Java code in the primordialthread. See this bug: If you ever felt the function "ContinueInNewThread" in the launcher wasweird, that's the fix for this issue, so that Java code doesn't get run inthe primordial thread in HotSpot.By the way, I also want to know whether the java thread stack is equivalent> to the native thread stack? The stock HotSpot VM (the one in Oracle's Java SE JDK and OpenJDK) uses thesame stack for Java and native methods for a Java thread; Java frames andnative frames can be mixed together in such a stack.-Xss/-XX:ThreadStackSize controls the whole stack's size for Java threads.Because of this, -Xoss is simply ignored by HotSpot -- there's no separatestack to set the size for.There are some variants of HotSpot VM that does use a separate interpreterstack, e.g. Azul's version. See this post from Cliff Click for more detailsof the Azul implementation:

转载于:https://my.oschina.net/u/138995/blog/213499

你可能感兴趣的文章
C++---类和对象
查看>>
软件工程第一次团队作业
查看>>
排序算法5--交换排序--快速排序
查看>>
Redis 五种数据结构详解(string,hash,list,set,zset)
查看>>
201621123069 《Java程序设计》第14周学习总结
查看>>
梦断代码阅读笔记02
查看>>
Quick Cocos2dx MVC初步
查看>>
解决VS Code使用code runner开发Python乱码问题
查看>>
try-catch-finally块的运行机制
查看>>
1.6.2 保存到文件
查看>>
iOS开发多线程篇—多线程简单介绍
查看>>
构建之法读后感
查看>>
awk命令
查看>>
WorldWind Java 版学习:5、贴地面渲染过程
查看>>
Sql Server系列:存储过程
查看>>
Pointer 指针
查看>>
使用sqlyog将sql server 迁移到mysql
查看>>
lost connection to mysql server reading initial communication packet
查看>>
Eucalyptus安装包的功能列表
查看>>
mongodbOperator
查看>>