Channel (programming)
Encyclopedia
A Channel is a construct used in interprocess communication to represent some binding between concurrent processes. An object may be sent over a channel, and a process is able to receive any objects sent over a channel it has a reference
to. They are similar to pipeline
s, but may contain arbitrary unserialised objects instead of lines of text, and are used within a single program for coordination, rather than across several programs. They are inherently synchronous
: a process waiting to receive an object from a channel will block until the object is sent. However, if they are used in a single-threaded
or cooperatively scheduling system, they also resemble event-based programming models.
Channels first originated in communicating sequential processes
(CSP), a formal model for concurrency. The Limbo programming language
uses channels as the primary way of communicating between processes, inherited from CSP via Newsqueak
and the Alef programming language. They are also used in the C programming language threading library libthread, and in Plan 9 From Bell Labs
, which uses libthread, as well as in Stackless Python
and the Go programming language.
Reference (computer science)
In computer science, a reference is a value that enables a program to indirectly access a particular data item, such as a variable or a record, in the computer's memory or in some other storage device. The reference is said to refer to the data item, and accessing those data is called...
to. They are similar to pipeline
Pipeline (software)
In software engineering, a pipeline consists of a chain of processing elements , arranged so that the output of each element is the input of the next. Usually some amount of buffering is provided between consecutive elements...
s, but may contain arbitrary unserialised objects instead of lines of text, and are used within a single program for coordination, rather than across several programs. They are inherently synchronous
Synchronization (computer science)
In computer science, synchronization refers to one of two distinct but related concepts: synchronization of processes, and synchronization of data. Process synchronization refers to the idea that multiple processes are to join up or handshake at a certain point, so as to reach an agreement or...
: a process waiting to receive an object from a channel will block until the object is sent. However, if they are used in a single-threaded
Thread (computer science)
In computer science, a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process...
or cooperatively scheduling system, they also resemble event-based programming models.
Channels first originated in communicating sequential processes
Communicating sequential processes
In computer science, Communicating Sequential Processes is a formal language for describing patterns of interaction in concurrent systems. It is a member of the family of mathematical theories of concurrency known as process algebras, or process calculi...
(CSP), a formal model for concurrency. The Limbo programming language
Limbo programming language
Limbo is a programming language for writing distributed systems and is the language used to write applications for the Inferno operating system...
uses channels as the primary way of communicating between processes, inherited from CSP via Newsqueak
Newsqueak
Newsqueak is a concurrent programming language for writing application software for windowing systems. It was designed at Bell Labs by Rob Pike in the late 1980s....
and the Alef programming language. They are also used in the C programming language threading library libthread, and in Plan 9 From Bell Labs
Plan 9 from Bell Labs
Plan 9 from Bell Labs is a distributed operating system. It was developed primarily for research purposes as the successor to Unix by the Computing Sciences Research Center at Bell Labs between the mid-1980s and 2002...
, which uses libthread, as well as in Stackless Python
Stackless Python
Stackless Python, or Stackless, is a Python programming language interpreter, so named because it avoids depending on the C call stack for its own stack. The most prominent feature of Stackless is microthreads, which avoid much of the overhead associated with usual operating system threads...
and the Go programming language.