Changeset 9921573


Ignore:
Timestamp:
Apr 11, 2023, 10:47:15 AM (20 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
6611177
Parents:
e59a9fa
Message:

update channel chapter intro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/colby_parsons_MMAth/text/channels.tex

    re59a9fa r9921573  
    55% ======================================================================
    66
    7 Channels were first introduced by Hoare in his paper Communicating Sequentual Processes~\cite{Hoare78}, where he proposes a concurrent language that communicates across processes using input/output channels to send data.
    8 Channels are a concurrent language feature used to perform message passing concurrency, a model of concurrency where threads communicate by sending data as messages, and synchronizing via the message passing mechanism.
    9 This is an alternative to shared memory concurrency, where threads can communicate directly by changing shared memory state.
    10 Most modern concurrent programming languages do not subscribe to just one style of communication between threads, and provide features that support both.
     7Channels are a concurrent-language feature used to perform \Newterm{message-passing concurrency}: a model of concurrency where threads communicate by sending (mostly nonblocking) data as messages and synchronizing by receiving (blocking) sent data.
     8This model is an alternative to shared-memory concurrency, where threads can communicate directly by changing shared state.
     9Most modern concurrent programming languages do not subscribe to just one style of communication among threads and provide features that support multiple approaches.
     10
     11Channels were first introduced by Kahn~\cite{Kahn74} and extended by Hoare~\cite{Hoare78} (CSP).
     12Both papers present a pseudo (unimplemented) concurrent language where processes communicate using input/output channels to send data.
     13Both languages are highly restrictive.
     14Kahn's language restricts a reading process to only wait for data on a single channel at a time and different writing processes cannot send data on the same channel.
     15Hoare's language restricts ...
    1116Channels as a programming language feature has been popularized in recent years due to the language Go, which encourages the use of channels as its fundamental concurrent feature.
     17Go's restrictions are ...
     18\CFA channels do not have these restrictions.
    1219
    1320\section{Producer-Consumer Problem}
     
    4047
    4148\begin{itemize}
    42 \item Toggle-able statistic collection on channel behvaiour that counts channel operations, and the number of the operations that block.
     49\item Toggle-able statistic collection on channel behaviour that counts channel operations, and the number of the operations that block.
    4350Tracking blocking operations helps users tune their channel size or channel usage when the channel is used for buffering, where the aim is to have as few blocking operations as possible.
    4451\item Deadlock detection on deallocation of the channel.
     
    4653\item A \code{flush} routine that delivers copies of an element to all waiting consumers, flushing the buffer.
    4754Programmers can use this to easily to broadcast data to multiple consumers.
    48 Additionally, the \code{flush} routine is more performant then looping around the \code{insert} operation since it can deliver the elements without having to reaquire mutual exclusion for each element sent.
     55Additionally, the \code{flush} routine is more performant then looping around the \code{insert} operation since it can deliver the elements without having to reacquire mutual exclusion for each element sent.
    4956\end{itemize}
    5057
     
    107114To highlight the differences between \CFA's and Go's close semantics, an example program is presented.
    108115The program is a barrier implemented using two channels shown in Listings~\ref{l:cfa_chan_bar} and \ref{l:go_chan_bar}.
    109 Both of these exaples are implmented using \CFA syntax so that they can be easily compared.
     116Both of these examples are implemented using \CFA syntax so that they can be easily compared.
    110117Listing~\ref{l:go_chan_bar} uses go-style channel close semantics and Listing~\ref{l:cfa_chan_bar} uses \CFA close semantics.
    111118In this problem it is infeasible to use the Go \code{close} call since all tasks are both potentially producers and consumers, causing panics on close to be unavoidable.
     
    118125Also note that in the Go version~\ref{l:go_chan_bar}, the size of the barrier channels has to be larger than in the \CFA version to ensure that the main thread does not block when attempting to clear the barrier.
    119126
    120 \begin{cfa}[tabsize=3,caption={\CFA channel barrier termination},label={l:cfa_chan_bar}]
     127\begin{cfa}[caption={\CFA channel barrier termination},label={l:cfa_chan_bar}]
    121128struct barrier {
    122129        channel( int ) barWait;
     
    173180\end{cfa}
    174181
    175 \begin{cfa}[tabsize=3,caption={Go channel barrier termination},label={l:go_chan_bar}]
     182\begin{cfa}[caption={Go channel barrier termination},label={l:go_chan_bar}]
    176183
    177184struct barrier {
     
    244251If the same program was implemented in Go it would require explicit synchronization with both producers and consumers by some mechanism outside the channel to ensure that all elements were removed before task termination.
    245252
    246 \begin{cfa}[tabsize=3,caption={\CFA channel resumption usage},label={l:cfa_resume}]
     253\begin{cfa}[caption={\CFA channel resumption usage},label={l:cfa_resume}]
    247254channel( int ) chan{ 128 };
    248255
     
    287294One microbenchmark is conducted to compare Go and \CFA.
    288295The benchmark is a ten second experiment where producers and consumers operate on a channel in parallel and throughput is measured.
    289 The number of cores is varied to measure how throughtput scales.
     296The number of cores is varied to measure how throughput scales.
    290297The cores are divided equally between producers and consumers, with one producer or consumer owning each core.
    291298The results of the benchmark are shown in Figure~\ref{f:chanPerf}.
Note: See TracChangeset for help on using the changeset viewer.