Thread (computing)

Thread (computing)

In computer science, a thread of execution is the smallest sequence of programmed instructions that can be managed independently by an operating system scheduler. A thread is a light-weight process. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process. Multiple threads can exist within the same process and share resources such as memory, while different processes do not share these resources. In particular, the threads of a process share the latter's instructions (its code) and its context (the values that its variables reference at any given moment).

On a single processor, multithreading generally occurs by time-division multiplexing (as in multitasking): the processor switches between different threads. This context switching generally happens frequently enough that the user perceives the threads or tasks as running at the same time. On a multiprocessor (including multi-core system), the threads or tasks will actually run at the same time, with each processor or core running a particular thread or task.

Many modern operating systems directly support both time-sliced and multiprocessor threading with a process scheduler. The kernel of an operating system allows programmers to manipulate threads via the system call interface. Some implementations are called a kernel thread, whereas a lightweight process (LWP) is a specific type of kernel thread that shares the same state and information.

Programs can have user-space threads when threading with timers, signals, or other methods to interrupt their own execution, performing a sort of ad-hoc time-slicing.

Read more about Thread (computing):  How Threads Differ From Processes, Multithreading, Processes, Kernel Threads, User Threads, and Fibers, Programming Language Support

Famous quotes containing the word thread:

    I taught school in the early days of my manhood and I think I know something about mothers. There is a thread of aspiration that runs strong in them. It is the fiber that has formed the most unselfish creatures who inhabit this earth. They want three things only; for their children to be fed, to be healthy, and to make the most of themselves.
    Lyndon Baines Johnson (1908–1973)