Channel (programming)

From Wikipedia, the free encyclopedia

Channels are a tool used for interprocess communication. An object may 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 pipelines, 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.

[edit] References