# Changeset 64b272a for doc/proposals

Ignore:
Timestamp:
Nov 2, 2017, 3:47:57 PM (5 years ago)
Branches:
aaron-thesis, arm-eh, 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:
e706bfd
Parents:
bd7f401
Message:

Prereview commit

Location:
doc/proposals/concurrency
Files:
10 edited

Unmodified
Removed
• ## doc/proposals/concurrency/.gitignore

 rbd7f401 build/*.out build/*.ps build/*.pstex build/*.pstex_t build/*.tex build/*.toc
• ## doc/proposals/concurrency/Makefile

 rbd7f401 annex/glossary \ text/intro \ text/basics \ text/cforall \ text/basics \ text/concurrency \ text/internals \ text/parallelism \ text/results \ text/together \ text/future \ }} PICTURES = ${addsuffix .pstex, \ } PICTURES =${addprefix build/, ${addsuffix .pstex, \ system \ }} PROGRAMS =${addsuffix .tex, \ build/*.out     \ build/*.ps      \ build/*.pstex   \ build/*.pstex_t \ build/*.tex     \
• ## doc/proposals/concurrency/text/cforall.tex

 rbd7f401 % ====================================================================== % ====================================================================== \chapter{Cforall crash course} \chapter{Cforall Overview} % ====================================================================== % ====================================================================== This thesis presents the design for a set of concurrency features in \CFA. Since it is a new dialect of C, the following is a quick introduction to the language, specifically tailored to the features needed to support concurrency. The following is a quick introduction to the \CFA language, specifically tailored to the features needed to support concurrency. \CFA is a extension of ISO-C and therefore supports all of the same paradigms as C. It is a non-object oriented system language, meaning most of the major abstractions have either no runtime overhead or can be opt-out easily. Like C, the basics of \CFA revolve around structures and routines, which are thin abstractions over machine code. The vast majority of the code produced by the \CFA translator respects memory-layouts and calling-conventions laid out by C. Interestingly, while \CFA is not an object-oriented language, lacking the concept of a received (e.g.: this), it does have some notion of objects\footnote{C defines the term objects as : [Where to I get the C11 reference manual?]}, most importantly construction and destruction of objects. Most of the following pieces of code can be found on the \CFA website \cite{www-cfa} \CFA is a extension of ISO-C and therefore supports all of the same paradigms as C. It is a non-object oriented system language, meaning most of the major abstractions have either no runtime overhead or can be opt-out easily. Like C, the basics of \CFA revolve around structures and routines, which are thin abstractions over machine code. The vast majority of the code produced by the \CFA translator respects memory-layouts and calling-conventions laid out by C. Interestingly, while \CFA is not an object-oriented language, lacking the concept of a receiver (e.g., this), it does have some notion of objects\footnote{C defines the term objects as : [Where to I get the C11 reference manual?]}, most importantly construction and destruction of objects. Most of the following code examples can be found on the \CFA website \cite{www-cfa} \section{References}
• ## doc/proposals/concurrency/text/concurrency.tex

 rbd7f401 % ====================================================================== % ====================================================================== \section{Internal scheduling} \label{insched} \section{Internal scheduling} \label{intsched} % ====================================================================== % ====================================================================== \label{lst:waitfor2} \end{figure} % ====================================================================== % ====================================================================== \subsection{Waiting for the destructor} % ====================================================================== % ====================================================================== An important exception for the \code{waitfor} statement is destructor semantics. Indeed, the \code{waitfor} statement can accept any \code{mutex} routine, which counts the destructor. However, with the semantics discussed until now, waiting for the destructor does not make any sense since using an object after its destructor is called is undefined behaviour. The simplest approach to fix this hole in the semantics would be disallowing \code{waitfor} on destructor. However, a more expressive approach is to flip ordering of execution when waiting for the destructor, meaning that waiting for the destructor allows the destructor to run after the current \code{mutex} routine, similarly to how a condition is signalled. \begin{figure} \begin{cfacode} monitor Executer {}; struct  Action; void ^?{}   (Executer & mutex this); void execute(Executer & mutex this, const Action & ); void run    (Executer & mutex this) { while(true) { waitfor(execute, this); or waitfor(^?{}   , this) { break; } } } \end{cfacode} \caption{Example of an executor which executes action in series until the destructor is called.} \label{lst:dtor-order} \end{figure} For example, listing \ref{lst:dtor-order} shows an example of an executor with an infinite loop, which waits for the destructor to break out of this loop.