HOSTING THE RUNTIME: SQL SERVER AS A RUNTIME HOST Windows Operating System SQLSVR.EXE SQL Server IHostControl ICLRRuntimeHost GetHostManager() SetHostControl() MSCOREE.DLL Common Language Runtime 1 2 1 2 SQL Server passes IHostControl to CLR via SetHostControl CLR delegates thread management, etc. to SQL Server via GetHostManager Figure 2-1: Hosting the CLR SQL Server is a specialized host like ASP.NET and IE, rather than a simple bootstrap mechanism. The runtime is lazy loaded; if you never use a managed stored procedure or user-defined type, the runtime is never loaded. This is useful because loading the runtime takes a one-time memory allocation of approximately 10 15MB in addition to SQL Server s buffers and unmanaged executable code, although this certainly will not be the exact number in SQL Server 2005. How SQL Server manages its resources and locates the code to load is unique as well. To accommodate hosts that want to have hooks into the CLR s resource allocation and management, .NET 2.0 hosts can use ICLRRuntimeHost instead of ICorRuntimeHost. The host can then call ICLRRuntimeHost:: SetHostControl, which takes a pointer to an interface (IHostControl) that contains a method that the CLR can call (GetHostManager) to delegate things like thread management to the host. SQL Server uses this interface to take control of some functions that the CLR usually calls down to the operating system for directly. Figure 2-1 shows how SQL Server 2005 hosts the CLR. Resource Management SQL Server manages its own thread scheduling, synchronization and locking, and memory allocation. In .NET runtime hosts, these are usually managed by the CLR itself. In SQL Server 2005 this conflict is resolved by

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost JSP Web Hosting services

Bookmark the permalink.

Comments are closed.