clr 线程模型信息?
我想知道 System.Threading.Thread
在 CLR 中是如何工作的。我猜想 CLR 中的线程是“轻量级”的,这意味着它们被多对一地映射到内核线程……但是谁来调度这些线程呢?当我创建一个线程时,它是否总是创建一个相应的“内核”线程,除非线程数大于物理核心数?它是否尝试在可用内核上调度这些线程?非常感谢任何信息/来源。
I would like to know how System.Threading.Thread
works in the CLR. I guess threads in the CLR are "lightweight", meaning they are mapped many-to-one to kernel threads... but who schedules these threads? When I create a thread, does it always create a corresponding "kernel" thread unless number of threads is larger than the number of physical cores? Does it try to schedule these threads on the available cores? Any info/sources are greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你可以检查 SSCLI。它是 C++ 又名 ROTOR 项目中的 CLR 2.0 公开可用源。这是唯一能揭示真相的地方:)
UPD:如果有人感兴趣,在评论中可以找到在 ROTOR 中找到实际东西的线索;)
You could check SSCLI. It is CLR 2.0 publicly available sources in C++ aka ROTOR project. It is the only place that will reveal the truth :)
UPD: in comments there're clues where to find actual thing in the ROTOR if someone is interested ;)
MSDN:
MSDN:
对此没有“最终答案/文档”...
在这种情况下,您通常需要检查源(如果有) - 或者使用诸如 Reflector 之类的东西来获取源...这可能是压倒性的数量-明智的,但肯定会给你你寻求的答案......
there is no "ultimate answer/documentation" to that...
in such cases you usually need to resort to checking the source if available - alternatively use something like Reflector to get to the source... this can be overwhelming quantity-wise but will give you certainly the answers you seek...