堆栈线程是 Java 中的线程类型之一。

huangapple go评论63阅读模式
英文:

What are Stack threads in Java?

问题

我看到在Cloud Foundry应用程序的Java Buildpack中,有一个App ENV选项可以配置“-stackThreads=250”来使用内存计算器。这些stackThreads是什么,它们的实际作用是什么?调整此值会如何影响应用程序?有些人在交流中将“stack thread”和“thread stack”这两个术语互换使用,是否如此?还是它们有所不同(尽管我理解线程栈的定义)。

cf set-env my-application JBP_CONFIG_OPEN_JDK_JRE '{ jre: { version: 11.+ }, memory_calculator: { stack_threads: 25 }}'

英文:

I see App ENV option to configure "-stackThreads=250 " by memory calculator in java buildpack for cloud foundry applications. what are these stackThreads and what it really do. how it affects app by changing this value. some people are using the word "stack thread" and "thread stack" interchangeably. is it so or different(though i understand the definition of thread stack)

cf set-env my-application JBP_CONFIG_OPEN_JDK_JRE '{ jre: { version: 11.+ }, memory_calculator: { stack_threads: 25 } }'

答案1

得分: 2

-stackThreads 是 Buildpack Memory Calculator 的一个参数,而不是 JVM 的参数。它表示在估算由于线程堆栈引起的内存使用量时将使用的并发线程数。线程堆栈(大致上)是分配给每个线程的堆栈内存量,由 -Xss 选项设置。一般来说,如果线程堆栈较大或者有更多线程在运行,总体内存使用量将会增加。

据我所知,JVM 本身并没有 -stackThreads 选项,因此在运行应用程序时在 JVM 上设置它将没有任何效果。实际上,这可能会被视为命令行中的错误。我认为在 Java 中甚至没有一个有意义的术语叫做 "stack thread"。

英文:

-stackThreads is an argument to the Buildpack Memory Calculator, not to the JVM. It's the number of concurrent threads that will be used when estimating the memory usage due to thread stacks. A thread stack is (broadly) the amount of memory allocated to the stack in each thread, as set by the -Xss option. In general, overall memory usage will be increased if the thread stack is larger, or if more threads are running.

So far as I know, the JVM itself does not have a -stackThreads option, so setting it on the JVM when running an application will have no effect. In fact, it will likely be treated as an error in the command line. I don't think "stack thread" is even a meaningful term in Java.

huangapple
  • 本文由 发表于 2020年10月7日 15:35:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/64239373.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定