Ignore:
Timestamp:
Sep 5, 2023, 5:48:31 PM (11 months ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
1f10959, efe39bb
Parents:
f54e6ec
Message:

edited thesis to incorporate Gregors comments

File:
1 edited

Legend:

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

    rf54e6ec raae9c17  
    3939Zero sized implies the communication is synchronous, \ie the producer must wait for the consumer to arrive or vice versa for a value to be communicated.
    4040\item
    41 Fixed sized (bounded) implies the communication is asynchronous, \ie the producer can proceed up to the buffer size and vice versa for the consumer with respect to removal.
     41Fixed sized (bounded) implies the communication is mostly asynchronous, \ie the producer can proceed up to the buffer size and vice versa for the consumer with respect to removal, at which point the producer/consumer would wait.
    4242\item
    4343Infinite sized (unbounded) implies the communication is asynchronous, \ie the producer never waits but the consumer waits when the buffer is empty.
     
    6666
    6767\section{Channel Implementation}\label{s:chan_impl}
    68 Currently, only the Go programming language provides user-level threading where the primary communication mechanism is channels.
    69 Experiments were conducted that varied the producer-consumer algorithm and lock type used inside the channel.
     68Currently, only the Go and Erlang programming languages provide user-level threading where the primary communication mechanism is channels.
     69Both Go and Erlang have user-level threading and preemptive scheduling, and both use channels for communication.
     70Go provides multiple homogeneous channels; each have a single associated type.
     71Erlang, which is closely related to actor systems, provides one heterogeneous channel per thread (mailbox) with a typed receive pattern.
     72Go encourages users to communicate via channels, but provides them as an optional language feature.
     73On the other hand, Erlang's single heterogeneous channel is a fundamental part of the threading system design; using it is unavoidable.
     74Similar to Go, \CFA's channels are offered as an optional language feature.
     75
     76While iterating on channel implementation, experiments were conducted that varied the producer-consumer algorithm and lock type used inside the channel.
    7077With the exception of non-\gls{fcfs} or non-\gls{fifo} algorithms, no algorithm or lock usage in the channel implementation was found to be consistently more performant that Go's choice of algorithm and lock implementation.
    7178Performance of channels can be improved by sharding the underlying buffer \cite{Dice11}.
     
    8289As a result, contention on the internal lock is decreased; only entering threads compete for the lock since unblocking threads do not reacquire the lock.
    8390The other advantage of Go's wait-morphing approach is that it eliminates the bottleneck of waiting for signalled threads to run.
    84 Note, the property of acquiring/releasing the lock only once can also be achieved with a different form of cooperation, called \Newterm{baton passing}.
     91Note that the property of acquiring/releasing the lock only once can also be achieved with a different form of cooperation, called \Newterm{baton passing}.
    8592Baton passing occurs when one thread acquires a lock but does not release it, and instead signals a thread inside the critical section, conceptually ``passing'' the mutual exclusion from the signalling thread to the signalled thread.
    8693The baton-passing approach has threads cooperate to pass mutual exclusion without additional lock acquires or releases;
     
    147154Thus, improperly handled \gls{toctou} issues with channels often result in deadlocks as threads performing the termination may end up unexpectedly blocking in their attempt to help other threads exit the system.
    148155
    149 \paragraph{Go channels} provide a set of tools to help with concurrent shutdown~\cite{go:chan} using a @close@ operation in conjunction with the \Go{select} statement.
     156Go channels provide a set of tools to help with concurrent shutdown~\cite{go:chan} using a @close@ operation in conjunction with the \Go{select} statement.
    150157The \Go{select} statement is discussed in \ref{s:waituntil}, where \CFA's @waituntil@ statement is compared with the Go \Go{select} statement.
    151158
     
    159166These design choices fit Go's paradigm of error management, where users are expected to explicitly check for errors, rather than letting errors occur and catching them.
    160167If errors need to occur in Go, return codes are used to pass error information up call levels.
    161 Note, panics in Go can be caught, but it is not the idiomatic way to write Go programs.
     168Note that panics in Go can be caught, but it is not the idiomatic way to write Go programs.
    162169
    163170While Go's channel-closing semantics are powerful enough to perform any concurrent termination needed by a program, their lack of ease of use leaves much to be desired.
     
    451458The results of the benchmark are shown in Figure~\ref{f:chanPerf}.
    452459The performance of Go and \CFA channels on this microbenchmark is comparable.
    453 Note, the performance should decline as the number of cores increases as the channel operations occur in a critical section, so increasing cores results in higher contention with no increase in parallelism.
     460Note that the performance should decline as the number of cores increases as the channel operations occur in a critical section, so increasing cores results in higher contention with no increase in parallelism.
     461
     462The performance of \CFA and Go's shutdown mechanisms is not measured, as shutdown is an exceptional case that does not occur frequently in most programs. Additionally, it is difficult to measure channel shutdown performance; threads need to be synchronized between each subsequent shutdown, which is likely more expensive than the shutdown mechanism itself.
    454463
    455464\begin{figure}
    456465        \centering
    457         \subfloat[AMD \CFA Channel Benchmark]{
     466        \subfloat[AMD Channel Benchmark]{
    458467                \resizebox{0.5\textwidth}{!}{\input{figures/nasus_Channel_Contention.pgf}}
    459468                \label{f:chanAMD}
    460469        }
    461         \subfloat[Intel \CFA Channel Benchmark]{
     470        \subfloat[Intel Channel Benchmark]{
    462471                \resizebox{0.5\textwidth}{!}{\input{figures/pyke_Channel_Contention.pgf}}
    463472                \label{f:chanIntel}
Note: See TracChangeset for help on using the changeset viewer.