Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
536 views
in Technique[技术] by (71.8m points)

c# - 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:

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. 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.

In real life though, do such CLR hosts exist? (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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

One would or could have been Microsoft SQL Server (starting with version 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.

However, that never really did work, it seems (source):

Common language runtime (CLR) execution is not supported under lightweight pooling. Disable one of two options: "clr enabled" or "lightweight pooling.

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.

There are a couple of Q&A around SO that seem to suggest the same.

For example,


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...