Changes in / [281806b6:4ab3d68e]
- Location:
- doc
- Files:
-
- 6 added
- 5 deleted
- 18 edited
-
bibliography/cfa.bib (added)
-
bibliography/pl.bib (deleted)
-
papers/OOPSLA17/.gitignore (modified) (1 diff)
-
papers/OOPSLA17/Makefile (modified) (3 diffs)
-
papers/OOPSLA17/evaluation/timing.gp (modified) (1 diff)
-
papers/OOPSLA17/generic_types.tex (modified) (1 diff)
-
papers/concurrency/.gitignore (modified) (1 diff)
-
papers/concurrency/Makefile (modified) (3 diffs)
-
papers/concurrency/Paper.tex (modified) (21 diffs)
-
papers/general/.gitignore (modified) (1 diff)
-
papers/general/Makefile (modified) (3 diffs)
-
papers/general/Paper.tex (modified) (1 diff)
-
papers/general/evaluation/timing.gp (modified) (1 diff)
-
proposals/tuples/tuples.tex (modified) (1 diff)
-
refrat/.gitignore (modified) (1 diff)
-
refrat/Makefile (modified) (4 diffs)
-
refrat/refrat.bib (added)
-
refrat/refrat.tex (modified) (4 diffs)
-
user/.gitignore (modified) (1 diff)
-
user/Cdecl.fig (added)
-
user/EHMHierarchy.fig (added)
-
user/Makefile (modified) (3 diffs)
-
user/figures/Cdecl.fig (deleted)
-
user/figures/EHMHierarchy.fig (deleted)
-
user/figures/pointer1.fig (deleted)
-
user/figures/pointer2.fig (deleted)
-
user/pointer1.fig (added)
-
user/pointer2.fig (added)
-
user/user.tex (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/OOPSLA17/.gitignore
r281806b6 r4ab3d68e 1 1 # generated by latex 2 build/* 2 *.aux 3 *.bbl 4 *.blg 5 *.brf 6 *.dvi 7 *.idx 8 *.ilg 9 *.ind 10 *.log 11 *.out 3 12 *.pdf 4 13 *.ps 14 *.toc 15 *.lof 16 *.lot 17 *.synctex.gz 18 comment.cut 19 timing.tex -
doc/papers/OOPSLA17/Makefile
r281806b6 r4ab3d68e 1 ## Define the configuration variables.1 ## Define the appropriate configuration variables. 2 2 3 Build = build 4 Figures = figures 5 Macros = ../../LaTeXmacros 6 TeXLIB = .:${Macros}:${Build}:../../bibliography: 7 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build} 3 TeXLIB = .:../LaTeXmacros:../LaTeXmacros/listings:../LaTeXmacros/enumitem:../bibliography/: 4 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error 8 5 BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex 9 10 MAKEFLAGS = --no-print-directory --silent #11 VPATH = ${Figures} evaluation12 6 13 7 ## Define the text source files. … … 39 33 40 34 clean : 41 @rm -frv ${DOCUMENT} ${basename ${DOCUMENT}}.ps ${Build} 35 rm -f *.bbl *.aux *.dvi *.idx *.ilg *.ind *.brf *.out *.log *.toc *.blg *.pstex_t *.cf \ 36 ${FIGURES} ${PICTURES} ${PROGRAMS} ${GRAPHS} ${basename ${DOCUMENT}}.ps ${DOCUMENT} 42 37 43 38 # File Dependencies # … … 47 42 48 43 ${basename ${DOCUMENT}}.ps : ${basename ${DOCUMENT}}.dvi 49 dvips $ {Build}/$< -o $@44 dvips $< -o $@ 50 45 51 ${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex ../../bibliography/pl.bib 46 #${DOCUMENT} : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \ 47 48 ${basename ${DOCUMENT}}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex ../bibliography/cfa.bib 49 # Conditionally create an empty *.idx (index) file for inclusion until makeindex is run. 50 if [ ! -r ${basename $@}.idx ] ; then touch ${basename $@}.idx ; fi 52 51 # Must have *.aux file containing citations for bibtex 53 52 if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi 54 -${BibTeX} ${ Build}/${basename $@}55 # Some citations reference others so run again to resolve these citations53 -${BibTeX} ${basename $@} 54 # Some citations reference others so run steps again to resolve these citations 56 55 ${LaTeX} ${basename $@}.tex 57 -${BibTeX} ${Build}/${basename $@} 58 # Run again to finish citations 56 -${BibTeX} ${basename $@} 57 # Make index from *.aux entries and input index at end of document 58 makeindex -s ../LaTeXmacros/indexstyle ${basename $@}.idx 59 59 ${LaTeX} ${basename $@}.tex 60 # Run again to get index title into table of contents 61 ${LaTeX} ${basename $@}.tex 62 63 predefined : 64 sed -f predefined.sed ${basename ${DOCUMENT}}.tex > ${basename $@}.cf 60 65 61 66 ## Define the default recipes. 62 67 63 ${Build}: 64 mkdir -p ${Build} 65 66 ${GRAPHS} : timing.gp timing.dat 67 gnuplot -e Build="'${Build}/'" evaluation/timing.gp 68 ${GRAPHS} : evaluation/timing.gp evaluation/timing.dat 69 gnuplot evaluation/timing.gp 68 70 69 71 %.tex : %.fig 70 fig2dev -L eepic $< > $ {Build}/$@72 fig2dev -L eepic $< > $@ 71 73 72 74 %.ps : %.fig 73 fig2dev -L ps $< > $ {Build}/$@75 fig2dev -L ps $< > $@ 74 76 75 77 %.pstex : %.fig 76 fig2dev -L pstex $< > $ {Build}/$@77 fig2dev -L pstex_t -p $ {Build}/$@ $< > ${Build}/$@_t78 fig2dev -L pstex $< > $@ 79 fig2dev -L pstex_t -p $@ $< > $@_t 78 80 79 81 # Local Variables: # -
doc/papers/OOPSLA17/evaluation/timing.gp
r281806b6 r4ab3d68e 2 2 # set output "timing.pdf" 3 3 set terminal pslatex size 6.25,2.125 color solid 4 set output Build."timing.tex"4 set output "timing.tex" 5 5 6 6 set pointsize 2.0 -
doc/papers/OOPSLA17/generic_types.tex
r281806b6 r4ab3d68e 1109 1109 1110 1110 \bibliographystyle{ACM-Reference-Format} 1111 \bibliography{ pl}1111 \bibliography{cfa} 1112 1112 1113 1113 -
doc/papers/concurrency/.gitignore
r281806b6 r4ab3d68e 1 # generated by latex2 1 build/* 3 2 *.pdf -
doc/papers/concurrency/Makefile
r281806b6 r4ab3d68e 2 2 3 3 Build = build 4 Figures = figures5 4 Macros = ../../LaTeXmacros 6 TeXLIB = .:style:annex:${Macros}:${Build}: ../../bibliography:7 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build} 5 TeXLIB = .:style:annex:${Macros}:${Build}:/usr/local/bibliographies: 6 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build} -interaction=nonstopmode 8 7 BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex 9 8 10 9 MAKEFLAGS = --no-print-directory --silent # 11 VPATH = ${Figures}12 10 13 11 ## Define the text source files. … … 43 41 # Directives # 44 42 45 .PHONY : all clean # not file names43 .PHONY : all clean # not file names 46 44 47 45 all : ${DOCUMENT} … … 59 57 60 58 ${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \ 61 ${Macros}/common.tex ${Macros}/indexstyle annex/local.bib ../../bibliography/pl.bib 62 # Must have *.aux file containing citations for bibtex 63 if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi 64 -${BibTeX} ${Build}/${basename $@} 65 # Some citations reference others so run again to resolve these citations 59 ${Macros}/common.tex ${Macros}/indexstyle annex/local.bib /usr/local/bibliographies/pl.bib 60 if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi # Must have *.aux file containing citations for bibtex 61 -${BibTeX} ${Build}/${basename $@} # Some citations reference others so run again to resolve these citations 66 62 ${LaTeX} ${basename $@}.tex 67 63 -${BibTeX} ${Build}/${basename $@} 68 # Run again to finish citations 69 ${LaTeX} ${basename $@}.tex 64 ${LaTeX} ${basename $@}.tex # Finish citations 70 65 71 66 ## Define the default recipes. 67 68 vpath %.tex ${subst .zzz,,${subst .zzz ,:,${SOURCES}}} # add prefix for source 69 vpath %.fig ${subst .zzz,,${subst .zzz ,:,${SOURCES}}} # add prefix for source 72 70 73 71 ${Build}: 74 72 mkdir -p ${Build} 75 73 76 %.tex : %.fig74 %.tex : figures/%.fig 77 75 fig2dev -L eepic $< > ${Build}/$@ 78 76 79 %.ps : %.fig77 %.ps : figures/%.fig 80 78 fig2dev -L ps $< > ${Build}/$@ 81 79 82 %.pstex : %.fig80 %.pstex : figures/%.fig 83 81 fig2dev -L pstex $< > ${Build}/$@ 84 82 fig2dev -L pstex_t -p ${Build}/$@ $< > ${Build}/$@_t 85 83 86 84 # Local Variables: # 85 # tab-width : 4 # 87 86 # compile-command: "make" # 88 87 # End: # -
doc/papers/concurrency/Paper.tex
r281806b6 r4ab3d68e 1 % inline code ©...© (copyright symbol) emacs: C-q M-) 2 % red highlighting ®...® (registered trademark symbol) emacs: C-q M-. 3 % blue highlighting ß...ß (sharp s symbol) emacs: C-q M-_ 4 % green highlighting ¢...¢ (cent symbol) emacs: C-q M-" 5 % LaTex escape §...§ (section symbol) emacs: C-q M-' 6 % keyword escape ¶...¶ (pilcrow symbol) emacs: C-q M-^ 1 % requires tex packages: texlive-base texlive-latex-base tex-common texlive-humanities texlive-latex-extra texlive-fonts-recommended 2 3 % inline code �...� (copyright symbol) emacs: C-q M-) 4 % red highlighting �...� (registered trademark symbol) emacs: C-q M-. 5 % blue highlighting �...� (sharp s symbol) emacs: C-q M-_ 6 % green highlighting �...� (cent symbol) emacs: C-q M-" 7 % LaTex escape �...� (section symbol) emacs: C-q M-' 8 % keyword escape �...� (pilcrow symbol) emacs: C-q M-^ 7 9 % math escape $...$ (dollar symbol) 8 10 … … 18 20 \usepackage{epic,eepic} 19 21 \usepackage{upquote} % switch curled `'" to straight 22 \usepackage{dirtytalk} 20 23 \usepackage{calc} 21 24 \usepackage{xspace} … … 43 46 \urlstyle{rm} 44 47 48 \usepackage{tikz} 49 \def\checkmark{\tikz\fill[scale=0.4](0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;} 50 45 51 \setlength{\topmargin}{-0.45in} % move running title into header 46 52 \setlength{\headsep}{0.25in} … … 72 78 73 79 \title{Concurrency in \CFA} 74 \author{Thierry Delisle and Peter A. Buhr, Waterloo, Ontario, Canada}80 \author{Thierry Delisle, Waterloo, Ontario, Canada, 2018} 75 81 76 82 … … 79 85 80 86 \begin{abstract} 81 \CFA is a modern, \emph{non-object-oriented} extension of the C programming language. 82 This paper serves as a definition and an implementation for the concurrency and parallelism \CFA offers. These features are created from scratch due to the lack of concurrency in ISO C. Lightweight threads are introduced into the language. In addition, monitors are introduced as a high-level tool for control-flow based synchronization and mutual-exclusion. The main contributions of this paper are two-fold: it extends the existing semantics of monitors introduce by~\cite{Hoare74} to handle monitors in groups and also details the engineering effort needed to introduce these features as core language features. Indeed, these features are added with respect to expectations of C programmers, and integrate with the \CFA type-system and other language features. 87 \CFA is a modern, non-object-oriented extension of the C programming language. This thesis serves as a definition and an implementation for the concurrency and parallelism \CFA offers. These features are created from scratch due to the lack of concurrency in ISO C. Lightweight threads are introduced into the language. In addition, monitors are introduced as a high-level tool for control-flow based synchronization and mutual-exclusion. The main contributions of this thesis are two-fold: it extends the existing semantics of monitors introduce by~\cite{Hoare74} to handle monitors in groups and also details the engineering effort needed to introduce these features as core language features. Indeed, these features are added with respect to expectations of C programmers, and integrate with the \CFA type-system and other language features. 83 88 \end{abstract} 84 89 … … 90 95 \section{Introduction} 91 96 % ====================================================================== 92 93 This paper provides a minimal concurrency \textbf{api} that is simple, efficient and can be reused to build higher-level features. The simplest possible concurrency system is a thread and a lock but this low-level approach is hard to master. An easier approach for users is to support higher-level constructs as the basis of concurrency. Indeed, for highly productive concurrent programming, high-level approaches are much more popular~\cite{HPP:Study}. Examples are task based, message passing and implicit threading. The high-level approach and its minimal \textbf{api} are tested in a dialect of C, called \CFA. Furthermore, the proposed \textbf{api} doubles as an early definition of the \CFA language and library. This paper also provides an implementation of the concurrency library for \CFA as well as all the required language features added to the source-to-source translator. 97 This thesis provides a minimal concurrency \textbf{api} that is simple, efficient and can be reused to build higher-level features. The simplest possible concurrency system is a thread and a lock but this low-level approach is hard to master. An easier approach for users is to support higher-level constructs as the basis of concurrency. Indeed, for highly productive concurrent programming, high-level approaches are much more popular~\cite{HPP:Study}. Examples are task based, message passing and implicit threading. The high-level approach and its minimal \textbf{api} are tested in a dialect of C, called \CFA. Furthermore, the proposed \textbf{api} doubles as an early definition of the \CFA language and library. This thesis also provides an implementation of the concurrency library for \CFA as well as all the required language features added to the source-to-source translator. 94 98 95 99 There are actually two problems that need to be solved in the design of concurrency for a programming language: which concurrency and which parallelism tools are available to the programmer. While these two concepts are often combined, they are in fact distinct, requiring different tools~\cite{Buhr05a}. Concurrency tools need to handle mutual exclusion and synchronization, while parallelism tools are about performance, cost and resource utilization. 96 100 97 In the context of this paper, a \textbf{thread} is a fundamental unit of execution that runs a sequence of code, generally on a program stack. Having multiple simultaneous threads gives rise to concurrency and generally requires some kind of locking mechanism to ensure proper execution. Correspondingly, \textbf{concurrency} is defined as the concepts and challenges that occur when multiple independent (sharing memory, timing dependencies, etc.) concurrent threads are introduced. Accordingly, \textbf{locking} (and by extension locks) are defined as a mechanism that prevents the progress of certain threads in order to avoid problems due to concurrency. Finally, in this paper\textbf{parallelism} is distinct from concurrency and is defined as running multiple threads simultaneously. More precisely, parallelism implies \emph{actual} simultaneous execution as opposed to concurrency which only requires \emph{apparent} simultaneous execution. As such, parallelism is only observable in the differences in performance or, more generally, differences in timing.101 In the context of this thesis, a \textbf{thread} is a fundamental unit of execution that runs a sequence of code, generally on a program stack. Having multiple simultaneous threads gives rise to concurrency and generally requires some kind of locking mechanism to ensure proper execution. Correspondingly, \textbf{concurrency} is defined as the concepts and challenges that occur when multiple independent (sharing memory, timing dependencies, etc.) concurrent threads are introduced. Accordingly, \textbf{locking} (and by extension locks) are defined as a mechanism that prevents the progress of certain threads in order to avoid problems due to concurrency. Finally, in this thesis \textbf{parallelism} is distinct from concurrency and is defined as running multiple threads simultaneously. More precisely, parallelism implies \emph{actual} simultaneous execution as opposed to concurrency which only requires \emph{apparent} simultaneous execution. As such, parallelism is only observable in the differences in performance or, more generally, differences in timing. 98 102 99 103 % ====================================================================== … … 109 113 110 114 % ====================================================================== 111 \s ubsection{References}115 \section{References} 112 116 113 117 Like \CC, \CFA introduces rebind-able references providing multiple dereferencing as an alternative to pointers. In regards to concurrency, the semantic difference between pointers and references are not particularly relevant, but since this document uses mostly references, here is a quick overview of the semantics: … … 128 132 129 133 % ====================================================================== 130 \s ubsection{Overloading}134 \section{Overloading} 131 135 132 136 Another important feature of \CFA is function overloading as in Java and \CC, where routines with the same name are selected based on the number and type of the arguments. As well, \CFA uses the return type as part of the selection criteria, as in Ada~\cite{Ada}. For routines with multiple parameters and returns, the selection is complex. … … 149 153 150 154 % ====================================================================== 151 \s ubsection{Operators}155 \section{Operators} 152 156 Overloading also extends to operators. The syntax for denoting operator-overloading is to name a routine with the symbol of the operator and question marks where the arguments of the operation appear, e.g.: 153 157 \begin{cfacode} … … 169 173 170 174 % ====================================================================== 171 \s ubsection{Constructors/Destructors}175 \section{Constructors/Destructors} 172 176 Object lifetime is often a challenge in concurrency. \CFA uses the approach of giving concurrent meaning to object lifetime as a means of synchronization and/or mutual exclusion. Since \CFA relies heavily on the lifetime of objects, constructors and destructors is a core feature required for concurrency and parallelism. \CFA uses the following syntax for constructors and destructors: 173 177 \begin{cfacode} … … 204 208 205 209 % ====================================================================== 206 \s ubsection{Parametric Polymorphism}210 \section{Parametric Polymorphism} 207 211 \label{s:ParametricPolymorphism} 208 212 Routines in \CFA can also be reused for multiple types. This capability is done using the \code{forall} clauses, which allow separately compiled routines to support generic usage over multiple types. For example, the following sum function works for any type that supports construction from 0 and addition: … … 237 241 238 242 % ====================================================================== 239 \s ubsection{with Clause/Statement}243 \section{with Clause/Statement} 240 244 Since \CFA lacks the concept of a receiver, certain functions end up needing to repeat variable names often. To remove this inconvenience, \CFA provides the \code{with} statement, which opens an aggregate scope making its fields directly accessible (like Pascal). 241 245 \begin{cfacode} … … 282 286 283 287 \section{\protect\CFA's Thread Building Blocks} 284 One of the important features that are missing in C is threading\footnote{While the C11 standard defines a ``threads.h'' header, it is minimal and defined as optional. As such, library support for threading is far from widespread. At the time of writing the paper, neither \texttt{gcc} nor \texttt{clang} support ``threads.h'' in their respective standard libraries.}. On modern architectures, a lack of threading is unacceptable~\cite{Sutter05, Sutter05b}, and therefore modern programming languages must have the proper tools to allow users to write efficient concurrent programs to take advantage of parallelism. As an extension of C, \CFA needs to express these concepts in a way that is as natural as possible to programmers familiar with imperative languages. And being a system-level language means programmers expect to choose precisely which features they need and which cost they are willing to pay.288 One of the important features that are missing in C is threading\footnote{While the C11 standard defines a ``threads.h'' header, it is minimal and defined as optional. As such, library support for threading is far from widespread. At the time of writing the thesis, neither \texttt{gcc} nor \texttt{clang} support ``threads.h'' in their respective standard libraries.}. On modern architectures, a lack of threading is unacceptable~\cite{Sutter05, Sutter05b}, and therefore modern programming languages must have the proper tools to allow users to write efficient concurrent programs to take advantage of parallelism. As an extension of C, \CFA needs to express these concepts in a way that is as natural as possible to programmers familiar with imperative languages. And being a system-level language means programmers expect to choose precisely which features they need and which cost they are willing to pay. 285 289 286 290 \section{Coroutines: A Stepping Stone}\label{coroutine} … … 660 664 \end{cfacode} 661 665 662 In this example, threads of type \code{foo} start execution in the \code{void main(foo &)} routine, which prints \code{"Hello World!".} While this paperencourages this approach to enforce strongly typed programming, users may prefer to use the routine-based thread semantics for the sake of simplicity. With the static semantics it is trivial to write a thread type that takes a function pointer as a parameter and executes it on its stack asynchronously.666 In this example, threads of type \code{foo} start execution in the \code{void main(foo &)} routine, which prints \code{"Hello World!".} While this thesis encourages this approach to enforce strongly typed programming, users may prefer to use the routine-based thread semantics for the sake of simplicity. With the static semantics it is trivial to write a thread type that takes a function pointer as a parameter and executes it on its stack asynchronously. 663 667 \begin{cfacode} 664 668 typedef void (*voidFunc)(int); … … 995 999 % ====================================================================== 996 1000 % ====================================================================== 997 In addition to mutual exclusion, the monitors at the core of \CFA's concurrency can also be used to achieve synchronization. With monitors, this capability is generally achieved with internal or external scheduling as in~\cite{Hoare74}. With \textbf{scheduling} loosely defined as deciding which thread acquires the critical section next, \textbf{internal scheduling} means making the decision from inside the critical section (i.e., with access to the shared state), while \textbf{external scheduling} means making the decision when entering the critical section (i.e., without access to the shared state). Since internal scheduling within a single monitor is mostly a solved problem, this paperconcentrates on extending internal scheduling to multiple monitors. Indeed, like the \textbf{bulk-acq} semantics, internal scheduling extends to multiple monitors in a way that is natural to the user but requires additional complexity on the implementation side.1001 In addition to mutual exclusion, the monitors at the core of \CFA's concurrency can also be used to achieve synchronization. With monitors, this capability is generally achieved with internal or external scheduling as in~\cite{Hoare74}. With \textbf{scheduling} loosely defined as deciding which thread acquires the critical section next, \textbf{internal scheduling} means making the decision from inside the critical section (i.e., with access to the shared state), while \textbf{external scheduling} means making the decision when entering the critical section (i.e., without access to the shared state). Since internal scheduling within a single monitor is mostly a solved problem, this thesis concentrates on extending internal scheduling to multiple monitors. Indeed, like the \textbf{bulk-acq} semantics, internal scheduling extends to multiple monitors in a way that is natural to the user but requires additional complexity on the implementation side. 998 1002 999 1003 First, here is a simple example of internal scheduling: … … 1796 1800 A \textbf{cfacluster} is a group of \textbf{kthread} executed in isolation. \textbf{uthread} are scheduled on the \textbf{kthread} of a given \textbf{cfacluster}, allowing organization between \textbf{uthread} and \textbf{kthread}. It is important that \textbf{kthread} belonging to a same \textbf{cfacluster} have homogeneous settings, otherwise migrating a \textbf{uthread} from one \textbf{kthread} to the other can cause issues. A \textbf{cfacluster} also offers a pluggable scheduler that can optimize the workload generated by the \textbf{uthread}. 1797 1801 1798 \textbf{cfacluster} have not been fully implemented in the context of this paper. Currently \CFA only supports one \textbf{cfacluster}, the initial one.1802 \textbf{cfacluster} have not been fully implemented in the context of this thesis. Currently \CFA only supports one \textbf{cfacluster}, the initial one. 1799 1803 1800 1804 \subsection{Future Work: Machine Setup}\label{machine} 1801 While this was not done in the context of this paper, another important aspect of clusters is affinity. While many common desktop and laptop PCs have homogeneous CPUs, other devices often have more heterogeneous setups. For example, a system using \textbf{numa} configurations may benefit from users being able to tie clusters and/or kernel threads to certain CPU cores. OS support for CPU affinity is now common~\cite{affinityLinux, affinityWindows, affinityFreebsd, affinityNetbsd, affinityMacosx}, which means it is both possible and desirable for \CFA to offer an abstraction mechanism for portable CPU affinity.1805 While this was not done in the context of this thesis, another important aspect of clusters is affinity. While many common desktop and laptop PCs have homogeneous CPUs, other devices often have more heterogeneous setups. For example, a system using \textbf{numa} configurations may benefit from users being able to tie clusters and/or kernel threads to certain CPU cores. OS support for CPU affinity is now common~\cite{affinityLinux, affinityWindows, affinityFreebsd, affinityNetbsd, affinityMacosx}, which means it is both possible and desirable for \CFA to offer an abstraction mechanism for portable CPU affinity. 1802 1806 1803 1807 \subsection{Paradigms}\label{cfaparadigms} … … 1811 1815 The main memory concern for concurrency is queues. All blocking operations are made by parking threads onto queues and all queues are designed with intrusive nodes, where each node has pre-allocated link fields for chaining, to avoid the need for memory allocation. Since several concurrency operations can use an unbound amount of memory (depending on \textbf{bulk-acq}), statically defining information in the intrusive fields of threads is insufficient.The only way to use a variable amount of memory without requiring memory allocation is to pre-allocate large buffers of memory eagerly and store the information in these buffers. Conveniently, the call stack fits that description and is easy to use, which is why it is used heavily in the implementation of internal scheduling, particularly variable-length arrays. Since stack allocation is based on scopes, the first step of the implementation is to identify the scopes that are available to store the information, and which of these can have a variable-length array. The threads and the condition both have a fixed amount of memory, while \code{mutex} routines and blocking calls allow for an unbound amount, within the stack size. 1812 1816 1813 Note that since the major contributions of this paperare extending monitor semantics to \textbf{bulk-acq} and loose object definitions, any challenges that are not resulting of these characteristics of \CFA are considered as solved problems and therefore not discussed.1817 Note that since the major contributions of this thesis are extending monitor semantics to \textbf{bulk-acq} and loose object definitions, any challenges that are not resulting of these characteristics of \CFA are considered as solved problems and therefore not discussed. 1814 1818 1815 1819 % ====================================================================== … … 2611 2615 2612 2616 \section{Conclusion} 2613 This paper has achieved a minimal concurrency \textbf{api} that is simple, efficient and usable as the basis for higher-level features. The approach presented is based on a lightweight thread-system for parallelism, which sits on top of clusters of processors. This M:N model is judged to be both more efficient and allow more flexibility for users. Furthermore, this document introduces monitors as the main concurrency tool for users. This paperalso offers a novel approach allowing multiple monitors to be accessed simultaneously without running into the Nested Monitor Problem~\cite{Lister77}. It also offers a full implementation of the concurrency runtime written entirely in \CFA, effectively the largest \CFA code base to date.2617 This thesis has achieved a minimal concurrency \textbf{api} that is simple, efficient and usable as the basis for higher-level features. The approach presented is based on a lightweight thread-system for parallelism, which sits on top of clusters of processors. This M:N model is judged to be both more efficient and allow more flexibility for users. Furthermore, this document introduces monitors as the main concurrency tool for users. This thesis also offers a novel approach allowing multiple monitors to be accessed simultaneously without running into the Nested Monitor Problem~\cite{Lister77}. It also offers a full implementation of the concurrency runtime written entirely in \CFA, effectively the largest \CFA code base to date. 2614 2618 2615 2619 … … 2621 2625 2622 2626 \subsection{Performance} \label{futur:perf} 2623 This paperpresents a first implementation of the \CFA concurrency runtime. Therefore, there is still significant work to improve performance. Many of the data structures and algorithms may change in the future to more efficient versions. For example, the number of monitors in a single \textbf{bulk-acq} is only bound by the stack size, this is probably unnecessarily generous. It may be possible that limiting the number helps increase performance. However, it is not obvious that the benefit would be significant.2627 This thesis presents a first implementation of the \CFA concurrency runtime. Therefore, there is still significant work to improve performance. Many of the data structures and algorithms may change in the future to more efficient versions. For example, the number of monitors in a single \textbf{bulk-acq} is only bound by the stack size, this is probably unnecessarily generous. It may be possible that limiting the number helps increase performance. However, it is not obvious that the benefit would be significant. 2624 2628 2625 2629 \subsection{Flexible Scheduling} \label{futur:sched} … … 2725 2729 \section{Acknowledgements} 2726 2730 2727 Thanks to Aaron Moss, Rob Schluntz and Andrew Beach for their work on the \CFA project as well as all the discussions which helped concretize the ideas in this paper. 2728 Partial funding was supplied by the Natural Sciences and Engineering Research Council of Canada and a corporate partnership with Huawei Ltd. 2731 I would like to thank my supervisor, Professor Peter Buhr, for his guidance through my degree as well as the editing of this document. 2732 2733 I would like to thank Professors Martin Karsten and Gregor Richards, for reading my thesis and providing helpful feedback. 2734 2735 Thanks to Aaron Moss, Rob Schluntz and Andrew Beach for their work on the \CFA project as well as all the discussions which have helped me concretize the ideas in this thesis. 2736 2737 Finally, I acknowledge that this has been possible thanks to the financial help offered by the David R. Cheriton School of Computer Science and the corporate partnership with Huawei Ltd. 2729 2738 2730 2739 … … 2735 2744 2736 2745 \end{document} 2737 2738 % Local Variables: %2739 % tab-width: 4 %2740 % fill-column: 120 %2741 % compile-command: "make" %2742 % End: % -
doc/papers/general/.gitignore
r281806b6 r4ab3d68e 1 1 # generated by latex 2 build/* 2 *.aux 3 *.bbl 4 *.blg 5 *.brf 6 *.dvi 7 *.idx 8 *.ilg 9 *.ind 10 *.log 11 *.out 3 12 *.pdf 4 13 *.ps 14 *.toc 15 *.lof 16 *.lot 17 *.synctex.gz 18 comment.cut 19 timing.tex -
doc/papers/general/Makefile
r281806b6 r4ab3d68e 2 2 3 3 Build = build 4 Figures = figures5 4 Macros = ../../LaTeXmacros 6 5 TeXLIB = .:${Macros}:${Build}:../../bibliography: 7 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build} 6 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build} -interaction=nonstopmode 8 7 BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex 9 8 10 9 MAKEFLAGS = --no-print-directory --silent # 11 VPATH = ${Figures} evaluation12 10 13 11 ## Define the text source files. … … 36 34 # Directives # 37 35 38 .PHONY : all clean # not file names36 .PHONY : all clean # not file names 39 37 40 38 all : ${DOCUMENT} … … 52 50 53 51 ${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \ 54 ${Macros}/common.tex ${Macros}/indexstyle ../../bibliography/pl.bib 55 # Must have *.aux file containing citations for bibtex 56 if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi 57 -${BibTeX} ${Build}/${basename $@} 58 # Some citations reference others so run again to resolve these citations 52 ${Macros}/common.tex ${Macros}/indexstyle ../../bibliography/cfa.bib 53 if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi # Must have *.aux file containing citations for bibtex 54 -${BibTeX} ${Build}/${basename $@} # Some citations reference others so run again to resolve these citations 59 55 ${LaTeX} ${basename $@}.tex 60 56 -${BibTeX} ${Build}/${basename $@} 61 # Run again to finish citations 62 ${LaTeX} ${basename $@}.tex 57 ${LaTeX} ${basename $@}.tex # Finish citations 63 58 64 59 ## Define the default recipes. 60 61 vpath %.tex ${subst .zzz,,${subst .zzz ,:,${SOURCES}}} # add prefix for source 62 vpath %.fig ${subst .zzz,,${subst .zzz ,:,${SOURCES}}} # add prefix for source 65 63 66 64 ${Build}: 67 65 mkdir -p ${Build} 68 66 69 ${GRAPHS} : timing.gptiming.dat70 gnuplot -e Build="'${Build}/'"evaluation/timing.gp67 ${GRAPHS} : evaluation/timing.gp evaluation/timing.dat 68 gnuplot evaluation/timing.gp 71 69 72 %.tex : %.fig70 %.tex : figures/%.fig 73 71 fig2dev -L eepic $< > ${Build}/$@ 74 72 75 %.ps : %.fig73 %.ps : figures/%.fig 76 74 fig2dev -L ps $< > ${Build}/$@ 77 75 78 %.pstex : %.fig76 %.pstex : figures/%.fig 79 77 fig2dev -L pstex $< > ${Build}/$@ 80 78 fig2dev -L pstex_t -p ${Build}/$@ $< > ${Build}/$@_t 81 79 82 80 # Local Variables: # 81 # tab-width : 4 # 83 82 # compile-command: "make" # 84 83 # End: # -
doc/papers/general/Paper.tex
r281806b6 r4ab3d68e 1095 1095 1096 1096 \bibliographystyle{plain} 1097 \bibliography{ pl}1097 \bibliography{cfa} 1098 1098 1099 1099 -
doc/papers/general/evaluation/timing.gp
r281806b6 r4ab3d68e 2 2 # set output "timing.pdf" 3 3 set terminal pslatex size 6.25,2.125 color solid 4 set output Build."timing.tex"4 set output "timing.tex" 5 5 6 6 set pointsize 2.0 -
doc/proposals/tuples/tuples.tex
r281806b6 r4ab3d68e 322 322 \addcontentsline{toc}{section}{\refname} 323 323 \bibliographystyle{plain} 324 \bibliography{ pl}324 \bibliography{cfa} 325 325 326 326 %\addcontentsline{toc}{section}{\indexname} % add index name to table of contents -
doc/refrat/.gitignore
r281806b6 r4ab3d68e 1 1 # generated by latex 2 build/* 2 *.aux 3 *.bbl 4 *.blg 5 *.brf 6 *.dvi 7 *.idx 8 *.ilg 9 *.ind 10 *.log 11 *.out 3 12 *.pdf 4 13 *.ps 14 *.toc -
doc/refrat/Makefile
r281806b6 r4ab3d68e 1 ## Define the configuration variables.1 ## Define the appropriate configuration variables. 2 2 3 Build = build 4 Figures = figures 5 Macros = ../LaTeXmacros 6 TeXLIB = .:${Macros}:${Build}:../bibliography: 7 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build} 3 TeXLIB = .:../LaTeXmacros:../LaTeXmacros/listings:../LaTeXmacros/enumitem:../bibliography/: 4 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error 8 5 BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex 9 10 MAKEFLAGS = --no-print-directory --silent #11 VPATH = ${Figures}12 6 13 7 ## Define the text source files. … … 37 31 # Directives # 38 32 39 .PHONY : all clean # not file names40 41 33 all : ${DOCUMENT} 42 34 43 35 clean : 44 @rm -frv ${DOCUMENT} ${basename ${DOCUMENT}}.ps ${Build} 36 rm -f *.bbl *.aux *.dvi *.idx *.ilg *.ind *.brf *.out *.log *.toc *.blg *.pstex_t *.cf \ 37 ${FIGURES} ${PICTURES} ${PROGRAMS} ${GRAPHS} ${basename ${DOCUMENT}}.ps ${DOCUMENT} 45 38 46 39 # File Dependencies # … … 50 43 51 44 ${basename ${DOCUMENT}}.ps : ${basename ${DOCUMENT}}.dvi 52 dvips $ {Build}/$< -o $@45 dvips $< -o $@ 53 46 54 ${basename ${DOCUMENT}}.dvi : Makefile ${ Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \55 ${Macros}/common.tex ${Macros}/lstlang.sty ${Macros}/indexstyle ../bibliography/pl.bib47 ${basename ${DOCUMENT}}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \ 48 ../LaTeXmacros/common.tex ../LaTeXmacros/lstlang.sty ../LaTeXmacros/indexstyle ../bibliography/cfa.bib 56 49 # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run. 57 if [ ! -r ${basename $@}.ind ] ; then touch ${ Build}/${basename $@}.ind ; fi50 if [ ! -r ${basename $@}.ind ] ; then touch ${basename $@}.ind ; fi 58 51 # Must have *.aux file containing citations for bibtex 59 52 if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi 60 -${BibTeX} ${ Build}/${basename $@}61 # Some citations reference others so run again to resolve these citations53 -${BibTeX} ${basename $@} 54 # Some citations reference others so run steps again to resolve these citations 62 55 ${LaTeX} ${basename $@}.tex 63 -${BibTeX} ${ Build}/${basename $@}56 -${BibTeX} ${basename $@} 64 57 # Make index from *.aux entries and input index at end of document 65 makeindex -s ${Macros}/indexstyle ${Build}/${basename $@}.idx 66 # Run again to finish citations 58 makeindex -s ../LaTeXmacros/indexstyle ${basename $@}.idx 67 59 ${LaTeX} ${basename $@}.tex 68 60 # Run again to get index title into table of contents … … 74 66 ## Define the default recipes. 75 67 76 ${Build}:77 mkdir -p ${Build}78 79 68 %.tex : %.fig 80 fig2dev -L eepic $< > $ {Build}/$@69 fig2dev -L eepic $< > $@ 81 70 82 71 %.ps : %.fig 83 fig2dev -L ps $< > $ {Build}/$@72 fig2dev -L ps $< > $@ 84 73 85 74 %.pstex : %.fig 86 fig2dev -L pstex $< > $ {Build}/$@87 fig2dev -L pstex_t -p $ {Build}/$@ $< > ${Build}/$@_t75 fig2dev -L pstex $< > $@ 76 fig2dev -L pstex_t -p $@ $< > $@_t 88 77 89 78 # Local Variables: # -
doc/refrat/refrat.tex
r281806b6 r4ab3d68e 11 11 %% Created On : Wed Apr 6 14:52:25 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Wed Jan 31 17:30:23 201814 %% Update Count : 10 813 %% Last Modified On : Tue Aug 15 18:46:31 2017 14 %% Update Count : 106 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 141 141 The manual deliberately imitates the ordering of the \Celeven standard (although the section numbering differs). 142 142 Unfortunately, this means the manual contains more ``forward references'' than usual, making it harder to follow if the reader does not have a copy of the \Celeven standard. 143 For a simple introduction to \CFA, see~\cite{Cforall}. 143 For a simple introduction to \CFA, see the companion document ``An Overview of \CFA'' 144 \cite{Ditchfield96:Overview}. 144 145 145 146 \begin{rationale} … … 595 596 \begin{rationale} 596 597 Since each subsection describes the interpretations of an expression in terms of the interpretations of its subexpressions, this chapter can be taken as describing an overload resolution algorithm that uses one bottom-up pass over an expression tree. 597 Such an algorithm was first described (for Ada) by Baker~\cite{Bak er82}.598 Such an algorithm was first described (for Ada) by Baker~\cite{Bak:overload}. 598 599 It is extended here to handle polymorphic functions and arithmetic conversions. 599 600 The overload resolution rules and the predefined functions have been chosen so that, in programs that do not introduce overloaded declarations, expressions will have the same meaning in C and in \CFA. … … 3774 3775 3775 3776 \bibliographystyle{plain} 3776 \bibliography{ pl}3777 \bibliography{cfa} 3777 3778 3778 3779 -
doc/user/.gitignore
r281806b6 r4ab3d68e 1 1 # generated by latex 2 build/* 2 *.aux 3 *.bbl 4 *.blg 5 *.brf 6 *.dvi 7 *.idx 8 *.ilg 9 *.ind 10 *.log 11 *.out 3 12 *.pdf 4 13 *.ps 14 *.toc -
doc/user/Makefile
r281806b6 r4ab3d68e 1 ## Define the configuration variables.1 ## Define the appropriate configuration variables. 2 2 3 Build = build 4 Figures = figures 5 Macros = ../LaTeXmacros 6 TeXLIB = .:${Macros}:${Build}:../bibliography: 7 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build} 3 TeXLIB = .:../LaTeXmacros:../bibliography/: 4 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error 8 5 BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex 9 10 MAKEFLAGS = --no-print-directory --silent #11 VPATH = ${Figures}12 6 13 7 ## Define the text source files. … … 41 35 # Directives # 42 36 43 .PHONY : all clean # not file names44 45 37 all : ${DOCUMENT} 46 38 47 39 clean : 48 @rm -frv ${DOCUMENT} ${basename ${DOCUMENT}}.ps ${Build} 40 rm -f *.bbl *.aux *.dvi *.idx *.ilg *.ind *.brf *.out *.log *.toc *.blg *.pstex_t *.cf \ 41 ${FIGURES} ${PICTURES} ${PROGRAMS} ${GRAPHS} ${basename ${DOCUMENT}}.ps ${DOCUMENT} 49 42 50 43 # File Dependencies # … … 54 47 55 48 ${basename ${DOCUMENT}}.ps : ${basename ${DOCUMENT}}.dvi 56 dvips $ {Build}/$< -o $@49 dvips $< -o $@ 57 50 58 ${basename ${DOCUMENT}}.dvi : Makefile ${ Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \59 ${Macros}/common.tex ${Macros}/lstlang.sty ${Macros}/indexstyle ../bibliography/pl.bib51 ${basename ${DOCUMENT}}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \ 52 ../LaTeXmacros/common.tex ../LaTeXmacros/lstlang.sty ../LaTeXmacros/indexstyle ../bibliography/cfa.bib 60 53 # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run. 61 if [ ! -r ${basename $@}.ind ] ; then touch ${ Build}/${basename $@}.ind ; fi54 if [ ! -r ${basename $@}.ind ] ; then touch ${basename $@}.ind ; fi 62 55 # Must have *.aux file containing citations for bibtex 63 56 if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi 64 -${BibTeX} ${ Build}/${basename $@}65 # Some citations reference others so run again to resolve these citations57 -${BibTeX} ${basename $@} 58 # Some citations reference others so run steps again to resolve these citations 66 59 ${LaTeX} ${basename $@}.tex 67 -${BibTeX} ${ Build}/${basename $@}60 -${BibTeX} ${basename $@} 68 61 # Make index from *.aux entries and input index at end of document 69 makeindex -s ${Macros}/indexstyle ${Build}/${basename $@}.idx 70 # Run again to finish citations 62 makeindex -s ../LaTeXmacros/indexstyle ${basename $@}.idx 71 63 ${LaTeX} ${basename $@}.tex 72 64 # Run again to get index title into table of contents 73 65 ${LaTeX} ${basename $@}.tex 74 66 67 predefined : 68 sed -f predefined.sed ${basename ${DOCUMENT}}.tex > ${basename $@}.cf 69 75 70 ## Define the default recipes. 76 71 77 ${Build}:78 mkdir -p ${Build}79 80 72 %.tex : %.fig 81 fig2dev -L eepic $< > $ {Build}/$@73 fig2dev -L eepic $< > $@ 82 74 83 75 %.ps : %.fig 84 fig2dev -L ps $< > $ {Build}/$@76 fig2dev -L ps $< > $@ 85 77 86 78 %.pstex : %.fig 87 fig2dev -L pstex $< > $ {Build}/$@88 fig2dev -L pstex_t -p $ {Build}/$@ $< > ${Build}/$@_t79 fig2dev -L pstex $< > $@ 80 fig2dev -L pstex_t -p $@ $< > $@_t 89 81 90 82 # Local Variables: # -
doc/user/user.tex
r281806b6 r4ab3d68e 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Wed Jan 31 07:59:24 201814 %% Update Count : 314 613 %% Last Modified On : Mon Nov 27 18:09:59 2017 14 %% Update Count : 3143 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 40 40 \usepackage[dvips,plainpages=false,pdfpagelabels,pdfpagemode=UseNone,colorlinks=true,pagebackref=true,linkcolor=blue,citecolor=blue,urlcolor=blue,pagebackref=true,breaklinks=true]{hyperref} 41 41 \usepackage{breakurl} 42 \renewcommand{\UrlFont}{\small\sf} 42 43 43 44 \usepackage[pagewise]{lineno} … … 6660 6661 6661 6662 \bibliographystyle{plain} 6662 \bibliography{ pl}6663 \bibliography{cfa} 6663 6664 6664 6665
Note:
See TracChangeset
for help on using the changeset viewer.