Ignore:
Timestamp:
Nov 28, 2017, 3:52:01 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
6c2ba38
Parents:
f7a4f89
Message:

Results need to be updated but otherwise, tentative final draft

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/proposals/concurrency/text/together.tex

    rf7a4f89 rcf966b5  
    77
    88\section{Threads as monitors}
    9 As it was subtly alluded in section \ref{threads}, \code{threads} in \CFA are in fact monitors, which means that all monitor features are available when using threads. For example, here is a very simple two thread pipeline that could be used for a simulator of a game engine :
    10 \begin{cfacode}
     9As it was subtly alluded in section \ref{threads}, \code{thread}s in \CFA are in fact monitors, which means that all monitor features are available when using threads. For example, here is a very simple two thread pipeline that could be used for a simulator of a game engine :
     10\begin{figure}[H]
     11\begin{cfacode}[caption={Toy simulator using \code{thread}s and \code{monitor}s.},label={lst:engine-v1}]
    1112// Visualization declaration
    1213thread Renderer {} renderer;
     
    3637}
    3738\end{cfacode}
     39\end{figure}
    3840One of the obvious complaints of the previous code snippet (other than its toy-like simplicity) is that it does not handle exit conditions and just goes on forever. Luckily, the monitor semantics can also be used to clearly enforce a shutdown order in a concise manner :
    39 \begin{cfacode}
     41\begin{figure}[H]
     42\begin{cfacode}[caption={Same toy simulator with proper termination condition.},label={lst:engine-v2}]
    4043// Visualization declaration
    4144thread Renderer {} renderer;
     
    7679// Call destructor for renderer to signify shutdown
    7780\end{cfacode}
     81\end{figure}
    7882
    7983\section{Fibers \& Threads}
     
    8488}
    8589\end{cfacode}
    86 This function is called by the kernel to fetch the default preemption rate, where 0 signifies an infinite time-slice i.e. no preemption. However, once clusters are fully implemented, it will be possible to create fibers and uthreads in on the same system :
     90This function is called by the kernel to fetch the default preemption rate, where 0 signifies an infinite time-slice, i.e., no preemption. However, once clusters are fully implemented, it will be possible to create fibers and \glspl{uthread} in the same system, as in listing \ref{lst:fiber-uthread}
    8791\begin{figure}
    88 \begin{cfacode}
     92\begin{cfacode}[caption={Using fibers and \glspl{uthread} side-by-side in \CFA},label={lst:fiber-uthread}]
    8993//Cluster forward declaration
    9094struct cluster;
Note: See TracChangeset for help on using the changeset viewer.