JVM 线程与 tomcat 线程有何不同,它们是否有一个映射到内核线程的公共池
how different is JVM thread from tomcat threads and do they have a common pool which maps to kernel threads
我试图弄清楚当我 运行 一个 spring 启动应用程序时线程如何作为一个整体工作,线程调度如何在每个级别工作直到代码在处理器中执行。每个级别对线程池数量的限制是什么。
从头开始,
较新版本的intel处理器支持超线程,因此可以并行执行的线程数是核心数的两倍。但是对可以 运行 并发的内核线程数的限制是什么?我的意思是等待队列的限制是多少。
JVM线程和tomcat线程映射到内核线程以便执行。是否有一些通用的线程池可以从中创建 JVM 线程和 tomcat 线程?如果是这样,对此有何限制。
JVM是否为了管理它的threadPool而进行线程调度
请参考一篇文章或一本书,可以帮助我理解。
Tomcat 线程没有什么特别之处:它们与 JVM 中的所有其他线程相同。在大多数现代 OS 和 JVM 中,一个 JVM 线程直接映射到一个 OS 线程(当然,可以根据 OS 实现不同的线程)。
Newer version of intel processor supports hyper-threading so the no of threads that can execute parallelly is twice the no of core. but what is the restriction on no of kernel threads that can run concurrently? i mean what is the limit on wait queue.
AFAIK 等待队列没有限制。
JVM threads and tomcat threads are mapped to kernel threads in order to execute. Is there some common threadPool from which JVM threads and tomcat threads are created? if so what is the restriction on this.
任何 Java 程序都可以启动任意数量的线程(除非它在 SecurityManager 下 运行ning)。由于您使用的是 Spring Boot,我假设没有 SM 在起作用。如果您 运行(香草)Tomcat 在 SM 下,Tomcat 运行 本身就是游戏中的无限制玩家,并且只有 Web 应用程序被有效沙盒化。以上任何一种情况,Tomcat都不受约束。
但是,Tomcat 会遵守给定的配置。如果你说你想要一个最大大小为 100 的线程池,那么 Tomcat 将不会启动任何超过 100 个线程来服务请求。 (Tomcat 运行 后台有一些线程用于内务处理任务,但数量非常少。Tomcat 创建的大部分线程将用于 request-processing。)
每个 <Connector>
默认情况下都有自己的线程池。您可以将所有 <Connector>
配置为使用共享线程池。这些线程池可以根据最大连接数等进行控制。有关详细信息,请参阅 Tomcat User's Guide's section on Connectors and the Tomcat Configuration Reference 关于连接器的部分。
Does JVM do thread scheduling in order to manage its threadPool.
JVM 通常将此委托给 OS。
please refer an article or a book, which can help me understand.
如果你想要所有的细节,总有The Java Language Specification。
编辑 2019-07-22
从 Java 个线程到 OS 个线程的映射完全由 JVM 处理。 Tomcat 对它没有任何影响。因此,Java-thread 概念下的所有内容都必须在使用中的确切 JVM、使用中的确切 OS 以及它们如何协同工作以最终执行代码的上下文中进行研究。我在这里想说的是,如果没有大量额外信息,你的问题无法回答。
我试图弄清楚当我 运行 一个 spring 启动应用程序时线程如何作为一个整体工作,线程调度如何在每个级别工作直到代码在处理器中执行。每个级别对线程池数量的限制是什么。
从头开始,
较新版本的intel处理器支持超线程,因此可以并行执行的线程数是核心数的两倍。但是对可以 运行 并发的内核线程数的限制是什么?我的意思是等待队列的限制是多少。
JVM线程和tomcat线程映射到内核线程以便执行。是否有一些通用的线程池可以从中创建 JVM 线程和 tomcat 线程?如果是这样,对此有何限制。
JVM是否为了管理它的threadPool而进行线程调度
请参考一篇文章或一本书,可以帮助我理解。
Tomcat 线程没有什么特别之处:它们与 JVM 中的所有其他线程相同。在大多数现代 OS 和 JVM 中,一个 JVM 线程直接映射到一个 OS 线程(当然,可以根据 OS 实现不同的线程)。
Newer version of intel processor supports hyper-threading so the no of threads that can execute parallelly is twice the no of core. but what is the restriction on no of kernel threads that can run concurrently? i mean what is the limit on wait queue.
AFAIK 等待队列没有限制。
JVM threads and tomcat threads are mapped to kernel threads in order to execute. Is there some common threadPool from which JVM threads and tomcat threads are created? if so what is the restriction on this.
任何 Java 程序都可以启动任意数量的线程(除非它在 SecurityManager 下 运行ning)。由于您使用的是 Spring Boot,我假设没有 SM 在起作用。如果您 运行(香草)Tomcat 在 SM 下,Tomcat 运行 本身就是游戏中的无限制玩家,并且只有 Web 应用程序被有效沙盒化。以上任何一种情况,Tomcat都不受约束。
但是,Tomcat 会遵守给定的配置。如果你说你想要一个最大大小为 100 的线程池,那么 Tomcat 将不会启动任何超过 100 个线程来服务请求。 (Tomcat 运行 后台有一些线程用于内务处理任务,但数量非常少。Tomcat 创建的大部分线程将用于 request-processing。)
每个 <Connector>
默认情况下都有自己的线程池。您可以将所有 <Connector>
配置为使用共享线程池。这些线程池可以根据最大连接数等进行控制。有关详细信息,请参阅 Tomcat User's Guide's section on Connectors and the Tomcat Configuration Reference 关于连接器的部分。
Does JVM do thread scheduling in order to manage its threadPool.
JVM 通常将此委托给 OS。
please refer an article or a book, which can help me understand.
如果你想要所有的细节,总有The Java Language Specification。
编辑 2019-07-22
从 Java 个线程到 OS 个线程的映射完全由 JVM 处理。 Tomcat 对它没有任何影响。因此,Java-thread 概念下的所有内容都必须在使用中的确切 JVM、使用中的确切 OS 以及它们如何协同工作以最终执行代码的上下文中进行研究。我在这里想说的是,如果没有大量额外信息,你的问题无法回答。