Tuesday, June 1, 2010

SQLOS : A User-mode Operating System for SQL Server

    The SQLOS is core to SQL Server's architecture, and first implemented in SQL Server 2005. It is a framework used by components in SQL Server for scheduling, I/O, and memory management. Because of the highly specialized requirements of SQL Server, it implements its own thread and memory management system. It is used for low-level operations such as scheduling, I/O completion, memory management, buffer pool management, resource management, synchronization primitives and deadlock detection. In summary, the SQLOS is a thin user-mode layer that sits between SQL Server and Windows.
    SQLOS also recognizes and accommodates NUMA (non-uniform memory access) architectures, to handle the systems which scale above 32 cores. In database, scheduled query run must be complete before starting the next one. SQLOS manages that with its schedulers: each logical CPU (one care in multi-core chip) has a non-preemptive scheduler in SQLOS that assigns one thread at a time to the CPU. SQLOS schedulers are hyper-threading aware, and can move a task from a hyper-threaded CPU to a "real" CPU that becomes idle.
The benefits of SQLOS include 
  • performance (primary goal)
  • enhanced scheduling and processor locality 
  • a dedicated administrative connection
  • support for hot adding of memory and CPU resources
  • a hosting interface for services such as CLR and SQL Server 2008 Reporting Services

    Reporting Services are runs under SQLOS rather than IIS, to handle large report request in a reasonable way. IIS is not designed to service long-running requests like database reports. Only Microsoft SQL Server can benefit from SQLOS. It is a tightly coupled, private layer of SQL Server. Even an extended stored procedure (a function in a DLL that SQL Sever launches) get called, it is thrown on the mercy of the Windows scheduler rather than receiving the benefit of SQLOS's non-preemptive scheduler.

    SQLOS is not a way to port the SQL Server architecture to other platforms like Linux or Mac OS so it's not an OS abstraction layer. It doesn't wrap all the OS APIs like other frameworks such as .NET, which is why it's referred to as a "thin" user-mode layer.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.