简体   繁体   English

哪些现有CLR主机不提供托管和非托管线程之间的一对一映射?

[英]What existing CLR hosts do not provide one-to-one mapping between managed and unmanaged threads?

I know I should not rely upon that there is one-to-one mapping between managed and unmanaged threads . 我知道我应该依靠有托管和非托管线程之间的一个一对一的映射 From MSDN : 来自MSDN

An operating-system ThreadId has no fixed relationship to a managed thread, because an unmanaged host can control the relationship between managed and unmanaged threads. 操作系统ThreadId与托管线程没有固定的关系,因为非托管主机可以控制托管和非托管线程之间的关系。 Specifically, a sophisticated host can use the Fiber API to schedule many managed threads against the same operating system thread, or to move a managed thread among different operating system threads. 具体而言,复杂的主机可以使用Fiber API针对同一操作系统线程调度许多托管线程,或者在不同的操作系统线程之间移动托管线程。

In real life though, do such CLR hosts exist? 但在现实生活中,这样的CLR主机是否存在? (and if so, what are they?) I just answered a related question, and I wonder how practically bad my advice was for that particular case . (如果是的话,他们是什么?)我刚刚回答了一个相关的问题,我想知道我对这个具体案例的建议实际上是多么糟糕。

One would or could have been Microsoft SQL Server (starting with version 2005). 一个或许可能是Microsoft SQL Server(从2005版开始)。 IIRC that particular hosting support was even built into the CLR 2.0 upon their request (also see this blog post for more background), so that they could also support the CLR when using fibers (aka user mode scheduling) instead of threads in SQL Server. IIRC根据他们的要求甚至将特定的托管支持内置到CLR 2.0中(另请参阅此博客文章了解更多背景信息),以便他们在使用光纤(也就是用户模式调度)而不是SQL Server中的线程时也可以支持CLR。

However, that never really did work, it seems ( source ): 然而,这似乎从来没有真正起作用,似乎( 来源 ):

Common language runtime (CLR) execution is not supported under lightweight pooling. 轻量级池下不支持公共语言运行时(CLR)执行。 Disable one of two options: "clr enabled" or "lightweight pooling. 禁用以下两个选项之一:“clr enabled”或“轻量级池”。

I would consider it rather safe to assume that there are no (production ready) hosts out there, that don't map CLR threads to host threads 1:1. 我认为相当安全的假设没有(生产就绪)主机,没有将CLR线程映射到主机线程1:1。

There are a couple of Q&A around SO that seem to suggest the same. 有几个关于SO的问答似乎表明相同。

For example, 例如,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM