Difference between revisions of "Thread"

From Organic Design wiki
m
Line 8: Line 8:
  
 
= Nodal =
 
= Nodal =
In the [[nodal model]], the multithreading time-slicing is achieved by [[w:Time-division multiplexing|Time-division multiplexing]] using the [[nodal reduction]] algorithm. [[Loop]]s are threads are formed from [[nodeNEXT|next]] and [[nodePREV|prev]] [[association]]s and a [[focus]] association allows the formation of trees of loops and threads.
+
In the [[nodal model]], the multithreading time-slicing is achieved by [[w:Time-division multiplexing|time-division multiplexing]] using the [[nodal reduction]] algorithm. [[Loop]]s and threads are formed from [[nodeNEXT|next]] and [[nodePREV|prev]] [[association]]s 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. Alternatively a context could update its own [[loop]] content dynamically.

Revision as of 02:09, 11 December 2006

General

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.

Nodal

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 next and prev 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. Alternatively a context could update its own loop content dynamically.