-XX:+ StressLCM,-XX:+ StressGCM JVM的选项 [英] -XX:+StressLCM, -XX:+StressGCM Options for JVM

查看:138
本文介绍了-XX:+ StressLCM,-XX:+ StressGCM JVM的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在玩一些jcstress代码时,我注意到两个对我来说很新的参数:StressLCMStressGCM.

While playing with some jcstress code, I noticed two parameters that are very new to me: StressLCM and StressGCM.

对我来说,第一件事就是在源代码本身中搜索这些内容,尽管我发现了一些内容,但仍不清楚它们实际上是做什么的.我真的很希望在源代码中看到一些注释,但这些注释会带来一些启发,但是没有运气.

The very first thing to do for me was searching for these in the source code itself and while I have found some things, it is still unclear what they actually do. I was really hoping to see some comments in the source code that would shed some light, but no luck.

我还找到了错误说明,但是这些位置已添加解释对我来说毫无意义:

I also found the bug description where these have been added, but the explanation made no sense for me:

在LCM/GCM中随机化指令调度.

Randomize instruction scheduling in LCM/GCM.

如果可以的话,有人可以用简单的英语解释他们的工作吗?

Can someone explain what they do, if possible in plain english?

推荐答案

LCM/GCM代表本地代码运动/全局代码运动.为了优化CPU利用率,编译器可以在不更改代码语义的情况下重新排序独立的指令.编译器尝试找到最佳的指令(从性能角度来看).这就是所谓的指令调度,这就是LCM/GCM的作用.

LCM / GCM stands for Local Code Motion / Global Code Motion. To optimize CPU utilization, compiler may reorder independent instructions without changing the semantics of the code. Compiler tries to find the most optimal (from performance perspective) order of instructions. This is called instruction scheduling, and that's what LCM / GCM do.

通过-XX:+StressLCM/-XX:+StressGCM选项,指令调度的工作方式略有不同.它不再尝试查找最佳调度,而是在允许的约束范围内选择一个随机的指令顺序,而仍保持原始语义不变.这种不确定性行为有助于测试指令交织的更多组合,这对于发现细微的并发问题至关重要.

With -XX:+StressLCM / -XX:+StressGCM options the instruction scheduling works in a bit different way. It no longer tries to find the best schedule, but instead chooses a random instruction order within the allowed constraints, still keeping the original semantics unchanged. Such nondeterministic behavior helps to test more combinations of instruction interleaving, which is essential in finding subtle concurrency issues.

这篇关于-XX:+ StressLCM,-XX:+ StressGCM JVM的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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