BT

CLR Hosting and Fibers

by Jonathan Allen on Nov 15, 2006 |

The CLR can be hosted in a wide variety of environments. Out of the box these include Internet Explorer, IIS, and SQL Server 2005, and developers are free to create their own. Unfortunately, one thing they don't support is fibers.

Developers can create their own CLR host  following Steven Pratschner's directions in MSDN Magazine. This requires knowledge of C++ as well as the .NET framework. The advantage of hosting your own CLR is that you get unparalleled control over the code isolation and security, and even some control over the GC and threading models.

One advantage of the CLR is that it decouples managed threads from the underlying OS threads. This means a managed thread can skip from thread to thread, or if the host supports it, from fiber to fiber. Regretfully, large portions of the WIN32 require thread affinity. Since fibers themselves can jump from thread to thread, tracking thread affinity becomes quite difficult. Even worse, a large portion of the BCL does not even try to account for this.

The end result, according to Joe Duffy, is that fibers are too unstable to be safely implemented at this time. While applications using fibers may appear to work, long-running hosts like SQL Server being these subtle thread-affinity errors to light.

 

 

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Common thoughs about fibers? by Michael Nemtsev

Heh, 2 days before your post I've written about CLR and fibler in my blog laflour.spaces.live.com/blog/cns!7575E2FFC19135...

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT