Partilhar via


Thread and Task Architecture

Threads are an operating system feature that lets application logic be separated into several concurrent execution paths. This feature is useful when complex applications have many tasks that can be performed at the same time.

When an operating system executes an instance of an application, it creates a unit called a process to manage the instance. The process has a thread of execution. This is the series of programming instructions performed by the application code. For example, if a simple application has a single set of instructions that can be performed serially, there is just one execution path or thread through the application. More complex applications may have several tasks that can be performed in tandem, instead of serially. The application can do this by starting separate processes for each task. However, starting a process is a resource-intensive operation. Instead, an application can start separate threads. These are relatively less resource-intensive. Additionally, each thread can be scheduled for execution independently from the other threads associated with a process.

Threads allow complex applications to make more effective use of a CPU, even on computers that have a single CPU. With one CPU, only one thread can execute at a time. If one thread executes a long-running operation that does not use the CPU, such as a disk read or write, another one of the threads can execute until the first operation is completed. By being able to execute threads while other threads are waiting for an operation to be completed, an application can maximize its use of the CPU. This is especially true for multi-user, disk I/O intensive applications such as a database server. Computers that have multiple microprocessors or CPUs can execute one thread per CPU at the same time. For example, if a computer has eight CPUs, it can execute eight threads at the same time.

In This Section

Topic Description

SQL Server Batch or Task Scheduling

Describes how threads or fibers are scheduled for batches or tasks.

Allocating Threads to a CPU

Describes how the operating system distributes threads from instances of SQL Server evenly among the microprocessors on a computer. Also describes the affinity mask configuration option.

Using the lightweight pooling Option

Describes the conditions under which turning the lightweight pooling option on may be helpful.

Understanding Non-uniform Memory Access

Describes the changes made in SQL Server 2005 to support the non-uniform memory access (NUMA) architecture.

Thread and Fiber Execution

Describes how threads or fibers are executed and describes the option used to set execution priority.

See Also

Concepts

Relational Database Engine Architecture

Help and Information

Getting SQL Server 2005 Assistance