Monday, September 29, 2008

SQLOS

SQLOS is the base module in the SQL Server architecture. It implements functions normally linked with the Operating System: thread preparation, memory management, I/O management, buffer pool management, resource management, synchronization primitives and locking, and deadlock discovery. Because the requirements of SQL Server are highly dedicated, it equipment its own memory and thread management system, rather than using the generic one implement in the operating system. It divides all the operations it performs into a series of Tasks - both background preservation jobs as well as processing requests from clients. Internally, a pool of employee threads is maintained, onto which the tasks are listed. A task is associated with the thread until it is finished; only after its completion is the thread freed and returns to the pool. If there are no free threads to allocate the task to, the task is temporarily blocked. Each worker thread is map onto either an Operating System thread or a fiber. Fibers are user mode threads that implement co-operative multitasking. Using fibers means SQLOS does all the secretarial of thread organization itself, but then it can optimize them for its particular use. SQLOS also includes synchronization primitives for locking as well as monitoring for the employee threads to detect and recover from deadlocks.

No comments: