[英]How Virtual Threads are mapped to Actual thread
As written, virtual threads are eventually mapped to actual threads.如前所述,虚拟线程最终会映射到实际线程。 Let's say there are 1 million virtual threads that are created.假设创建了 100 万个虚拟线程。 In a 8 core processor, I assume there will be 8 kernel threads.在 8 核处理器中,我假设将有 8 个 kernel 线程。 So, my questions are所以,我的问题是
Mapping of virtual threads and kernel threads is done by the thread model.虚拟线程和 kernel 线程的映射由线程 model 完成。 There are 3 kinds of thread models available有 3 种螺纹型号可供选择
Essentially, the thread library keeps a mapping between the user threads/ virtual threads to kernel threads.本质上,线程库保持用户线程/虚拟线程到 kernel 线程之间的映射。
Additionally, creating a kernel thread requires creating a complete thread control block so that kernel can manage those threads.此外,创建 kernel 线程需要创建完整的线程控制块,以便 kernel 可以管理这些线程。 This process is again slow.这个过程再次缓慢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.