Thread

From Organic Design
Jump to: navigation, search
Glossary.svg This page describes a concept which is part of our glossary
Threads of execution are a way for a program to split itself into two or more simultaneously (or pseudo-simultaneously) running tasks. Threads and processes differ from one operating system to another, but in general, the way that a thread is created and shares its resources is different from the way a process does.

Multiple threads can be executed in parallel on many computer systems. This multithreading generally occurs by time slicing, wherein a single processor switches between different threads, in which case the processing is not literally simultaneous, for the single processor is only really doing one thing at a time. This switching can happen so fast as to give the illusion of simultaneity to an end user. For instance, a typical PC today contains only one processor core, but you can run multiple programs at once, such as a word processor alongside an audio playback program; though the user experiences these things as simultaneous, in truth, the processor is quickly switching back and forth between these separate processes. On a multiprocessor or multi-core system, threading can be achieved via multiprocessing, wherein different threads and processes can run literally simultaneously on different processors or cores.

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

In the Nodal Model

In the nodal model, the multithreading time-slicing is achieved by time-division multiplexing using the nodal reduction algorithm. Loops and threads are formed from Right and Left associations and a focus association allows the formation of trees of loops and threads.

A thread is just a loop which ends with a next association linking to root. This has the effect of the thread automatically unhooking from its context after completion because any node with a focus of root is considered to have no focus because every quanta sent to root is a new quanta. Alternatively a context could update its own loop content dynamically.

If a thread has static structure, then it can appear in many contexts simaltaneously, it's parent association will be dynamically maintained by the nodal reduction algorithm.

See also