Index: doc/bibliography/pl.bib
===================================================================
--- doc/bibliography/pl.bib	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/bibliography/pl.bib	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -9,5 +9,4 @@
 %    Predefined journal names:
 %  acmcs: Computing Surveys		acta: Acta Infomatica
-@string{acta="Acta Infomatica"}
 %  cacm: Communications of the ACM
 %  ibmjrd: IBM J. Research & Development ibmsj: IBM Systems Journal
@@ -22,4 +21,5 @@
 %  tcs: Theoretical Computer Science
 
+@string{acta="Acta Infomatica"}
 string{ieeepds="IEEE Transactions on Parallel and Distributed Systems"}
 @string{ieeepds="IEEE Trans. Parallel Distrib. Syst."}
@@ -124,4 +124,34 @@
     series	= {ACM Distinguished Dissertations},
     year	= 1983,
+}
+
+@article{Zhang19,
+    keywords	= {Algebraic effects, dynamic scoping, exceptions, parametricity, type systems},
+    author	= {Zhang, Yizhou and Myers, Andrew C.},
+    title	= {Abstraction-safe Effect Handlers via Tunneling},
+    journal	= {Proc. ACM Program. Lang.},
+    issue_date	= {January 2019},
+    volume	= {3},
+    number	= {POPL},
+    month	= jan,
+    year	= {2019},
+    issn	= {2475-1421},
+    pages	= {5:1--5:29},
+    articleno	= {5},
+    publisher	= {ACM},
+    address	= {New York, NY, USA},
+}
+
+@inproceedings{Zhang16,
+    keywords	= {Exception tunneling, Genus, exception handling},
+    author	= {Zhang, Yizhou and Salvaneschi, Guido and Beightol, Quinn and Liskov, Barbara and Myers, Andrew C.},
+    title	= {Accepting Blame for Safe Tunneled Exceptions},
+    booktitle	= {Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation},
+    series	= {PLDI'16},
+    year	= {2016},
+    location	= {Santa Barbara, CA, USA},
+    pages	= {281--295},
+    publisher	= {ACM},
+    address	= {New York, NY, USA},
 }
 
@@ -398,5 +428,8 @@
     journal	= sigplan,
     year	= 1981,
-    month	= feb, volume = 16, number = 2, pages = {48-52},
+    month	= feb,
+    volume	= 16,
+    number	= 2,
+    pages	= {48-52},
     comment	= {
         A one-pass, top-down algorithm for overload resolution.  Input is a
@@ -477,7 +510,9 @@
     title	= {An Alternative to Subclassing},
     journal	= sigplan,
-    volume	= {21},    number = {11},
+    volume	= {21},
+    number	= {11},
     pages	= {424-428},
-    month	= nov, year = 1986,
+    month	= nov,
+    year	= 1986,
     comment	= {
     	The Smalltalk class hierarchy has three uses: factoring out code;
@@ -533,5 +568,4 @@
     isbn	= {3-540-66538-2},
     location	= {Toulouse, France},
-    doi		= {http://doi.acm.org/10.1145/318773.319251},
     publisher	= {Springer},
     address	= {London, UK},
@@ -631,5 +665,4 @@
     year	= 2010,
     pages	= {39--50},
-    numpages	= {12},
     publisher	= {IEEE Computer Society},
     address	= {Washington, DC, USA},
@@ -922,4 +955,15 @@
 }
 
+@manual{C99,
+    keywords	= {ISO/IEC C 9899},
+    contributer	= {pabuhr@plg},
+    key		= {C99},
+    title	= {C Programming Language {ISO/IEC} 9899:1999(E)},
+    edition	= {2nd},
+    publisher	= {International Standard Organization},
+    address	= {\href{https://webstore.ansi.org/Standards/INCITS/INCITSISOIEC98991999R2005}{https://webstore.ansi.org/\-Standards/\-INCITS/\-INCITSISOIEC98991999R2005}},
+    year	= 1999,
+}
+
 @manual{C11,
     keywords	= {ISO/IEC C 11},
@@ -1305,8 +1349,4 @@
     location	= {London, United Kingdom},
     pages	= {41--53},
-    numpages	= {13},
-    url		= {http://doi.acm.org/10.1145/360204.360207},
-    doi		= {10.1145/360204.360207},
-    acmid	= {360207},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -2408,5 +2448,4 @@
     year	= 1993,
     pages	= {201--208},
-    url		= {http://doi.acm.org/10.1145/155360.155580},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -2606,5 +2645,4 @@
     location	= {Boulder, Colorado, USA},
     pages	= {91--97},
-    numpages	= {7},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -2637,8 +2675,4 @@
     issn	= {0004-5411},
     pages	= {215--225},
-    numpages	= {11},
-    url		= {http://doi.acm.org/10.1145/321879.321884},
-    doi		= {10.1145/321879.321884},
-    acmid	= {321884},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -2708,4 +2742,16 @@
 }
 
+@misc{Drepper13,
+    keywords	= {thread-local storage},
+    contributer	= {pabuhr@plg},
+    author	= {Ulrich Drepper},
+    title	= {{ELF} Handling For Thread-Local Storage},
+    year	= 2013,
+    month	= aug,
+    note	= {WikipediA},
+    howpublished= {\href{http://www.akkadia.org/drepper/tls.pdf}
+		  {http://\-www.akkadia.org/\-drepper/\-tls.pdf}},
+}
+
 @misc{Turley99,
     keywords	= {embedded system, micrprocessor},
@@ -2718,4 +2764,17 @@
     howpublished= {\href{https://www.eetimes.com/author.asp?sectionid=36&doc_id=1287712}
 		  {https://\-www.eetimes.com/\-author.asp?sectionid=\-36&doc_id=1287712}},
+}
+
+@article{Xiao19,
+    keywords	= {bug classification, fault trigger, Linux operating system, regression bug},
+    contributer	= {pabuhr@plg},
+    author	= {Guanping Xiao and Zheng Zheng and Beibei Yin and Kishor S. Trivedi and Xiaoting Du and Kai-Yuan Cai},
+    title	= {An Empirical Study of Fault Triggers in the Linux Operating System: An Evolutionary Perspective},
+    journal	= {IEEE Transactions on Reliability},
+    month	= dec,
+    year	= 2019,
+    volume	= 68,
+    number	= 4,
+    pages	= {1356-1383},
 }
 
@@ -3137,4 +3196,19 @@
 }
 
+@inproceedings{Palix11,
+    keywords	= {Linux, fault-finding tools},
+    contributer	= {pabuhr@plg},
+    author	= {Nicolas Palix and Ga\"el Thomas and Suman Saha and Christophe Calv\`es and Julia Lawall and Gilles Muller},
+    title	= {Faults in Linux: Ten Years Later},
+    booktitle	= {Proc. of the 16 International Conf. on Arch. Support for Prog. Lang. and Oper. Sys.},
+    series	= {ASPLOS'11},
+    month	= mar,
+    year	= 2011,
+    location	= {Newport Beach, California, USA},
+    pages	= {305-318},
+    publisher	= {ACM},
+    address	= {New York, NY, USA},
+}
+
 @article{Lamport87,
     keywords	= {software solutions, mutual exclusion, fast},
@@ -3258,8 +3332,4 @@
     issn	= {0001-0782},
     pages	= {107--115},
-    numpages	= {9},
-    url		= {http://doi.acm.org/10.1145/1538788.1538814},
-    doi		= {10.1145/1538788.1538814},
-    acmid	= {1538814},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -3664,4 +3734,13 @@
 }
 
+@mastersthesis{Radhakrishnan19,
+    author	= {Srihari Radhakrishnan},
+    title	= {High Performance Web Servers: A Study In Concurrent Programming Models},
+    school	= {School of Computer Sc., University of Waterloo},
+    year	= 2019,
+    optaddress	= {Waterloo, Ontario, Canada, N2L 3G1},
+    note	= {\href{https://uwspace.uwaterloo.ca/handle/10012/14706}{https://\-uwspace.uwaterloo.ca/\-handle/\-10012/\-14706}},
+}
+
 @article{katzenelson83b,
     contributer	= {gjditchfield@plg},
@@ -3697,4 +3776,15 @@
     pages	= {115-138},
     year	= 1971,
+}
+
+@inproceedings{Hagersten03,
+    keywords	= {cache storage, parallel architectures, performance evaluation, shared memory systems},
+    author	= {Zoran Radovi\'{c} and Erik Hagersten},
+    title	= {Hierarchical backoff locks for nonuniform communication architectures},
+    booktitle	= {Proceedings of the Ninth International Symposium on High-Performance Computer Architecture},
+    year	= {2003},
+    location	= {Anaheim, CA, USA},
+    pages	= {241-252},
+    publisher	= {IEEE},
 }
 
@@ -4365,4 +4455,15 @@
 }
 
+@misc{gccValueLabels,
+    keywords	= {gcc extension, value labels},
+    contributer	= {pabuhr@plg},
+    key		= {Labels as Values},
+    author	= {{gcc Extension}},
+    title	= {Labels as Values},
+    year	= {since gcc-3},
+    howpublished= {\href{https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html}
+		  {https:\-//gcc.gnu.org/\-onlinedocs/\-gcc/\-Labels-as-Values.html}},
+}
+
 @mastersthesis{Clarke90,
     keywords	= {concurrency, postponing requests},
@@ -4457,5 +4558,5 @@
 
 @article{Pierce00,
-    keywords	= {Scala},
+    keywords	= {Scala, polymorphism, subtyping, type inference},
     contributer	= {a3moss@uwaterloo.ca},
     author	= {Pierce, Benjamin C. and Turner, David N.},
@@ -4469,12 +4570,22 @@
     issn	= {0164-0925},
     pages	= {1--44},
-    numpages	= {44},
-    url		= {http://doi.acm.org/10.1145/345099.345100},
-    doi		= {10.1145/345099.345100},
-    acmid	= {345100},
     publisher	= {ACM},
     address	= {New York, NY, USA},
-    keywords	= {polymorphism, subtyping, type inference},
 } 
+
+@article{Dice15,
+    keywords	= {Concurrency, NUMA, hierarchical locks, locks, multicore, mutex, mutual exclusion, spin locks},
+    author	= {Dice, David and Marathe, Virendra J. and Shavit, Nir},
+    title	= {Lock Cohorting: A General Technique for Designing NUMA Locks},
+    journal	= {ACM Trans. Parallel Comput.},
+    issue_date	= {January 2015},
+    volume	= 1,
+    number	= 2,
+    month	= feb,
+    year	= 2015,
+    pages	= {13:1--13:42},
+    publisher	= {ACM},
+    address	= {New York, NY, USA},
+}
 
 @article{Sundell08,
@@ -4554,5 +4665,8 @@
     journal	= sigplan,
     year	= 1989,
-    month	= jun, volume = 24, number = 6, pages = {37-48},
+    month	= jun,
+    volume	= 24,
+    number	= 6,
+    pages	= {37-48},
     abstract	= {
         This paper describes a scheme we have used to manage a large
@@ -4995,5 +5109,4 @@
     year	= 1986,
     pages	= {313--326},
-    numpages	= {14},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -5011,5 +5124,4 @@
     year	= 1986,
     pages	= {327--348},
-    numpages	= {22},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -5208,5 +5320,4 @@
     year	= 2005,
     pages	= {146-196},
-    numpages	= {51},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -5354,5 +5465,5 @@
     year	= 2000,
     pages	= {29-46},
-    note	= {OOPSLA'00, Oct. 15--19, 2000, Minneapolis, Minnesota, U.S.A.},
+    note	= {OOPSLA'00, Oct. 15--19, 2000, Minneapolis, Minn., U.S.A.},
 }
 
@@ -5468,8 +5579,4 @@
     location	= {San Diego, California, USA},
     pages	= {101--112},
-    numpages	= {12},
-    url		= {http://doi.acm.org/10.1145/2535838.2535878},
-    doi		= {10.1145/2535838.2535878},
-    acmid	= {2535878},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -5575,7 +5682,4 @@
     issn	= {0362-1340},
     pages	= {30--42},
-    numpages	= {13},
-    url		= {http://doi.acm.org/10.1145/947586.947589},
-    doi		= {10.1145/947586.947589},
     publisher	= {ACM},
     address	= {New York, NY, USA}
@@ -6112,4 +6216,18 @@
     month	= 9,
     year	= 2005,
+}
+
+@article{Bauer15,
+    keywords	= {resumption exceptions, theory},
+    contributer	= {pabuhr@plg},
+    author	= {Andrej Bauer and Matija Pretnar},
+    title	= {Programming with Algebraic Effects and Handlers},
+    journal	= {Journal of Logical and Algebraic Methods in Programming},
+    publisher	= {Elsevier BV},
+    volume	= 84,
+    number	= 1,
+    month	= jan,
+    year	= 2015,
+    pages	= {108-123},
 }
 
@@ -6499,7 +6617,4 @@
     issn	= {0164-0925},
     pages	= {429-475},
-    url		= {http://doi.acm.org/10.1145/1133651.1133653},
-    doi		= {10.1145/1133651.1133653},
-    acmid	= {1133653},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -6879,8 +6994,4 @@
     issn	= {0001-0782},
     pages	= {565--569},
-    numpages	= {5},
-    url		= {http://doi.acm.org/10.1145/359545.359566},
-    doi		= {10.1145/359545.359566},
-    acmid	= {359566},
     publisher	= {ACM},
     address	= {New York, NY, USA}
@@ -6900,8 +7011,4 @@
     issn	= {0362-1340},
     pages	= {145--147},
-    numpages	= {3},
-    url		= {http://doi.acm.org/10.1145/122598.122614},
-    doi		= {10.1145/122598.122614},
-    acmid	= {122614},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -7006,7 +7113,4 @@
     issn	= {0362-1340},
     pages	= {82--87},
-    numpages	= {6},
-    url		= {http://doi.acm.org/10.1145/947680.947688},
-    doi		= {10.1145/947680.947688},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -7153,4 +7257,17 @@
 }
 
+@article{Cascaval08,
+    author	= {Cascaval, Calin and Blundell, Colin and Michael, Maged and Cain, Harold W. and Wu, Peng and Chiras, Stefanie and Chatterjee, Siddhartha},
+    title	= {Software Transactional Memory: Why Is It Only a Research Toy?},
+    journal	= {Queue},
+    volume	= {6},
+    number	= {5},
+    month	= sep,
+    year	= {2008},
+    pages	= {40:46--40:58},
+    publisher	= {ACM},
+    address	= {New York, NY, USA},
+}
+
 @article{Dijkstra65a,
     keywords	= {N-thread software-solution mutual exclusion},
@@ -7363,6 +7480,4 @@
     year	= 1974,
     pages	= {261-301},
-    issn	= {0360-0300},
-    doi		= {http://doi.acm.org/10.1145/356635.356640},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -7454,5 +7569,4 @@
     publisher	= {ACM Press},
     address	= {New York, NY, USA},
-    doi		= {http://doi.acm.org/10.1145/356586.356588},
 }
 
@@ -7755,5 +7869,16 @@
     howpublished= {\href{https://projects.eclipse.org/proposals/trace-compass}{https://\-projects.eclipse.org/\-proposals/\-trace-compass}},
 }
- 
+
+@inproceedings{Boehm09,
+    author	= {Boehm, Hans-J.},
+    title	= {Transactional Memory Should Be an Implementation Technique, Not a Programming Interface},
+    booktitle	= {Proceedings of the First USENIX Conference on Hot Topics in Parallelism},
+    series	= {HotPar'09},
+    year	= {2009},
+    location	= {Berkeley, California},
+    publisher	= {USENIX Association},
+    address	= {Berkeley, CA, USA},
+} 
+
 @article{Leroy00,
     keywords	= {type-systems, exceptions},
@@ -7805,5 +7930,6 @@
     number	= {2},
     pages	= {204-214},
-    month	= apr, year = 1988,
+    month	= apr,
+    year	= 1988,
     comment	= {
     	Extended record types add fields to their base record.  Assignment
@@ -8110,8 +8236,4 @@
     issn	= {0004-5411},
     pages	= {245--281},
-    numpages	= {37},
-    url		= {http://doi.acm.org/10.1145/62.2160},
-    doi		= {10.1145/62.2160},
-    acmid	= {2160},
     publisher	= {ACM},
     address	= {New York, NY, USA},
@@ -8126,5 +8248,5 @@
     contributer	= {pabuhr@plg},
     author	= {Boehm, Hans-J. and Adve, Sarita V.},
-    title	= {You Don'T Know Jack About Shared Variables or Memory Models},
+    title	= {You Don't Know Jack About Shared Variables or Memory Models},
     journal	= cacm,
     volume	= 55,
Index: doc/papers/concurrency/Paper.tex
===================================================================
--- doc/papers/concurrency/Paper.tex	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/Paper.tex	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -61,5 +61,5 @@
 \newcommand{\CCseventeen}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}17\xspace} % C++17 symbolic name
 \newcommand{\CCtwenty}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}20\xspace} % C++20 symbolic name
-\newcommand{\Csharp}{C\raisebox{-0.7ex}{\Large$^\sharp$}\xspace} % C# symbolic name
+\newcommand{\Csharp}{C\raisebox{-0.7ex}{\large$^\sharp$}\xspace} % C# symbolic name
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -127,11 +127,11 @@
 \newcommand*{\etc}{%
 	\@ifnextchar{.}{\ETC}%
-        {\ETC.\xspace}%
+		{\ETC.\xspace}%
 }}{}%
 \@ifundefined{etal}{
 \newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}}
 \newcommand*{\etal}{%
-	\@ifnextchar{.}{\protect\ETAL}%
-		{\protect\ETAL.\xspace}%
+	\@ifnextchar{.}{\ETAL}%
+		{\ETAL.\xspace}%
 }}{}%
 \@ifundefined{viz}{
@@ -163,10 +163,10 @@
 		__float80, float80, __float128, float128, forall, ftype, generator, _Generic, _Imaginary, __imag, __imag__,
 		inline, __inline, __inline__, __int128, int128, __label__, monitor, mutex, _Noreturn, one_t, or,
-		otype, restrict, __restrict, __restrict__, __signed, __signed__, _Static_assert, thread,
+		otype, restrict, resume, __restrict, __restrict__, __signed, __signed__, _Static_assert, suspend, thread,
 		_Thread_local, throw, throwResume, timeout, trait, try, ttype, typeof, __typeof, __typeof__,
 		virtual, __volatile, __volatile__, waitfor, when, with, zero_t},
 	moredirectives={defined,include_next},
 	% replace/adjust listing characters that look bad in sanserif
-	literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1
+	literate={-}{\makebox[1ex][c]{\raisebox{0.5ex}{\rule{0.8ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1
 		{~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 % {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
 		{<}{\textrm{\textless}}1 {>}{\textrm{\textgreater}}1
@@ -197,18 +197,4 @@
 		_Else, _Enable, _Event, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
 		_Resume, _Select, _SporadicTask, _Task, _Timeout, _When, _With, _Throw},
-}
-\lstdefinelanguage{Golang}{
-	morekeywords=[1]{package,import,func,type,struct,return,defer,panic,recover,select,var,const,iota,},
-	morekeywords=[2]{string,uint,uint8,uint16,uint32,uint64,int,int8,int16,int32,int64,
-		bool,float32,float64,complex64,complex128,byte,rune,uintptr, error,interface},
-	morekeywords=[3]{map,slice,make,new,nil,len,cap,copy,close,true,false,delete,append,real,imag,complex,chan,},
-	morekeywords=[4]{for,break,continue,range,goto,switch,case,fallthrough,if,else,default,},
-	morekeywords=[5]{Println,Printf,Error,},
-	sensitive=true,
-	morecomment=[l]{//},
-	morecomment=[s]{/*}{*/},
-	morestring=[b]',
-	morestring=[b]",
-	morestring=[s]{`}{`},
 }
 
@@ -241,5 +227,5 @@
 {}
 \lstnewenvironment{uC++}[1][]
-{\lstset{#1}}
+{\lstset{language=uC++,moredelim=**[is][\protect\color{red}]{`}{`},#1}\lstset{#1}}
 {}
 \lstnewenvironment{Go}[1][]
@@ -282,5 +268,5 @@
 \CFA is a polymorphic, non-object-oriented, concurrent, backwards-compatible extension of the C programming language.
 This paper discusses the design philosophy and implementation of its advanced control-flow and concurrent/parallel features, along with the supporting runtime written in \CFA.
-These features are created from scratch as ISO C has only low-level and/or unimplemented concurrency, so C programmers continue to rely on library features like pthreads.
+These features are created from scratch as ISO C has only low-level and/or unimplemented concurrency, so C programmers continue to rely on library approaches like pthreads.
 \CFA introduces modern language-level control-flow mechanisms, like generators, coroutines, user-level threading, and monitors for mutual exclusion and synchronization.
 % Library extension for executors, futures, and actors are built on these basic mechanisms.
@@ -295,5 +281,5 @@
 
 \begin{document}
-\linenumbers                                            % comment out to turn off line numbering
+\linenumbers				% comment out to turn off line numbering
 
 \maketitle
@@ -302,82 +288,239 @@
 \section{Introduction}
 
-This paper discusses the design philosophy and implementation of advanced language-level control-flow and concurrent/parallel features in \CFA~\cite{Moss18,Cforall} and its runtime, which is written entirely in \CFA.
-\CFA is a modern, polymorphic, non-object-oriented\footnote{
-\CFA has features often associated with object-oriented programming languages, such as constructors, destructors, virtuals and simple inheritance.
+\CFA~\cite{Moss18,Cforall} is a modern, polymorphic, non-object-oriented\footnote{
+\CFA has object-oriented features, such as constructors, destructors, virtuals and simple trait/interface inheritance.
+% Go interfaces, Rust traits, Swift Protocols, Haskell Type Classes and Java Interfaces.
+% "Trait inheritance" works for me. "Interface inheritance" might also be a good choice, and distinguish clearly from implementation inheritance.
+% You'll want to be a little bit careful with terms like "structural" and "nominal" inheritance as well. CFA has structural inheritance (I think Go as well) -- it's inferred based on the structure of the code. Java, Rust, and Haskell (not sure about Swift) have nominal inheritance, where there needs to be a specific statement that "this type inherits from this type".
 However, functions \emph{cannot} be nested in structures, so there is no lexical binding between a structure and set of functions (member/method) implemented by an implicit \lstinline@this@ (receiver) parameter.},
 backwards-compatible extension of the C programming language.
-In many ways, \CFA is to C as Scala~\cite{Scala} is to Java, providing a \emph{research vehicle} for new typing and control-flow capabilities on top of a highly popular programming language allowing immediate dissemination.
-Within the \CFA framework, new control-flow features are created from scratch because ISO \Celeven defines only a subset of the \CFA extensions, where the overlapping features are concurrency~\cite[\S~7.26]{C11}.
-However, \Celeven concurrency is largely wrappers for a subset of the pthreads library~\cite{Butenhof97,Pthreads}, and \Celeven and pthreads concurrency is simple, based on thread fork/join in a function and mutex/condition locks, which is low-level and error-prone;
-no high-level language concurrency features are defined.
-Interestingly, almost a decade after publication of the \Celeven standard, neither gcc-8, clang-9 nor msvc-19 (most recent versions) support the \Celeven include @threads.h@, indicating little interest in the C11 concurrency approach (possibly because the effort to add concurrency to \CC).
-Finally, while the \Celeven standard does not state a threading model, the historical association with pthreads suggests implementations would adopt kernel-level threading (1:1)~\cite{ThreadModel}.
-
+In many ways, \CFA is to C as Scala~\cite{Scala} is to Java, providing a \emph{research vehicle} for new typing and control-flow capabilities on top of a highly popular programming language\footnote{
+The TIOBE index~\cite{TIOBE} for December 2019 ranks the top five \emph{popular} programming languages as Java 17\%, C 16\%, Python 10\%, and \CC 6\%, \Csharp 5\% = 54\%, and over the past 30 years, C has always ranked either first or second in popularity.}
+allowing immediate dissemination.
+This paper discusses the design philosophy and implementation of advanced language-level control-flow and concurrent/parallel features in \CFA and its runtime, which is written entirely in \CFA.
+The \CFA control-flow framework extends ISO \Celeven~\cite{C11} with new call/return and concurrent/parallel control-flow.
+
+% The call/return extensions retain state between callee and caller versus losing the callee's state on return;
+% the concurrency extensions allow high-level management of threads.
+
+Call/return control-flow with argument/parameter passing appeared in the first programming languages.
+Over the past 50 years, call/return has been augmented with features like static/dynamic call, exceptions (multi-level return) and generators/coroutines (retain state between calls).
+While \CFA has mechanisms for dynamic call (algebraic effects) and exceptions\footnote{
+\CFA exception handling will be presented in a separate paper.
+The key feature that dovetails with this paper is nonlocal exceptions allowing exceptions to be raised across stacks, with synchronous exceptions raised among coroutines and asynchronous exceptions raised among threads, similar to that in \uC~\cite[\S~5]{uC++}}, this work only discusses retaining state between calls via generators/coroutines.
+\newterm{Coroutining} was introduced by Conway~\cite{Conway63} (1963), discussed by Knuth~\cite[\S~1.4.2]{Knuth73V1}, implemented in Simula67~\cite{Simula67}, formalized by Marlin~\cite{Marlin80}, and is now popular and appears in old and new programming languages: CLU~\cite{CLU}, \Csharp~\cite{Csharp}, Ruby~\cite{Ruby}, Python~\cite{Python}, JavaScript~\cite{JavaScript}, Lua~\cite{Lua}, \CCtwenty~\cite{C++20Coroutine19}.
+Coroutining is sequential execution requiring direct handoff among coroutines, \ie only the programmer is controlling execution order.
+If coroutines transfer to an internal event-engine for scheduling the next coroutines, the program transitions into the realm of concurrency~\cite[\S~3]{Buhr05a}.
+Coroutines are only a stepping stone towards concurrency where the commonality is that coroutines and threads retain state between calls.
+
+\Celeven/\CCeleven define concurrency~\cite[\S~7.26]{C11}, but it is largely wrappers for a subset of the pthreads library~\cite{Pthreads}.\footnote{Pthreads concurrency is based on simple thread fork/join in a function and mutex/condition locks, which is low-level and error-prone}
+Interestingly, almost a decade after the \Celeven standard, neither gcc-9, clang-9 nor msvc-19 (most recent versions) support the \Celeven include @threads.h@, indicating no interest in the C11 concurrency approach (possibly because of the recent effort to add concurrency to \CC).
+While the \Celeven standard does not state a threading model, the historical association with pthreads suggests implementations would adopt kernel-level threading (1:1)~\cite{ThreadModel}, as for \CC.
 In contrast, there has been a renewed interest during the past decade in user-level (M:N, green) threading in old and new programming languages.
 As multi-core hardware became available in the 1980/90s, both user and kernel threading were examined.
 Kernel threading was chosen, largely because of its simplicity and fit with the simpler operating systems and hardware architectures at the time, which gave it a performance advantage~\cite{Drepper03}.
 Libraries like pthreads were developed for C, and the Solaris operating-system switched from user (JDK 1.1~\cite{JDK1.1}) to kernel threads.
-As a result, languages like Java, Scala, Objective-C~\cite{obj-c-book}, \CCeleven~\cite{C11}, and C\#~\cite{Csharp} adopt the 1:1 kernel-threading model, with a variety of presentation mechanisms.
-From 2000 onwards, languages like Go~\cite{Go}, Erlang~\cite{Erlang}, Haskell~\cite{Haskell}, D~\cite{D}, and \uC~\cite{uC++,uC++book} have championed the M:N user-threading model, and many user-threading libraries have appeared~\cite{Qthreads,MPC,Marcel}, including putting green threads back into Java~\cite{Quasar}.
-The main argument for user-level threading is that it is lighter weight than kernel threading (locking and context switching do not cross the kernel boundary), so there is less restriction on programming styles that encourage large numbers of threads performing medium work units to facilitate load balancing by the runtime~\cite{Verch12}.
+As a result, many current languages implementations adopt the 1:1 kernel-threading model, like Java (Scala), Objective-C~\cite{obj-c-book}, \CCeleven~\cite{C11}, C\#~\cite{Csharp} and Rust~\cite{Rust}, with a variety of presentation mechanisms.
+From 2000 onwards, several language implementations have championed the M:N user-threading model, like Go~\cite{Go}, Erlang~\cite{Erlang}, Haskell~\cite{Haskell}, D~\cite{D}, and \uC~\cite{uC++,uC++book}, including putting green threads back into Java~\cite{Quasar}, and many user-threading libraries have appeared~\cite{Qthreads,MPC,Marcel}.
+The main argument for user-level threading is that it is lighter weight than kernel threading (locking and context switching do not cross the kernel boundary), so there is less restriction on programming styles that encourages large numbers of threads performing medium-sized work to facilitate load balancing by the runtime~\cite{Verch12}.
 As well, user-threading facilitates a simpler concurrency approach using thread objects that leverage sequential patterns versus events with call-backs~\cite{Adya02,vonBehren03}.
 Finally, performant user-threading implementations (both time and space) meet or exceed direct kernel-threading implementations, while achieving the programming advantages of high concurrency levels and safety.
 
-A further effort over the past two decades is the development of language memory models to deal with the conflict between language features and compiler/hardware optimizations, \ie some language features are unsafe in the presence of aggressive sequential optimizations~\cite{Buhr95a,Boehm05}.
+A further effort over the past two decades is the development of language memory models to deal with the conflict between language features and compiler/hardware optimizations, \eg some language features are unsafe in the presence of aggressive sequential optimizations~\cite{Buhr95a,Boehm05}.
 The consequence is that a language must provide sufficient tools to program around safety issues, as inline and library code is all sequential to the compiler.
 One solution is low-level qualifiers and functions (\eg @volatile@ and atomics) allowing \emph{programmers} to explicitly write safe (race-free~\cite{Boehm12}) programs.
-A safer solution is high-level language constructs so the \emph{compiler} knows the optimization boundaries, and hence, provides implicit safety.
-This problem is best known with respect to concurrency, but applies to other complex control-flow, like exceptions\footnote{
-\CFA exception handling will be presented in a separate paper.
-The key feature that dovetails with this paper is nonlocal exceptions allowing exceptions to be raised across stacks, with synchronous exceptions raised among coroutines and asynchronous exceptions raised among threads, similar to that in \uC~\cite[\S~5]{uC++}
-} and coroutines.
-Finally, language solutions allow matching constructs with language paradigm, \ie imperative and functional languages often have different presentations of the same concept to fit their programming model.
-
-Finally, it is important for a language to provide safety over performance \emph{as the default}, allowing careful reduction of safety for performance when necessary.
-Two concurrency violations of this philosophy are \emph{spurious wakeup} (random wakeup~\cite[\S~8]{Buhr05a}) and \emph{barging}\footnote{
-The notion of competitive succession instead of direct handoff, \ie a lock owner releases the lock and an arriving thread acquires it ahead of preexisting waiter threads.
+A safer solution is high-level language constructs so the \emph{compiler} knows the concurrency boundaries (where mutual exclusion and synchronization are acquired/released) and provide implicit safety at and across these boundaries.
+While the optimization problem is best known with respect to concurrency, it applies to other complex control-flow, like exceptions and coroutines.
+As well, language solutions allow matching the language paradigm with the approach, \eg matching the functional paradigm with data-flow programming or the imperative paradigm with thread programming.
+
+Finally, it is important for a language to provide safety over performance \emph{as the default}, allowing careful reduction of safety (unsafe code) for performance when necessary.
+Two concurrency violations of this philosophy are \emph{spurious wakeup} (random wakeup~\cite[\S~9]{Buhr05a}) and \emph{barging}\footnote{
+Barging is competitive succession instead of direct handoff, \ie after a lock is released both arriving and preexisting waiter threads compete to acquire the lock.
+Hence, an arriving thread can temporally \emph{barge} ahead of threads already waiting for an event, which can repeat indefinitely leading to starvation of waiter threads.
 } (signals-as-hints~\cite[\S~8]{Buhr05a}), where one is a consequence of the other, \ie once there is spurious wakeup, signals-as-hints follow.
-However, spurious wakeup is \emph{not} a foundational concurrency property~\cite[\S~8]{Buhr05a}, it is a performance design choice.
-Similarly, signals-as-hints are often a performance decision.
-We argue removing spurious wakeup and signals-as-hints make concurrent programming significantly safer because it removes local non-determinism and matches with programmer expectation.
-(Author experience teaching concurrency is that students are highly confused by these semantics.)
-Clawing back performance, when local non-determinism is unimportant, should be an option not the default.
-
-\begin{comment}
-Most augmented traditional (Fortran 18~\cite{Fortran18}, Cobol 14~\cite{Cobol14}, Ada 12~\cite{Ada12}, Java 11~\cite{Java11}) and new languages (Go~\cite{Go}, Rust~\cite{Rust}, and D~\cite{D}), except \CC, diverge from C with different syntax and semantics, only interoperate indirectly with C, and are not systems languages, for those with managed memory.
-As a result, there is a significant learning curve to move to these languages, and C legacy-code must be rewritten.
-While \CC, like \CFA, takes an evolutionary approach to extend C, \CC's constantly growing complex and interdependent features-set (\eg objects, inheritance, templates, etc.) mean idiomatic \CC code is difficult to use from C, and C programmers must expend significant effort learning \CC.
-Hence, rewriting and retraining costs for these languages, even \CC, are prohibitive for companies with a large C software-base.
-\CFA with its orthogonal feature-set, its high-performance runtime, and direct access to all existing C libraries circumvents these problems.
-\end{comment}
-
-\CFA embraces user-level threading, language extensions for advanced control-flow, and safety as the default.
-We present comparative examples so the reader can judge if the \CFA control-flow extensions are better and safer than those in other concurrent, imperative programming languages, and perform experiments to show the \CFA runtime is competitive with other similar mechanisms.
+(Author experience teaching concurrency is that students are confused by these semantics.)
+However, spurious wakeup is \emph{not} a foundational concurrency property~\cite[\S~9]{Buhr05a};
+it is a performance design choice.
+We argue removing spurious wakeup and signals-as-hints make concurrent programming simpler and safer as there is less local non-determinism to manage.
+If barging acquisition is allowed, its specialized performance advantage should be available as an option not the default.
+
+\CFA embraces language extensions for advanced control-flow, user-level threading, and safety as the default.
+We present comparative examples to support our argument that the \CFA control-flow extensions are as expressive and safe as those in other concurrent imperative programming languages, and perform experiments to show the \CFA runtime is competitive with other similar mechanisms.
 The main contributions of this work are:
-\begin{itemize}[topsep=3pt,itemsep=1pt]
+\begin{itemize}[topsep=3pt,itemsep=0pt]
 \item
-language-level generators, coroutines and user-level threading, which respect the expectations of C programmers.
+a set of fundamental execution properties that dictate which language-level control-flow features need to be supported,
+
 \item
-monitor synchronization without barging, and the ability to safely acquiring multiple monitors \emph{simultaneously} (deadlock free), while seamlessly integrating these capabilities with all monitor synchronization mechanisms.
+integration of these language-level control-flow features, while respecting the style and expectations of C programmers,
+
 \item
-providing statically type-safe interfaces that integrate with the \CFA polymorphic type-system and other language features.
+monitor synchronization without barging, and the ability to safely acquiring multiple monitors \emph{simultaneously} (deadlock free), while seamlessly integrating these capabilities with all monitor synchronization mechanisms,
+
+\item
+providing statically type-safe interfaces that integrate with the \CFA polymorphic type-system and other language features,
+
 % \item
 % library extensions for executors, futures, and actors built on the basic mechanisms.
+
 \item
-a runtime system with no spurious wakeup.
+a runtime system without spurious wake-up and no performance loss,
+
 \item
-a dynamic partitioning mechanism to segregate the execution environment for specialized requirements.
+a dynamic partitioning mechanism to segregate groups of executing user and kernel threads performing specialized work (\eg web-server or compute engine) or requiring different scheduling (\eg NUMA or real-time).
+
 % \item
 % a non-blocking I/O library
+
 \item
-experimental results showing comparable performance of the new features with similar mechanisms in other programming languages.
+experimental results showing comparable performance of the \CFA features with similar mechanisms in other languages.
 \end{itemize}
 
-Section~\ref{s:StatefulFunction} begins advanced control by introducing sequential functions that retain data and execution state between calls, which produces constructs @generator@ and @coroutine@.
-Section~\ref{s:Concurrency} begins concurrency, or how to create (fork) and destroy (join) a thread, which produces the @thread@ construct.
+Section~\ref{s:FundamentalExecutionProperties} presents the compositional hierarchy of execution properties directing the design of control-flow features in \CFA.
+Section~\ref{s:StatefulFunction} begins advanced control by introducing sequential functions that retain data and execution state between calls producing constructs @generator@ and @coroutine@.
+Section~\ref{s:Concurrency} begins concurrency, or how to create (fork) and destroy (join) a thread producing the @thread@ construct.
 Section~\ref{s:MutualExclusionSynchronization} discusses the two mechanisms to restricted nondeterminism when controlling shared access to resources (mutual exclusion) and timing relationships among threads (synchronization).
 Section~\ref{s:Monitor} shows how both mutual exclusion and synchronization are safely embedded in the @monitor@ and @thread@ constructs.
 Section~\ref{s:CFARuntimeStructure} describes the large-scale mechanism to structure (cluster) threads and virtual processors (kernel threads).
-Section~\ref{s:Performance} uses a series of microbenchmarks to compare \CFA threading with pthreads, Java OpenJDK-9, Go 1.12.6 and \uC 7.0.0.
+Section~\ref{s:Performance} uses a series of microbenchmarks to compare \CFA threading with pthreads, Java 11.0.6, Go 1.12.6, Rust 1.37.0, Python 3.7.6, Node.js 12.14.1, and \uC 7.0.0.
+
+
+\section{Fundamental Execution Properties}
+\label{s:FundamentalExecutionProperties}
+
+The features in a programming language should be composed from a set of fundamental properties rather than an ad hoc collection chosen by the designers.
+To this end, the control-flow features created for \CFA are based on the fundamental properties of any language with function-stack control-flow (see also \uC~\cite[pp.~140-142]{uC++}).
+The fundamental properties are execution state, thread, and mutual-exclusion/synchronization (MES).
+These independent properties can be used alone, in pairs, or in triplets to compose different language features, forming a compositional hierarchy where the most advanced feature has all the properties (state/thread/MES).
+While it is possible for a language to only support the most advanced feature~\cite{Hermes90}, this unnecessarily complicates and makes inefficient solutions to certain classes of problems.
+As is shown, each of the (non-rejected) composed features solves a particular set of problems, and hence, has a defensible position in a programming language.
+If a compositional feature is missing, a programmer has too few/many fundamental properties resulting in a complex and/or is inefficient solution.
+
+In detail, the fundamental properties are:
+\begin{description}[leftmargin=\parindent,topsep=3pt,parsep=0pt]
+\item[\newterm{execution state}:]
+is the state information needed by a control-flow feature to initialize, manage compute data and execution location(s), and de-initialize.
+State is retained in fixed-sized aggregate structures and dynamic-sized stack(s), often allocated in the heap(s) managed by the runtime system.
+The lifetime of the state varies with the control-flow feature, where longer life-time and dynamic size provide greater power but also increase usage complexity and cost.
+Control-flow transfers among execution states occurs in multiple ways, such as function call, context switch, asynchronous await, etc.
+Because the programming language determines what constitutes an execution state, implicitly manages this state, and defines movement mechanisms among states, execution state is an elementary property of the semantics of a programming language.
+% An execution-state is related to the notion of a process continuation \cite{Hieb90}.
+
+\item[\newterm{threading}:]
+is execution of code that occurs independently of other execution, \ie the execution resulting from a thread is sequential.
+Multiple threads provide \emph{concurrent execution};
+concurrent execution becomes parallel when run on multiple processing units (hyper-threading, cores, sockets).
+There must be language mechanisms to create, block/unblock, and join with a thread.
+
+\item[\newterm{MES}:]
+is the concurrency mechanisms to perform an action without interruption and establish timing relationships among multiple threads.
+These two properties are independent, \ie mutual exclusion cannot provide synchronization and vice versa without introducing additional threads~\cite[\S~4]{Buhr05a}.
+Limiting MES, \eg no access to shared data, results in contrived solutions and inefficiency on multi-core von Neumann computers where shared memory is a foundational aspect of its design.
+\end{description}
+These properties are fundamental because they cannot be built from existing language features, \eg a basic programming language like C99~\cite{C99} cannot create new control-flow features, concurrency, or provide MES using atomic hardware mechanisms.
+
+
+\subsection{Execution Properties}
+
+Table~\ref{t:ExecutionPropertyComposition} shows how the three fundamental execution properties: state, thread, and mutual exclusion compose a hierarchy of control-flow features needed in a programming language.
+(When doing case analysis, not all combinations are meaningful.)
+Note, basic von Neumann execution requires at least one thread and an execution state providing some form of call stack.
+For table entries missing these minimal components, the property is borrowed from the invoker (caller).
+
+Case 1 is a function that borrows storage for its state (stack frame/activation) and a thread from its invoker and retains this state across \emph{callees}, \ie function local-variables are retained on the stack across calls.
+Case 2 is case 1 with access to shared state so callers are restricted during update (mutual exclusion) and scheduling for other threads (synchronization).
+Case 3 is a stateful function supporting resume/suspend along with call/return to retain state across \emph{callers}, but has some restrictions because the function's state is stackless.
+Note, stackless functions still borrow the caller's stack and thread, where the stack is used to preserve state across its callees.
+Case 4 is cases 2 and 3 with protection to shared state for stackless functions.
+Cases 5 and 6 are the same as 3 and 4 but only the thread is borrowed as the function state is stackful, so resume/suspend is a context switch from the caller's to the function's stack.
+Cases 7 and 8 are rejected because a function that is given a new thread must have its own stack where the thread begins and stack frames are stored for calls, \ie there is no stack to borrow.
+Cases 9 and 10 are rejected because a thread with a fixed state (no stack) cannot accept calls, make calls, block, or be preempted, all of which require an unknown amount of additional dynamic state.
+Hence, once started, this kind of thread must execute to completion, \ie computation only, which severely restricts runtime management.
+Cases 11 and 12 have a stackful thread with and without safe access to shared state.
+Execution properties increase the cost of creation and execution along with complexity of usage.
+
+\begin{table}
+\caption{Execution property composition}
+\centering
+\label{t:ExecutionPropertyComposition}
+\renewcommand{\arraystretch}{1.25}
+%\setlength{\tabcolsep}{5pt}
+\begin{tabular}{c|c||l|l}
+\multicolumn{2}{c||}{execution properties} & \multicolumn{2}{c}{mutual exclusion / synchronization} \\
+\hline
+stateful			& thread	& \multicolumn{1}{c|}{No} & \multicolumn{1}{c}{Yes} \\
+\hline    
+\hline    
+No					& No		& \textbf{1}\ \ \ function				& \textbf{2}\ \ \ @monitor@ function	\\
+\hline    
+Yes (stackless)		& No		& \textbf{3}\ \ \ @generator@			& \textbf{4}\ \ \ @monitor@ @generator@	\\
+\hline    
+Yes (stackful)		& No		& \textbf{5}\ \ \ @coroutine@			& \textbf{6}\ \ \ @monitor@ @coroutine@	\\
+\hline    
+No					& Yes		& \textbf{7}\ \ \ {\color{red}rejected}	& \textbf{8}\ \ \ {\color{red}rejected}	\\
+\hline    
+Yes (stackless)		& Yes		& \textbf{9}\ \ \ {\color{red}rejected}	& \textbf{10}\ \ \ {\color{red}rejected} \\
+\hline    
+Yes (stackful)		& Yes		& \textbf{11}\ \ \ @thread@				& \textbf{12}\ \ @monitor@ @thread@		\\
+\end{tabular}
+\end{table}
+
+Given the execution-properties taxonomy, programmers can now answer three basic questions: is state necessary across calls and how much, is a separate thread necessary, is access to shared state necessary.
+The answers define the optimal language feature need for implementing a programming problem.
+The next sections discusses how \CFA fills in the table with language features, while other programming languages may only provide a subset of the table.
+
+
+\subsection{Design Requirements}
+
+The following design requirements largely stem from building \CFA on top of C.
+\begin{itemize}[topsep=3pt,parsep=0pt]
+\item
+All communication must be statically type checkable for early detection of errors and efficient code generation.
+This requirement is consistent with the fact that C is a statically-typed programming-language.
+
+\item
+Direct interaction among language features must be possible allowing any feature to be selected without restricting comm\-unication.
+For example, many concurrent languages do not provide direct communication (calls) among threads, \ie threads only communicate indirectly through monitors, channels, messages, and/or futures.
+Indirect communication increases the number of objects, consuming more resources, and require additional synchronization and possibly data transfer.
+
+\item
+All communication is performed using function calls, \ie data is transmitted from argument to parameter and results are returned from function calls.
+Alternative forms of communication, such as call-backs, message passing, channels, or communication ports, step outside of C's normal form of communication.
+
+\item
+All stateful features must follow the same declaration scopes and lifetimes as other language data.
+For C that means at program startup, during block and function activation, and on demand using dynamic allocation.
+
+\item
+MES must be available implicitly in language constructs as well as explicitly for specialized requirements, because requiring programmers to build MES using low-level locks often leads to incorrect programs.
+Furthermore, reducing synchronization scope by encapsulating it within language constructs further reduces errors in concurrent programs.
+
+\item
+Both synchronous and asynchronous communication are needed.
+However, we believe the best way to provide asynchrony, such as call-buffering/chaining and/or returning futures~\cite{multilisp}, is building it from expressive synchronous features.
+
+\item
+Synchronization must be able to control the service order of requests including prioritizing selection from different kinds of outstanding requests, and postponing a request for an unspecified time while continuing to accept new requests.
+Otherwise, certain concurrency problems are difficult, e.g.\ web server, disk scheduling, and the amount of concurrency is inhibited~\cite{Gentleman81}.
+\end{itemize}
+We have satisfied these requirements in \CFA while maintaining backwards compatibility with the huge body of legacy C programs.
+% In contrast, other new programming languages must still access C programs (\eg operating-system service routines), but do so through fragile C interfaces.
+
+
+\subsection{Asynchronous Await / Call}
+
+Asynchronous await/call is a caller mechanism for structuring programs and/or increasing concurrency, where the caller (client) postpones an action into the future, which is subsequently executed by a callee (server).
+The caller detects the action's completion through a \newterm{future}/\newterm{promise}.
+The benefit is asynchronous caller execution with respect to the callee until future resolution.
+For single-threaded languages like JavaScript, an asynchronous call passes a callee action, which is queued in the event-engine, and continues execution with a promise.
+When the caller needs the promise to be fulfilled, it executes @await@.
+A promise-completion call-back can be part of the callee action or the caller is rescheduled;
+in either case, the call back is executed after the promise is fulfilled.
+While asynchronous calls generate new callee (server) events, we content this mechanism is insufficient for advanced control-flow mechanisms like generators or coroutines (which are discussed next).
+Specifically, control between caller and callee occurs indirectly through the event-engine precluding direct handoff and cycling among events, and requires complex resolution of a control promise and data.
+Note, @async-await@ is just syntactic-sugar over the event engine so it does not solve these deficiencies.
+For multi-threaded languages like Java, the asynchronous call queues a callee action with an executor (server), which subsequently executes the work by a thread in the executor thread-pool.
+The problem is when concurrent work-units need to interact and/or block as this effects the executor, \eg stops threads.
+While it is possible to extend this approach to support the necessary mechanisms, \eg message passing in Actors, we show monitors and threads provide an equally competitive approach that does not deviate from normal call communication and can be used to build asynchronous call, as is done in Java.
 
 
@@ -385,16 +528,79 @@
 \label{s:StatefulFunction}
 
-The stateful function is an old idea~\cite{Conway63,Marlin80} that is new again~\cite{C++20Coroutine19}, where execution is temporarily suspended and later resumed, \eg plugin, device driver, finite-state machine.
-Hence, a stateful function may not end when it returns to its caller, allowing it to be restarted with the data and execution location present at the point of suspension.
-This capability is accomplished by retaining a data/execution \emph{closure} between invocations.
-If the closure is fixed size, we call it a \emph{generator} (or \emph{stackless}), and its control flow is restricted, \eg suspending outside the generator is prohibited.
-If the closure is variable size, we call it a \emph{coroutine} (or \emph{stackful}), and as the names implies, often implemented with a separate stack with no programming restrictions.
-Hence, refactoring a stackless coroutine may require changing it to stackful.
-A foundational property of all \emph{stateful functions} is that resume/suspend \emph{do not} cause incremental stack growth, \ie resume/suspend operations are remembered through the closure not the stack.
-As well, activating a stateful function is \emph{asymmetric} or \emph{symmetric}, identified by resume/suspend (no cycles) and resume/resume (cycles).
-A fixed closure activated by modified call/return is faster than a variable closure activated by context switching.
-Additionally, any storage management for the closure (especially in unmanaged languages, \ie no garbage collection) must also be factored into design and performance.
-Therefore, selecting between stackless and stackful semantics is a tradeoff between programming requirements and performance, where stackless is faster and stackful is more general.
-Note, creation cost is amortized across usage, so activation cost is usually the dominant factor.
+A \emph{stateful function} has the ability to remember state between calls, where state can be either data or execution, \eg plugin, device driver, finite-state machine (FSM).
+A simple technique to retain data state between calls is @static@ declarations within a function, which is often implemented by hoisting the declarations to the global scope but hiding the names within the function using name mangling.
+However, each call starts the function at the top making it difficult to determine the last point of execution in an algorithm, and requiring multiple flag variables and testing to reestablish the continuation point.
+Hence, the next step of generalizing function state is implicitly remembering the return point between calls and reentering the function at this point rather than the top, called \emph{generators}\,/\,\emph{iterators} or \emph{stackless coroutines}.
+For example, a Fibonacci generator retains data and execution state allowing it to remember prior values needed to generate the next value and the location in the algorithm to compute that value.
+The next step of generalization is instantiating the function to allow multiple named instances, \eg multiple Fibonacci generators, where each instance has its own state, and hence, can generate an independent sequence of values.
+Note, a subset of generator state is a function \emph{closure}, \ie the technique of capturing lexical references when returning a nested function.
+A further generalization is adding a stack to a generator's state, called a \emph{coroutine}, so it can suspend outside of itself, \eg call helper functions to arbitrary depth before suspending back to its resumer without unwinding these calls.
+For example, a coroutine iterator for a binary tree can stop the traversal at the visit point (pre, infix, post traversal), return the node value to the caller, and then continue the recursive traversal from the current node on the next call.
+
+There are two styles of activating a stateful function, \emph{asymmetric} or \emph{symmetric}, identified by resume/suspend (no cycles) and resume/resume (cycles).
+These styles \emph{do not} cause incremental stack growth, \eg a million resume/suspend or resume/resume cycles do not remember each cycle just the last resumer for each cycle.
+Selecting between stackless/stackful semantics and asymmetric/symmetric style is a tradeoff between programming requirements, performance, and design, where stackless is faster and smaller (modified call/return between closures), stackful is more general but slower and larger (context switching between distinct stacks), and asymmetric is simpler control-flow than symmetric.
+Additionally, storage management for the closure/stack (especially in unmanaged languages, \ie no garbage collection) must be factored into design and performance.
+Note, creation cost (closure/stack) is amortized across usage, so activation cost (resume/suspend) is usually the dominant factor.
+
+% The stateful function is an old idea~\cite{Conway63,Marlin80} that is new again~\cite{C++20Coroutine19}, where execution is temporarily suspended and later resumed, \eg plugin, device driver, finite-state machine.
+% Hence, a stateful function may not end when it returns to its caller, allowing it to be restarted with the data and execution location present at the point of suspension.
+% If the closure is fixed size, we call it a \emph{generator} (or \emph{stackless}), and its control flow is restricted, \eg suspending outside the generator is prohibited.
+% If the closure is variable size, we call it a \emph{coroutine} (or \emph{stackful}), and as the names implies, often implemented with a separate stack with no programming restrictions.
+% Hence, refactoring a stackless coroutine may require changing it to stackful.
+% A foundational property of all \emph{stateful functions} is that resume/suspend \emph{do not} cause incremental stack growth, \ie resume/suspend operations are remembered through the closure not the stack.
+% As well, activating a stateful function is \emph{asymmetric} or \emph{symmetric}, identified by resume/suspend (no cycles) and resume/resume (cycles).
+% A fixed closure activated by modified call/return is faster than a variable closure activated by context switching.
+% Additionally, any storage management for the closure (especially in unmanaged languages, \ie no garbage collection) must also be factored into design and performance.
+% Therefore, selecting between stackless and stackful semantics is a tradeoff between programming requirements and performance, where stackless is faster and stackful is more general.
+% nppNote, creation cost is amortized across usage, so activation cost is usually the dominant factor.
+
+For example, Python presents asymmetric generators as a function object, \uC presents symmetric coroutines as a \lstinline[language=C++]|class|-like object, and many languages present threading using function pointers, @pthreads@~\cite{Butenhof97}, \Csharp~\cite{Csharp}, Go~\cite{Go}, and Scala~\cite{Scala}.
+\begin{center}
+\begin{tabular}{@{}l|l|l@{}}
+\multicolumn{1}{@{}c|}{Python asymmetric generator} & \multicolumn{1}{c|}{\uC symmetric coroutine} & \multicolumn{1}{c@{}}{Pthreads thread} \\
+\hline
+\begin{python}
+`def Gen():` $\LstCommentStyle{\color{red}// function}$
+	... yield val ...
+gen = Gen()
+for i in range( 10 ):
+	print( next( gen ) )
+\end{python}
+&
+\begin{uC++}
+`_Coroutine Cycle {` $\LstCommentStyle{\color{red}// class}$
+	Cycle * p;
+	void main() { p->cycle(); }
+	void cycle() { resume(); }  `};`
+Cycle c1, c2; c1.p=&c2; c2.p=&c1; c1.cycle();
+\end{uC++}
+&
+\begin{cfa}
+void * rtn( void * arg ) { ... }
+int i = 3, rc;
+pthread_t t; $\C{// thread id}$
+$\LstCommentStyle{\color{red}// function pointer}$
+rc=pthread_create(&t, `rtn`, (void *)i);
+\end{cfa}
+\end{tabular}
+\end{center}
+\CFA's preferred presentation model for generators/coroutines/threads is a hybrid of functions and classes, giving an object-oriented flavour.
+Essentially, the generator/coroutine/thread function is semantically coupled with a generator/coroutine/thread custom type via the type's name.
+The custom type solves several issues, while accessing the underlying mechanisms used by the custom types is still allowed for flexibility reasons.
+Each custom type is discussed in detail in the following sections.
+
+
+\subsection{Generator}
+
+Stackless generators (Table~\ref{t:ExecutionPropertyComposition} case 3) have the potential to be very small and fast, \ie as small and fast as function call/return for both creation and execution.
+The \CFA goal is to achieve this performance target, possibly at the cost of some semantic complexity.
+A series of different kinds of generators and their implementation demonstrate how this goal is accomplished.\footnote{
+The \CFA operator syntax uses \lstinline|?| to denote operands, which allows precise definitions for pre, post, and infix operators, \eg \lstinline|?++|, \lstinline|++?|, and \lstinline|?+?|, in addition \lstinline|?\{\}| denotes a constructor, as in \lstinline|foo `f` = `\{`...`\}`|, \lstinline|^?\{\}| denotes a destructor, and \lstinline|?()| is \CC function call \lstinline|operator()|.
+Operator \lstinline+|+ is overloaded for printing, like bit-shift \lstinline|<<| in \CC.
+The \CFA \lstinline|with| clause opens an aggregate scope making its fields directly accessible, like Pascal \lstinline|with|, but using parallel semantics;
+multiple aggregates may be opened.
+\CFA has rebindable references \lstinline|int i, & ip = i, j; `&ip = &j;`| and non-rebindable references \lstinline|int i, & `const` ip = i, j; `&ip = &j;` // disallowed|.
+}%
 
 \begin{figure}
@@ -410,8 +616,9 @@
 
 
+
+
 	int fn = f->fn; f->fn = f->fn1;
 		f->fn1 = f->fn + fn;
 	return fn;
-
 }
 int main() {
@@ -432,4 +639,5 @@
 void `main(Fib & fib)` with(fib) {
 
+
 	[fn1, fn] = [1, 0];
 	for () {
@@ -451,14 +659,15 @@
 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
 typedef struct {
-	int fn1, fn;  void * `next`;
+	int `restart`, fn1, fn;
 } Fib;
-#define FibCtor { 1, 0, NULL }
+#define FibCtor { `0`, 1, 0 }
 Fib * comain( Fib * f ) {
-	if ( f->next ) goto *f->next;
-	f->next = &&s1;
+	`static void * states[] = {&&s0, &&s1};`
+	`goto *states[f->restart];`
+  s0: f->`restart` = 1;
 	for ( ;; ) {
 		return f;
 	  s1:; int fn = f->fn + f->fn1;
-			f->fn1 = f->fn; f->fn = fn;
+		f->fn1 = f->fn; f->fn = fn;
 	}
 }
@@ -472,13 +681,13 @@
 \end{lrbox}
 
-\subfloat[C asymmetric generator]{\label{f:CFibonacci}\usebox\myboxA}
+\subfloat[C]{\label{f:CFibonacci}\usebox\myboxA}
 \hspace{3pt}
 \vrule
 \hspace{3pt}
-\subfloat[\CFA asymmetric generator]{\label{f:CFAFibonacciGen}\usebox\myboxB}
+\subfloat[\CFA]{\label{f:CFAFibonacciGen}\usebox\myboxB}
 \hspace{3pt}
 \vrule
 \hspace{3pt}
-\subfloat[C generator implementation]{\label{f:CFibonacciSim}\usebox\myboxC}
+\subfloat[C generated code for \CFA version]{\label{f:CFibonacciSim}\usebox\myboxC}
 \caption{Fibonacci (output) asymmetric generator}
 \label{f:FibonacciAsymmetricGenerator}
@@ -493,5 +702,5 @@
 };
 void ?{}( Fmt & fmt ) { `resume(fmt);` } // constructor
-void ^?{}( Fmt & f ) with(f) { $\C[1.75in]{// destructor}$
+void ^?{}( Fmt & f ) with(f) { $\C[2.25in]{// destructor}$
 	if ( g != 0 || b != 0 ) sout | nl; }
 void `main( Fmt & f )` with(f) {
@@ -499,9 +708,9 @@
 		for ( ; g < 5; g += 1 ) { $\C{// groups}$
 			for ( ; b < 4; b += 1 ) { $\C{// blocks}$
-				`suspend;` $\C{// wait for character}$
-				while ( ch == '\n' ) `suspend;` // ignore
-				sout | ch;						// newline
-			} sout | " ";  // block spacer
-		} sout | nl; // group newline
+				do { `suspend;` $\C{// wait for character}$
+				while ( ch == '\n' ); // ignore newline
+				sout | ch;			$\C{// print character}$
+			} sout | " ";  $\C{// block separator}$
+		} sout | nl; $\C{// group separator}$
 	}
 }
@@ -521,16 +730,16 @@
 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
 typedef struct {
-	void * next;
+	int `restart`, g, b;
 	char ch;
-	int g, b;
 } Fmt;
 void comain( Fmt * f ) {
-	if ( f->next ) goto *f->next;
-	f->next = &&s1;
+	`static void * states[] = {&&s0, &&s1};`
+	`goto *states[f->restart];`
+  s0: f->`restart` = 1;
 	for ( ;; ) {
 		for ( f->g = 0; f->g < 5; f->g += 1 ) {
 			for ( f->b = 0; f->b < 4; f->b += 1 ) {
-				return;
-			  s1:;  while ( f->ch == '\n' ) return;
+				do { return;  s1: ;
+				} while ( f->ch == '\n' );
 				printf( "%c", f->ch );
 			} printf( " " );
@@ -539,5 +748,5 @@
 }
 int main() {
-	Fmt fmt = { NULL };  comain( &fmt ); // prime
+	Fmt fmt = { `0` };  comain( &fmt ); // prime
 	for ( ;; ) {
 		scanf( "%c", &fmt.ch );
@@ -550,9 +759,9 @@
 \end{lrbox}
 
-\subfloat[\CFA asymmetric generator]{\label{f:CFAFormatGen}\usebox\myboxA}
-\hspace{3pt}
+\subfloat[\CFA]{\label{f:CFAFormatGen}\usebox\myboxA}
+\hspace{35pt}
 \vrule
 \hspace{3pt}
-\subfloat[C generator simulation]{\label{f:CFormatSim}\usebox\myboxB}
+\subfloat[C generated code for \CFA version]{\label{f:CFormatGenImpl}\usebox\myboxB}
 \hspace{3pt}
 \caption{Formatter (input) asymmetric generator}
@@ -560,48 +769,5 @@
 \end{figure}
 
-Stateful functions appear as generators, coroutines, and threads, where presentations are based on function objects or pointers~\cite{Butenhof97, C++14, MS:VisualC++, BoostCoroutines15}.
-For example, Python presents generators as a function object:
-\begin{python}
-def Gen():
-	... `yield val` ...
-gen = Gen()
-for i in range( 10 ):
-	print( next( gen ) )
-\end{python}
-Boost presents coroutines in terms of four functor object-types:
-\begin{cfa}
-asymmetric_coroutine<>::pull_type
-asymmetric_coroutine<>::push_type
-symmetric_coroutine<>::call_type
-symmetric_coroutine<>::yield_type
-\end{cfa}
-and many languages present threading using function pointers, @pthreads@~\cite{Butenhof97}, \Csharp~\cite{Csharp}, Go~\cite{Go}, and Scala~\cite{Scala}, \eg pthreads:
-\begin{cfa}
-void * rtn( void * arg ) { ... }
-int i = 3, rc;
-pthread_t t; $\C{// thread id}$
-`rc = pthread_create( &t, rtn, (void *)i );` $\C{// create and initialized task, type-unsafe input parameter}$
-\end{cfa}
-% void mycor( pthread_t cid, void * arg ) {
-% 	int * value = (int *)arg;				$\C{// type unsafe, pointer-size only}$
-% 	// thread body
-% }
-% int main() {
-% 	int input = 0, output;
-% 	coroutine_t cid = coroutine_create( &mycor, (void *)&input ); $\C{// type unsafe, pointer-size only}$
-% 	coroutine_resume( cid, (void *)input, (void **)&output ); $\C{// type unsafe, pointer-size only}$
-% }
-\CFA's preferred presentation model for generators/coroutines/threads is a hybrid of objects and functions, with an object-oriented flavour.
-Essentially, the generator/coroutine/thread function is semantically coupled with a generator/coroutine/thread custom type.
-The custom type solves several issues, while accessing the underlying mechanisms used by the custom types is still allowed.
-
-
-\subsection{Generator}
-
-Stackless generators have the potential to be very small and fast, \ie as small and fast as function call/return for both creation and execution.
-The \CFA goal is to achieve this performance target, possibly at the cost of some semantic complexity.
-A series of different kinds of generators and their implementation demonstrate how this goal is accomplished.
-
-Figure~\ref{f:FibonacciAsymmetricGenerator} shows an unbounded asymmetric generator for an infinite sequence of Fibonacci numbers written in C and \CFA, with a simple C implementation for the \CFA version.
+Figure~\ref{f:FibonacciAsymmetricGenerator} shows an unbounded asymmetric generator for an infinite sequence of Fibonacci numbers written (left to right) in C, \CFA, and showing the underlying C implementation for the \CFA version.
 This generator is an \emph{output generator}, producing a new result on each resumption.
 To compute Fibonacci, the previous two values in the sequence are retained to generate the next value, \ie @fn1@ and @fn@, plus the execution location where control restarts when the generator is resumed, \ie top or middle.
@@ -611,12 +777,11 @@
 The C version only has the middle execution state because the top execution state is declaration initialization.
 Figure~\ref{f:CFAFibonacciGen} shows the \CFA approach, which also has a manual closure, but replaces the structure with a custom \CFA @generator@ type.
-This generator type is then connected to a function that \emph{must be named \lstinline|main|},\footnote{
-The name \lstinline|main| has special meaning in C, specifically the function where a program starts execution.
-Hence, overloading this name for other starting points (generator/coroutine/thread) is a logical extension.}
-called a \emph{generator main},which takes as its only parameter a reference to the generator type.
+Each generator type must have a function named \lstinline|main|,
+% \footnote{
+% The name \lstinline|main| has special meaning in C, specifically the function where a program starts execution.
+% Leveraging starting semantics to this name for generator/coroutine/thread is a logical extension.}
+called a \emph{generator main} (leveraging the starting semantics for program @main@ in C), which is connected to the generator type via its single reference parameter.
 The generator main contains @suspend@ statements that suspend execution without ending the generator versus @return@.
-For the Fibonacci generator-main,\footnote{
-The \CFA \lstinline|with| opens an aggregate scope making its fields directly accessible, like Pascal \lstinline|with|, but using parallel semantics.
-Multiple aggregates may be opened.}
+For the Fibonacci generator-main,
 the top initialization state appears at the start and the middle execution state is denoted by statement @suspend@.
 Any local variables in @main@ \emph{are not retained} between calls;
@@ -627,25 +792,89 @@
 Resuming an ended (returned) generator is undefined.
 Function @resume@ returns its argument generator so it can be cascaded in an expression, in this case to print the next Fibonacci value @fn@ computed in the generator instance.
-Figure~\ref{f:CFibonacciSim} shows the C implementation of the \CFA generator only needs one additional field, @next@, to handle retention of execution state.
-The computed @goto@ at the start of the generator main, which branches after the previous suspend, adds very little cost to the resume call.
-Finally, an explicit generator type provides both design and performance benefits, such as multiple type-safe interface functions taking and returning arbitrary types.\footnote{
-The \CFA operator syntax uses \lstinline|?| to denote operands, which allows precise definitions for pre, post, and infix operators, \eg \lstinline|++?|, \lstinline|?++|, and \lstinline|?+?|, in addition \lstinline|?\{\}| denotes a constructor, as in \lstinline|foo `f` = `\{`...`\}`|, \lstinline|^?\{\}| denotes a destructor, and \lstinline|?()| is \CC function call \lstinline|operator()|.
-}%
+Figure~\ref{f:CFibonacciSim} shows the C implementation of the \CFA asymmetric generator.
+Only one execution-state field, @restart@, is needed to subscript the suspension points in the generator.
+At the start of the generator main, the @static@ declaration, @states@, is initialized to the N suspend points in the generator (where operator @&&@ dereferences/references a label~\cite{gccValueLabels}).
+Next, the computed @goto@ selects the last suspend point and branches to it.
+The  cost of setting @restart@ and branching via the computed @goto@ adds very little cost to the suspend/resume calls.
+
+An advantage of the \CFA explicit generator type is the ability to allow multiple type-safe interface functions taking and returning arbitrary types.
 \begin{cfa}
 int ?()( Fib & fib ) { return `resume( fib )`.fn; } $\C[3.9in]{// function-call interface}$
-int ?()( Fib & fib, int N ) { for ( N - 1 ) `fib()`; return `fib()`; } $\C{// use function-call interface to skip N values}$
-double ?()( Fib & fib ) { return (int)`fib()` / 3.14159; } $\C{// different return type, cast prevents recursive call}\CRT$
-sout | (int)f1() | (double)f1() | f2( 2 ); // alternative interface, cast selects call based on return type, step 2 values
+int ?()( Fib & fib, int N ) { for ( N - 1 ) `fib()`; return `fib()`; } $\C{// add parameter to skip N values}$
+double ?()( Fib & fib ) { return (int)`fib()` / 3.14159; } $\C{// different return type, cast prevents recursive call}$
+Fib f;  int i;  double d;
+i = f();  i = f( 2 );  d = f();						$\C{// alternative interfaces}\CRT$
 \end{cfa}
 Now, the generator can be a separately compiled opaque-type only accessed through its interface functions.
 For contrast, Figure~\ref{f:PythonFibonacci} shows the equivalent Python Fibonacci generator, which does not use a generator type, and hence only has a single interface, but an implicit closure.
 
-Having to manually create the generator closure by moving local-state variables into the generator type is an additional programmer burden.
-(This restriction is removed by the coroutine in Section~\ref{s:Coroutine}.)
-This requirement follows from the generality of variable-size local-state, \eg local state with a variable-length array requires dynamic allocation because the array size is unknown at compile time.
+\begin{figure}
+%\centering
+\newbox\myboxA
+\begin{lrbox}{\myboxA}
+\begin{python}[aboveskip=0pt,belowskip=0pt]
+def Fib():
+	fn1, fn = 0, 1
+	while True:
+		`yield fn1`
+		fn1, fn = fn, fn1 + fn
+f1 = Fib()
+f2 = Fib()
+for i in range( 10 ):
+	print( next( f1 ), next( f2 ) )
+
+
+
+
+
+
+
+
+
+
+\end{python}
+\end{lrbox}
+
+\newbox\myboxB
+\begin{lrbox}{\myboxB}
+\begin{python}[aboveskip=0pt,belowskip=0pt]
+def Fmt():
+	try:
+		while True:						$\C[2.5in]{\# until destructor call}$
+			for g in range( 5 ):		$\C{\# groups}$
+				for b in range( 4 ):	$\C{\# blocks}$
+					while True:
+						ch = (yield)	$\C{\# receive from send}$
+						if '\n' not in ch: $\C{\# ignore newline}$
+							break
+					print( ch, end='' )	$\C{\# print character}$
+				print( '  ', end='' )	$\C{\# block separator}$
+			print()						$\C{\# group separator}$
+	except GeneratorExit:				$\C{\# destructor}$
+		if g != 0 | b != 0:				$\C{\# special case}$
+			print()
+fmt = Fmt()
+`next( fmt )`							$\C{\# prime, next prewritten}$
+for i in range( 41 ):
+	`fmt.send( 'a' );`					$\C{\# send to yield}$
+\end{python}
+\end{lrbox}
+
+\hspace{30pt}
+\subfloat[Fibonacci]{\label{f:PythonFibonacci}\usebox\myboxA}
+\hspace{3pt}
+\vrule
+\hspace{3pt}
+\subfloat[Formatter]{\label{f:PythonFormatter}\usebox\myboxB}
+\caption{Python generator}
+\label{f:PythonGenerator}
+\end{figure}
+
+Having to manually create the generator closure by moving local-state variables into the generator type is an additional programmer burden (removed by the coroutine in Section~\ref{s:Coroutine}).
+This manual requirement follows from the generality of allowing variable-size local-state, \eg local state with a variable-length array requires dynamic allocation as the array size is unknown at compile time.
 However, dynamic allocation significantly increases the cost of generator creation/destruction and is a showstopper for embedded real-time programming.
 But more importantly, the size of the generator type is tied to the local state in the generator main, which precludes separate compilation of the generator main, \ie a generator must be inlined or local state must be dynamically allocated.
-With respect to safety, we believe static analysis can discriminate local state from temporary variables in a generator, \ie variable usage spanning @suspend@, and generate a compile-time error.
-Finally, our current experience is that most generator problems have simple data state, including local state, but complex execution state, so the burden of creating the generator type is small.
+With respect to safety, we believe static analysis can discriminate persistent generator state from temporary generator-main state and raise a compile-time error for temporary usage spanning suspend points.
+Our experience using generators is that the problems have simple data state, including local state, but complex execution state, so the burden of creating the generator type is small.
 As well, C programmers are not afraid of this kind of semantic programming requirement, if it results in very small, fast generators.
 
@@ -669,79 +898,29 @@
 The example takes advantage of resuming a generator in the constructor to prime the loops so the first character sent for formatting appears inside the nested loops.
 The destructor provides a newline, if formatted text ends with a full line.
-Figure~\ref{f:CFormatSim} shows the C implementation of the \CFA input generator with one additional field and the computed @goto@.
-For contrast, Figure~\ref{f:PythonFormatter} shows the equivalent Python format generator with the same properties as the Fibonacci generator.
-
-Figure~\ref{f:DeviceDriverGen} shows a \emph{killer} asymmetric generator, a device-driver, because device drivers caused 70\%-85\% of failures in Windows/Linux~\cite{Swift05}.
-Device drives follow the pattern of simple data state but complex execution state, \ie finite state-machine (FSM) parsing a protocol.
-For example, the following protocol:
+Figure~\ref{f:CFormatGenImpl} shows the C implementation of the \CFA input generator with one additional field and the computed @goto@.
+For contrast, Figure~\ref{f:PythonFormatter} shows the equivalent Python format generator with the same properties as the format generator.
+
+% https://dl-acm-org.proxy.lib.uwaterloo.ca/
+
+Figure~\ref{f:DeviceDriverGen} shows an important application for an asymmetric generator, a device-driver, because device drivers are a significant source of operating-system errors: 85\% in Windows XP~\cite[p.~78]{Swift05} and 51.6\% in Linux~\cite[p.~1358,]{Xiao19}. %\cite{Palix11}
+Swift \etal~\cite[p.~86]{Swift05} restructure device drivers using the Extension Procedure Call (XPC) within the kernel via functions @nooks_driver_call@ and @nooks_kernel_call@, which have coroutine properties context switching to separate stacks with explicit hand-off calls;
+however, the calls do not retain execution state, and hence always start from the top.
+The alternative approach for implementing device drivers is using stack-ripping.
+However, Adya \etal~\cite{Adya02} argue against stack ripping in Section 3.2 and suggest a hybrid approach in Section 4 using cooperatively scheduled \emph{fibers}, which is coroutining.
+
+As an example, the following protocol:
 \begin{center}
 \ldots\, STX \ldots\, message \ldots\, ESC ETX \ldots\, message \ldots\, ETX 2-byte crc \ldots
 \end{center}
-is a network message beginning with the control character STX, ending with an ETX, and followed by a 2-byte cyclic-redundancy check.
+is for a simple network message beginning with the control character STX, ending with an ETX, and followed by a 2-byte cyclic-redundancy check.
 Control characters may appear in a message if preceded by an ESC.
 When a message byte arrives, it triggers an interrupt, and the operating system services the interrupt by calling the device driver with the byte read from a hardware register.
-The device driver returns a status code of its current state, and when a complete message is obtained, the operating system knows the message is in the message buffer.
-Hence, the device driver is an input/output generator.
-
-Note, the cost of creating and resuming the device-driver generator, @Driver@, is virtually identical to call/return, so performance in an operating-system kernel is excellent.
-As well, the data state is small, where variables @byte@ and @msg@ are communication variables for passing in message bytes and returning the message, and variables @lnth@, @crc@, and @sum@ are local variable that must be retained between calls and are manually hoisted into the generator type.
-% Manually, detecting and hoisting local-state variables is easy when the number is small.
-In contrast, the execution state is large, with one @resume@ and seven @suspend@s.
-Hence, the key benefits of the generator are correctness, safety, and maintenance because the execution states are transcribed directly into the programming language rather than using a table-driven approach.
-Because FSMs can be complex and frequently occur in important domains, direct generator support is important in a system programming language.
+The device driver returns a status code of its current state, and when a complete message is obtained, the operating system read the message accumulated in the supplied buffer.
+Hence, the device driver is an input/output generator, where the cost of resuming the device-driver generator is the same as call/return, so performance in an operating-system kernel is excellent.
+The key benefits of using a generator are correctness, safety, and maintenance because the execution states are transcribed directly into the programming language rather than table lookup or stack ripping.
+The conclusion is that FSMs are complex and occur in important domains, so direct generator support is important in a system programming language.
 
 \begin{figure}
 \centering
-\newbox\myboxA
-\begin{lrbox}{\myboxA}
-\begin{python}[aboveskip=0pt,belowskip=0pt]
-def Fib():
-	fn1, fn = 0, 1
-	while True:
-		`yield fn1`
-		fn1, fn = fn, fn1 + fn
-f1 = Fib()
-f2 = Fib()
-for i in range( 10 ):
-	print( next( f1 ), next( f2 ) )
-
-
-
-
-
-
-\end{python}
-\end{lrbox}
-
-\newbox\myboxB
-\begin{lrbox}{\myboxB}
-\begin{python}[aboveskip=0pt,belowskip=0pt]
-def Fmt():
-	try:
-		while True:
-			for g in range( 5 ):
-				for b in range( 4 ):
-					print( `(yield)`, end='' )
-				print( '  ', end='' )
-			print()
-	except GeneratorExit:
-		if g != 0 | b != 0:
-			print()
-fmt = Fmt()
-`next( fmt )`			 # prime, next prewritten
-for i in range( 41 ):
-	`fmt.send( 'a' );`	# send to yield
-\end{python}
-\end{lrbox}
-\subfloat[Fibonacci]{\label{f:PythonFibonacci}\usebox\myboxA}
-\hspace{3pt}
-\vrule
-\hspace{3pt}
-\subfloat[Formatter]{\label{f:PythonFormatter}\usebox\myboxB}
-\caption{Python generator}
-\label{f:PythonGenerator}
-
-\bigskip
-
 \begin{tabular}{@{}l|l@{}}
 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
@@ -750,7 +929,7 @@
 `generator` Driver {
 	Status status;
-	unsigned char byte, * msg; // communication
-	unsigned int lnth, sum;      // local state
-	unsigned short int crc;
+	char byte, * msg; // communication
+	int lnth, sum;      // local state
+	short int crc;
 };
 void ?{}( Driver & d, char * m ) { d.msg = m; }
@@ -800,24 +979,15 @@
 (The trivial cycle is a generator resuming itself.)
 This control flow is similar to recursion for functions but without stack growth.
-The steps for symmetric control-flow are creating, executing, and terminating the cycle.
+Figure~\ref{f:PingPongFullCoroutineSteps} shows the steps for symmetric control-flow are creating, executing, and terminating the cycle.
 Constructing the cycle must deal with definition-before-use to close the cycle, \ie, the first generator must know about the last generator, which is not within scope.
 (This issue occurs for any cyclic data structure.)
-% The example creates all the generators and then assigns the partners that form the cycle.
-% Alternatively, the constructor can assign the partners as they are declared, except the first, and the first-generator partner is set after the last generator declaration to close the cycle.
-Once the cycle is formed, the program main resumes one of the generators, and the generators can then traverse an arbitrary cycle using @resume@ to activate partner generator(s).
+The example creates the generators, @ping@/@pong@, and then assigns the partners that form the cycle.
+% (Alternatively, the constructor can assign the partners as they are declared, except the first, and the first-generator partner is set after the last generator declaration to close the cycle.)
+Once the cycle is formed, the program main resumes one of the generators, @ping@, and the generators can then traverse an arbitrary cycle using @resume@ to activate partner generator(s).
 Terminating the cycle is accomplished by @suspend@ or @return@, both of which go back to the stack frame that started the cycle (program main in the example).
+Note, the creator and starter may be different, \eg if the creator calls another function that starts the cycle.
 The starting stack-frame is below the last active generator because the resume/resume cycle does not grow the stack.
-Also, since local variables are not retained in the generator function, it does not contain any objects with destructors that must be called, so the  cost is the same as a function return.
-Destructor cost occurs when the generator instance is deallocated, which is easily controlled by the programmer.
-
-Figure~\ref{f:CPingPongSim} shows the implementation of the symmetric generator, where the complexity is the @resume@, which needs an extension to the calling convention to perform a forward rather than backward jump.
-This jump-starts at the top of the next generator main to re-execute the normal calling convention to make space on the stack for its local variables.
-However, before the jump, the caller must reset its stack (and any registers) equivalent to a @return@, but subsequently jump forward.
-This semantics is basically a tail-call optimization, which compilers already perform.
-The example shows the assembly code to undo the generator's entry code before the direct jump.
-This assembly code depends on what entry code is generated, specifically if there are local variables and the level of optimization.
-To provide this new calling convention requires a mechanism built into the compiler, which is beyond the scope of \CFA at this time.
-Nevertheless, it is possible to hand generate any symmetric generators for proof of concept and performance testing.
-A compiler could also eliminate other artifacts in the generator simulation to further increase performance, \eg LLVM has various coroutine support~\cite{CoroutineTS}, and \CFA can leverage this support should it fork @clang@.
+Also, since local variables are not retained in the generator function, there are no objects with destructors to be called, so the cost is the same as a function return.
+Destructor cost occurs when the generator instance is deallocated by the creator.
 
 \begin{figure}
@@ -826,11 +996,12 @@
 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
 `generator PingPong` {
+	int N, i;				// local state
 	const char * name;
-	int N;
-	int i;				// local state
 	PingPong & partner; // rebindable reference
 };
 
 void `main( PingPong & pp )` with(pp) {
+
+
 	for ( ; i < N; i += 1 ) {
 		sout | name | i;
@@ -850,20 +1021,21 @@
 \begin{cfa}[escapechar={},aboveskip=0pt,belowskip=0pt]
 typedef struct PingPong {
+	int restart, N, i;
 	const char * name;
-	int N, i;
 	struct PingPong * partner;
-	void * next;
 } PingPong;
-#define PPCtor(name, N) {name,N,0,NULL,NULL}
+#define PPCtor(name, N) {0, N, 0, name, NULL}
 void comain( PingPong * pp ) {
-	if ( pp->next ) goto *pp->next;
-	pp->next = &&cycle;
+	static void * states[] = {&&s0, &&s1};
+	goto *states[pp->restart];
+  s0: pp->restart = 1;
 	for ( ; pp->i < pp->N; pp->i += 1 ) {
 		printf( "%s %d\n", pp->name, pp->i );
 		asm( "mov  %0,%%rdi" : "=m" (pp->partner) );
 		asm( "mov  %rdi,%rax" );
-		asm( "popq %rbx" );
+		asm( "add  $16, %rsp" );
+		asm( "popq %rbp" );
 		asm( "jmp  comain" );
-	  cycle: ;
+	  s1: ;
 	}
 }
@@ -881,5 +1053,21 @@
 \end{figure}
 
-Finally, part of this generator work was inspired by the recent \CCtwenty generator proposal~\cite{C++20Coroutine19} (which they call coroutines).
+\begin{figure}
+\centering
+\input{FullCoroutinePhases.pstex_t}
+\vspace*{-10pt}
+\caption{Symmetric coroutine steps: Ping / Pong}
+\label{f:PingPongFullCoroutineSteps}
+\end{figure}
+
+Figure~\ref{f:CPingPongSim} shows the C implementation of the \CFA symmetric generator, where there is still only one additional field, @restart@, but @resume@ is more complex because it does a forward rather than backward jump.
+Before the jump, the parameter for the next call @partner@ is placed into the register used for the first parameter, @rdi@, and the remaining registers are reset for a return.
+The @jmp comain@ restarts the function but with a different parameter, so the new call's behaviour depends on the state of the coroutine type, i.e., branch to restart location with different data state.
+While the semantics of call forward is a tail-call optimization, which compilers perform, the generator state is different on each call rather a common state for a tail-recursive function (i.e., the parameter to the function never changes during the forward calls.
+However, this assembler code depends on what entry code is generated, specifically if there are local variables and the level of optimization.
+Hence, internal compiler support is necessary for any forward call (or backwards return), \eg LLVM has various coroutine support~\cite{CoroutineTS}, and \CFA can leverage this support should it eventually fork @clang@.
+For this reason, \CFA does not support general symmetric generators at this time, but, it is possible to hand generate any symmetric generators (as in Figure~\ref{f:CPingPongSim}) for proof of concept and performance testing.
+
+Finally, part of this generator work was inspired by the recent \CCtwenty coroutine proposal~\cite{C++20Coroutine19}, which uses the general term coroutine to mean generator.
 Our work provides the same high-performance asymmetric generators as \CCtwenty, and extends their work with symmetric generators.
 An additional \CCtwenty generator feature allows @suspend@ and @resume@ to be followed by a restricted compound statement that is executed after the current generator has reset its stack but before calling the next generator, specified with \CFA syntax:
@@ -896,43 +1084,48 @@
 \label{s:Coroutine}
 
-Stackful coroutines extend generator semantics, \ie there is an implicit closure and @suspend@ may appear in a helper function called from the coroutine main.
+Stackful coroutines (Table~\ref{t:ExecutionPropertyComposition} case 5) extend generator semantics, \ie there is an implicit closure and @suspend@ may appear in a helper function called from the coroutine main.
 A coroutine is specified by replacing @generator@ with @coroutine@ for the type.
-Coroutine generality results in higher cost for creation, due to dynamic stack allocation, execution, due to context switching among stacks, and terminating, due to possible stack unwinding and dynamic stack deallocation.
+Coroutine generality results in higher cost for creation, due to dynamic stack allocation, for execution, due to context switching among stacks, and for terminating, due to possible stack unwinding and dynamic stack deallocation.
 A series of different kinds of coroutines and their implementations demonstrate how coroutines extend generators.
 
 First, the previous generator examples are converted to their coroutine counterparts, allowing local-state variables to be moved from the generator type into the coroutine main.
-\begin{description}
-\item[Fibonacci]
-Move the declaration of @fn1@ to the start of coroutine main.
+\begin{center}
+\begin{tabular}{@{}l|l|l|l@{}}
+\multicolumn{1}{c|}{Fibonacci} & \multicolumn{1}{c|}{Formatter} & \multicolumn{1}{c|}{Device Driver} & \multicolumn{1}{c}{PingPong} \\
+\hline
 \begin{cfa}[xleftmargin=0pt]
-void main( Fib & fib ) with(fib) {
+void main( Fib & fib ) ...
 	`int fn1;`
-\end{cfa}
-\item[Formatter]
-Move the declaration of @g@ and @b@ to the for loops in the coroutine main.
+
+
+\end{cfa}
+&
 \begin{cfa}[xleftmargin=0pt]
 for ( `g`; 5 ) {
 	for ( `b`; 4 ) {
-\end{cfa}
-\item[Device Driver]
-Move the declaration of @lnth@ and @sum@ to their points of initialization.
+
+
+\end{cfa}
+&
 \begin{cfa}[xleftmargin=0pt]
-	status = CONT;
-	`unsigned int lnth = 0, sum = 0;`
-	...
-	`unsigned short int crc = byte << 8;`
-\end{cfa}
-\item[PingPong]
-Move the declaration of @i@ to the for loop in the coroutine main.
+status = CONT;
+`int lnth = 0, sum = 0;`
+...
+`short int crc = byte << 8;`
+\end{cfa}
+&
 \begin{cfa}[xleftmargin=0pt]
-void main( PingPong & pp ) with(pp) {
+void main( PingPong & pp ) ...
 	for ( `i`; N ) {
-\end{cfa}
-\end{description}
+
+
+\end{cfa}
+\end{tabular}
+\end{center}
 It is also possible to refactor code containing local-state and @suspend@ statements into a helper function, like the computation of the CRC for the device driver.
 \begin{cfa}
-unsigned int Crc() {
+int Crc() {
 	`suspend;`
-	unsigned short int crc = byte << 8;
+	short int crc = byte << 8;
 	`suspend;`
 	status = (crc | byte) == sum ? MSG : ECRC;
@@ -945,8 +1138,8 @@
 
 \begin{comment}
-Figure~\ref{f:Coroutine3States} creates a @coroutine@ type, @`coroutine` Fib { int fn; }@, which provides communication, @fn@, for the \newterm{coroutine main}, @main@, which runs on the coroutine stack, and possibly multiple interface functions, \eg @next@.
+Figure~\ref{f:Coroutine3States} creates a @coroutine@ type, @`coroutine` Fib { int fn; }@, which provides communication, @fn@, for the \newterm{coroutine main}, @main@, which runs on the coroutine stack, and possibly multiple interface functions, \eg @restart@.
 Like the structure in Figure~\ref{f:ExternalState}, the coroutine type allows multiple instances, where instances of this type are passed to the (overloaded) coroutine main.
 The coroutine main's stack holds the state for the next generation, @f1@ and @f2@, and the code represents the three states in the Fibonacci formula via the three suspend points, to context switch back to the caller's @resume@.
-The interface function @next@, takes a Fibonacci instance and context switches to it using @resume@;
+The interface function @restart@, takes a Fibonacci instance and context switches to it using @resume@;
 on restart, the Fibonacci field, @fn@, contains the next value in the sequence, which is returned.
 The first @resume@ is special because it allocates the coroutine stack and cocalls its coroutine main on that stack;
@@ -1114,22 +1307,17 @@
 \begin{figure}
 \centering
-\lstset{language=CFA,escapechar={},moredelim=**[is][\protect\color{red}]{`}{`}}% allow $
 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
 \begin{cfa}
 `coroutine` Prod {
-	Cons & c;			// communication
+	Cons & c;			$\C[1.5in]{// communication}$
 	int N, money, receipt;
 };
 void main( Prod & prod ) with( prod ) {
-	// 1st resume starts here
-	for ( i; N ) {
+	for ( i; N ) {		$\C{// 1st resume}\CRT$
 		int p1 = random( 100 ), p2 = random( 100 );
-		sout | p1 | " " | p2;
 		int status = delivery( c, p1, p2 );
-		sout | " $" | money | nl | status;
 		receipt += 1;
 	}
 	stop( c );
-	sout | "prod stops";
 }
 int payment( Prod & prod, int money ) {
@@ -1152,23 +1340,19 @@
 \begin{cfa}
 `coroutine` Cons {
-	Prod & p;			// communication
+	Prod & p;			$\C[1.5in]{// communication}$
 	int p1, p2, status;
 	bool done;
 };
 void ?{}( Cons & cons, Prod & p ) {
-	&cons.p = &p; // reassignable reference
+	&cons.p = &p;		$\C{// reassignable reference}$
 	cons.[status, done ] = [0, false];
 }
 void main( Cons & cons ) with( cons ) {
-	// 1st resume starts here
-	int money = 1, receipt;
+	int money = 1, receipt; $\C{// 1st resume}\CRT$
 	for ( ; ! done; ) {
-		sout | p1 | " " | p2 | nl | " $" | money;
 		status += 1;
 		receipt = payment( p, money );
-		sout | " #" | receipt;
 		money += 1;
 	}
-	sout | "cons stops";
 }
 int delivery( Cons & cons, int p1, int p2 ) {
@@ -1191,19 +1375,13 @@
 This example is illustrative because both producer/consumer have two interface functions with @resume@s that suspend execution in these interface (helper) functions.
 The program main creates the producer coroutine, passes it to the consumer coroutine in its initialization, and closes the cycle at the call to @start@ along with the number of items to be produced.
-The first @resume@ of @prod@ creates @prod@'s stack with a frame for @prod@'s coroutine main at the top, and context switches to it.
-@prod@'s coroutine main starts, creates local-state variables that are retained between coroutine activations, and executes $N$ iterations, each generating two random values, calling the consumer to deliver the values, and printing the status returned from the consumer.
-
+The call to @start@ is the first @resume@ of @prod@, which remembers the program main as the starter and creates @prod@'s stack with a frame for @prod@'s coroutine main at the top, and context switches to it.
+@prod@'s coroutine main starts, creates local-state variables that are retained between coroutine activations, and executes $N$ iterations, each generating two random values, calling the consumer's @deliver@ function to transfer the values, and printing the status returned from the consumer.
 The producer call to @delivery@ transfers values into the consumer's communication variables, resumes the consumer, and returns the consumer status.
-On the first resume, @cons@'s stack is created and initialized, holding local-state variables retained between subsequent activations of the coroutine.
-The consumer iterates until the @done@ flag is set, prints the values delivered by the producer, increments status, and calls back to the producer via @payment@, and on return from @payment@, prints the receipt from the producer and increments @money@ (inflation).
-The call from the consumer to @payment@ introduces the cycle between producer and consumer.
-When @payment@ is called, the consumer copies values into the producer's communication variable and a resume is executed.
-The context switch restarts the producer at the point where it last context switched, so it continues in @delivery@ after the resume.
-@delivery@ returns the status value in @prod@'s coroutine main, where the status is printed.
-The loop then repeats calling @delivery@, where each call resumes the consumer coroutine.
-The context switch to the consumer continues in @payment@.
-The consumer increments and returns the receipt to the call in @cons@'s coroutine main.
-The loop then repeats calling @payment@, where each call resumes the producer coroutine.
+Similarly on the first resume, @cons@'s stack is created and initialized, holding local-state variables retained between subsequent activations of the coroutine.
+The symmetric coroutine cycle forms when the consumer calls the producer's @payment@ function, which resumes the producer in the consumer's delivery function.
+When the producer calls @delivery@ again, it resumes the consumer in the @payment@ function.
+Both interface function than return to the their corresponding coroutine-main functions for the next cycle.
 Figure~\ref{f:ProdConsRuntimeStacks} shows the runtime stacks of the program main, and the coroutine mains for @prod@ and @cons@ during the cycling.
+As a consequence of a coroutine retaining its last resumer for suspending back, these reverse pointers allow @suspend@ to cycle \emph{backwards} around a symmetric coroutine cycle.
 
 \begin{figure}
@@ -1214,54 +1392,33 @@
 \caption{Producer / consumer runtime stacks}
 \label{f:ProdConsRuntimeStacks}
-
-\medskip
-
-\begin{center}
-\input{FullCoroutinePhases.pstex_t}
-\end{center}
-\vspace*{-10pt}
-\caption{Ping / Pong coroutine steps}
-\label{f:PingPongFullCoroutineSteps}
 \end{figure}
 
 Terminating a coroutine cycle is more complex than a generator cycle, because it requires context switching to the program main's \emph{stack} to shutdown the program, whereas generators started by the program main run on its stack.
-Furthermore, each deallocated coroutine must guarantee all destructors are run for object allocated in the coroutine type \emph{and} allocated on the coroutine's stack at the point of suspension, which can be arbitrarily deep.
-When a coroutine's main ends, its stack is already unwound so any stack allocated objects with destructors have been finalized.
+Furthermore, each deallocated coroutine must execute all destructors for object allocated in the coroutine type \emph{and} allocated on the coroutine's stack at the point of suspension, which can be arbitrarily deep.
+In the example, termination begins with the producer's loop stopping after N iterations and calling the consumer's @stop@ function, which sets the @done@ flag, resumes the consumer in function @payment@, terminating the call, and the consumer's loop in its coroutine main.
+% (Not shown is having @prod@ raise a nonlocal @stop@ exception at @cons@ after it finishes generating values and suspend back to @cons@, which catches the @stop@ exception to terminate its loop.)
+When the consumer's main ends, its stack is already unwound so any stack allocated objects with destructors are finalized.
+The question now is where does control continue?
+
 The na\"{i}ve semantics for coroutine-cycle termination is to context switch to the last resumer, like executing a @suspend@/@return@ in a generator.
 However, for coroutines, the last resumer is \emph{not} implicitly below the current stack frame, as for generators, because each coroutine's stack is independent.
 Unfortunately, it is impossible to determine statically if a coroutine is in a cycle and unrealistic to check dynamically (graph-cycle problem).
 Hence, a compromise solution is necessary that works for asymmetric (acyclic) and symmetric (cyclic) coroutines.
-
-Our solution is to context switch back to the first resumer (starter) once the coroutine ends.
+Our solution is to retain a coroutine's starter (first resumer), and context switch back to the starter when the coroutine ends.
+Hence, the consumer restarts its first resumer, @prod@, in @stop@, and when the producer ends, it restarts its first resumer, program main, in @start@ (see dashed lines from the end of the coroutine mains in Figure~\ref{f:ProdConsRuntimeStacks}).
 This semantics works well for the most common asymmetric and symmetric coroutine usage patterns.
-For asymmetric coroutines, it is common for the first resumer (starter) coroutine to be the only resumer.
-All previous generators converted to coroutines have this property.
-For symmetric coroutines, it is common for the cycle creator to persist for the lifetime of the cycle.
-Hence, the starter coroutine is remembered on the first resume and ending the coroutine resumes the starter.
-Figure~\ref{f:ProdConsRuntimeStacks} shows this semantic by the dashed lines from the end of the coroutine mains: @prod@ starts @cons@ so @cons@ resumes @prod@ at the end, and the program main starts @prod@ so @prod@ resumes the program main at the end.
+For asymmetric coroutines, it is common for the first resumer (starter) coroutine to be the only resumer;
+for symmetric coroutines, it is common for the cycle creator to persist for the lifetime of the cycle.
 For other scenarios, it is always possible to devise a solution with additional programming effort, such as forcing the cycle forward (backward) to a safe point before starting termination.
 
-The producer/consumer example does not illustrate the full power of the starter semantics because @cons@ always ends first.
-Assume generator @PingPong@ is converted to a coroutine.
-Figure~\ref{f:PingPongFullCoroutineSteps} shows the creation, starter, and cyclic execution steps of the coroutine version.
-The program main creates (declares) coroutine instances @ping@ and @pong@.
-Next, program main resumes @ping@, making it @ping@'s starter, and @ping@'s main resumes @pong@'s main, making it @pong@'s starter.
-Execution forms a cycle when @pong@ resumes @ping@, and cycles $N$ times.
-By adjusting $N$ for either @ping@/@pong@, it is possible to have either one finish first, instead of @pong@ always ending first.
-If @pong@ ends first, it resumes its starter @ping@ in its coroutine main, then @ping@ ends and resumes its starter the program main in function @start@.
-If @ping@ ends first, it resumes its starter the program main in function @start@.
-Regardless of the cycle complexity, the starter stack always leads back to the program main, but the stack can be entered at an arbitrary point.
-Once back at the program main, coroutines @ping@ and @pong@ are deallocated.
-For generators, deallocation runs the destructors for all objects in the generator type.
-For coroutines, deallocation deals with objects in the coroutine type and must also run the destructors for any objects pending on the coroutine's stack for any unterminated coroutine.
-Hence, if a coroutine's destructor detects the coroutine is not ended, it implicitly raises a cancellation exception (uncatchable exception) at the coroutine and resumes it so the cancellation exception can propagate to the root of the coroutine's stack destroying all local variable on the stack.
-So the \CFA semantics for the generator and coroutine, ensure both can be safely deallocated at any time, regardless of their current state, like any other aggregate object.
-Explicitly raising normal exceptions at another coroutine can replace flag variables, like @stop@, \eg @prod@ raises a @stop@ exception at @cons@ after it finishes generating values and resumes @cons@, which catches the @stop@ exception to terminate its loop.
-
-Finally, there is an interesting effect for @suspend@ with symmetric coroutines.
-A coroutine must retain its last resumer to suspend back because the resumer is on a different stack.
-These reverse pointers allow @suspend@ to cycle \emph{backwards}, which may be useful in certain cases.
-However, there is an anomaly if a coroutine resumes itself, because it overwrites its last resumer with itself, losing the ability to resume the last external resumer.
-To prevent losing this information, a self-resume does not overwrite the last resumer.
+Note, the producer/consumer example does not illustrate the full power of the starter semantics because @cons@ always ends first.
+Assume generator @PingPong@ in Figure~\ref{f:PingPongSymmetricGenerator} is converted to a coroutine.
+Unlike generators, coroutines have a starter structure with multiple levels, where the program main starts @ping@ and @ping@ starts @pong@.
+By adjusting $N$ for either @ping@/@pong@, it is possible to have either finish first.
+If @pong@ ends first, it resumes its starter @ping@ in its coroutine main, then @ping@ ends and resumes its starter the program main on return;
+if @ping@ ends first, it resumes its starter the program main on return.
+Regardless of the cycle complexity, the starter structure always leads back to the program main, but the path can be entered at an arbitrary point.
+Once back at the program main (creator), coroutines @ping@ and @pong@ are deallocated, runnning any destructors for objects within the coroutine and possibly deallocating any coroutine stacks for non-terminated coroutines, where stack deallocation implies stack unwinding to find destructors for allocated objects on the stack.
+Hence, the \CFA termination semantics for the generator and coroutine ensure correct deallocation semnatics, regardless of the coroutine's state (terminated or active), like any other aggregate object.
 
 
@@ -1294,5 +1451,5 @@
 Users wanting to extend custom types or build their own can only do so in ways offered by the language.
 Furthermore, implementing custom types without language support may display the power of a programming language.
-\CFA blends the two approaches, providing custom type for idiomatic \CFA code, while extending and building new custom types is still possible, similar to Java concurrency with builtin and library.
+\CFA blends the two approaches, providing custom type for idiomatic \CFA code, while extending and building new custom types is still possible, similar to Java concurrency with builtin and library (@java.util.concurrent@) monitors.
 
 Part of the mechanism to generalize custom types is the \CFA trait~\cite[\S~2.3]{Moss18}, \eg the definition for custom-type @coroutine@ is anything satisfying the trait @is_coroutine@, and this trait both enforces and restricts the coroutine-interface functions.
@@ -1304,9 +1461,5 @@
 forall( `dtype` T | is_coroutine(T) ) void $suspend$( T & ), resume( T & );
 \end{cfa}
-Note, copying generators/coroutines/threads is not meaningful.
-For example, both the resumer and suspender descriptors can have bidirectional pointers;
-copying these coroutines does not update the internal pointers so behaviour of both copies would be difficult to understand.
-Furthermore, two coroutines cannot logically execute on the same stack.
-A deep coroutine copy, which copies the stack, is also meaningless in an unmanaged language (no garbage collection), like C, because the stack may contain pointers to object within it that require updating for the copy.
+Note, copying generators/coroutines/threads is undefined because muliple objects cannot execute on a shared stack and stack copying does not work in unmanaged languages (no garbage collection), like C, because the stack may contain pointers to objects within it that require updating for the copy.
 The \CFA @dtype@ property provides no \emph{implicit} copying operations and the @is_coroutine@ trait provides no \emph{explicit} copying operations, so all coroutines must be passed by reference (pointer).
 The function definitions ensure there is a statically typed @main@ function that is the starting point (first stack frame) of a coroutine, and a mechanism to get (read) the coroutine descriptor from its handle.
@@ -1352,19 +1505,19 @@
 The combination of custom types and fundamental @trait@ description of these types allows a concise specification for programmers and tools, while more advanced programmers can have tighter control over memory layout and initialization.
 
-Figure~\ref{f:CoroutineMemoryLayout} shows different memory-layout options for a coroutine (where a task is similar).
+Figure~\ref{f:CoroutineMemoryLayout} shows different memory-layout options for a coroutine (where a thread is similar).
 The coroutine handle is the @coroutine@ instance containing programmer specified type global/communication variables across interface functions.
 The coroutine descriptor contains all implicit declarations needed by the runtime, \eg @suspend@/@resume@, and can be part of the coroutine handle or separate.
 The coroutine stack can appear in a number of locations and be fixed or variable sized.
-Hence, the coroutine's stack could be a VLS\footnote{
-We are examining variable-sized structures (VLS), where fields can be variable-sized structures or arrays.
+Hence, the coroutine's stack could be a variable-length structure (VLS)\footnote{
+We are examining VLSs, where fields can be variable-sized structures or arrays.
 Once allocated, a VLS is fixed sized.}
 on the allocating stack, provided the allocating stack is large enough.
 For a VLS stack allocation/deallocation is an inexpensive adjustment of the stack pointer, modulo any stack constructor costs (\eg initial frame setup).
-For heap stack allocation, allocation/deallocation is an expensive heap allocation (where the heap can be a shared resource), modulo any stack constructor costs.
-With heap stack allocation, it is also possible to use a split (segmented) stack calling convention, available with gcc and clang, so the stack is variable sized.
+For stack allocation in the heap, allocation/deallocation is an expensive allocation, where the heap can be a shared resource, modulo any stack constructor costs.
+It is also possible to use a split (segmented) stack calling convention, available with gcc and clang, allowing a variable-sized stack via a set of connected blocks in the heap.
 Currently, \CFA supports stack/heap allocated descriptors but only fixed-sized heap allocated stacks.
 In \CFA debug-mode, the fixed-sized stack is terminated with a write-only page, which catches most stack overflows.
 Experience teaching concurrency with \uC~\cite{CS343} shows fixed-sized stacks are rarely an issue for students.
-Split-stack allocation is under development but requires recompilation of legacy code, which may be impossible.
+Split-stack allocation is under development but requires recompilation of legacy code, which is not always possible.
 
 \begin{figure}
@@ -1380,21 +1533,19 @@
 
 Concurrency is nondeterministic scheduling of independent sequential execution paths (threads), where each thread has its own stack.
-A single thread with multiple call stacks, \newterm{coroutining}~\cite{Conway63,Marlin80}, does \emph{not} imply concurrency~\cite[\S~2]{Buhr05a}.
-In coroutining, coroutines self-schedule the thread across stacks so execution is deterministic.
+A single thread with multiple stacks, \ie coroutining, does \emph{not} imply concurrency~\cite[\S~3]{Buhr05a}.
+Coroutining self-schedule the thread across stacks so execution is deterministic.
 (It is \emph{impossible} to generate a concurrency error when coroutining.)
-However, coroutines are a stepping stone towards concurrency.
-
-The transition to concurrency, even for a single thread with multiple stacks, occurs when coroutines context switch to a \newterm{scheduling coroutine}, introducing non-determinism from the coroutine perspective~\cite[\S~3,]{Buhr05a}.
+
+The transition to concurrency, even for a single thread with multiple stacks, occurs when coroutines context switch to a \newterm{scheduling coroutine}, introducing non-determinism from the coroutine perspective~\cite[\S~3]{Buhr05a}.
 Therefore, a minimal concurrency system requires coroutines \emph{in conjunction with a nondeterministic scheduler}.
-The resulting execution system now follows a cooperative threading model~\cite{Adya02,libdill}, called \newterm{non-preemptive scheduling}.
-Adding \newterm{preemption} introduces non-cooperative scheduling, where context switching occurs randomly between any two instructions often based on a timer interrupt, called \newterm{preemptive scheduling}.
-While a scheduler introduces uncertain execution among explicit context switches, preemption introduces uncertainty by introducing implicit context switches.
+The resulting execution system now follows a cooperative threading-model~\cite{Adya02,libdill} because context-switching points to the scheduler (blocking) are known, but the next unblocking point is unknown due to the scheduler.
+Adding \newterm{preemption} introduces \newterm{non-cooperative} or \newterm{preemptive} scheduling, where context switching points to the scheduler are unknown as they can occur randomly between any two instructions often based on a timer interrupt.
 Uncertainty gives the illusion of parallelism on a single processor and provides a mechanism to access and increase performance on multiple processors.
 The reason is that the scheduler/runtime have complete knowledge about resources and how to best utilized them.
-However, the introduction of unrestricted nondeterminism results in the need for \newterm{mutual exclusion} and \newterm{synchronization}, which restrict nondeterminism for correctness;
+However, the introduction of unrestricted nondeterminism results in the need for \newterm{mutual exclusion} and \newterm{synchronization}~\cite[\S~4]{Buhr05a}, which restrict nondeterminism for correctness;
 otherwise, it is impossible to write meaningful concurrent programs.
 Optimal concurrent performance is often obtained by having as much nondeterminism as mutual exclusion and synchronization correctness allow.
 
-A scheduler can either be a stackless or stackful.
+A scheduler can also be stackless or stackful.
 For stackless, the scheduler performs scheduling on the stack of the current coroutine and switches directly to the next coroutine, so there is one context switch.
 For stackful, the current coroutine switches to the scheduler, which performs scheduling, and it then switches to the next coroutine, so there are two context switches.
@@ -1405,12 +1556,14 @@
 \label{s:threads}
 
-Threading needs the ability to start a thread and wait for its completion.
+Threading (Table~\ref{t:ExecutionPropertyComposition} case 11) needs the ability to start a thread and wait for its completion.
 A common API for this ability is @fork@ and @join@.
-\begin{cquote}
-\begin{tabular}{@{}lll@{}}
-\multicolumn{1}{c}{\textbf{Java}} & \multicolumn{1}{c}{\textbf{\Celeven}} & \multicolumn{1}{c}{\textbf{pthreads}} \\
-\begin{cfa}
-class MyTask extends Thread {...}
-mytask t = new MyTask(...);
+\vspace{4pt}
+\par\noindent
+\begin{tabular}{@{}l|l|l@{}}
+\multicolumn{1}{c|}{\textbf{Java}} & \multicolumn{1}{c|}{\textbf{\Celeven}} & \multicolumn{1}{c}{\textbf{pthreads}} \\
+\hline
+\begin{cfa}
+class MyThread extends Thread {...}
+mythread t = new MyThread(...);
 `t.start();` // start
 // concurrency
@@ -1419,7 +1572,7 @@
 &
 \begin{cfa}
-class MyTask { ... } // functor
-MyTask mytask;
-`thread t( mytask, ... );` // start
+class MyThread { ... } // functor
+MyThread mythread;
+`thread t( mythread, ... );` // start
 // concurrency
 `t.join();` // wait
@@ -1434,11 +1587,12 @@
 \end{cfa}
 \end{tabular}
-\end{cquote}
+\vspace{1pt}
+\par\noindent
 \CFA has a simpler approach using a custom @thread@ type and leveraging declaration semantics (allocation/deallocation), where threads implicitly @fork@ after construction and @join@ before destruction.
 \begin{cfa}
-thread MyTask {};
-void main( MyTask & this ) { ... }
+thread MyThread {};
+void main( MyThread & this ) { ... }
 int main() {
-	MyTask team`[10]`; $\C[2.5in]{// allocate stack-based threads, implicit start after construction}$
+	MyThread team`[10]`; $\C[2.5in]{// allocate stack-based threads, implicit start after construction}$
 	// concurrency
 } $\C{// deallocate stack-based threads, implicit joins before destruction}$
@@ -1448,7 +1602,7 @@
 Arbitrary topologies are possible using dynamic allocation, allowing threads to outlive their declaration scope, identical to normal dynamic allocation.
 \begin{cfa}
-MyTask * factory( int N ) { ... return `anew( N )`; } $\C{// allocate heap-based threads, implicit start after construction}$
+MyThread * factory( int N ) { ... return `anew( N )`; } $\C{// allocate heap-based threads, implicit start after construction}$
 int main() {
-	MyTask * team = factory( 10 );
+	MyThread * team = factory( 10 );
 	// concurrency
 	`delete( team );` $\C{// deallocate heap-based threads, implicit joins before destruction}\CRT$
@@ -1496,5 +1650,5 @@
 
 Threads in \CFA are user level run by runtime kernel threads (see Section~\ref{s:CFARuntimeStructure}), where user threads provide concurrency and kernel threads provide parallelism.
-Like coroutines, and for the same design reasons, \CFA provides a custom @thread@ type and a @trait@ to enforce and restrict the task-interface functions.
+Like coroutines, and for the same design reasons, \CFA provides a custom @thread@ type and a @trait@ to enforce and restrict the thread-interface functions.
 \begin{cquote}
 \begin{tabular}{@{}c@{\hspace{3\parindentlnth}}c@{}}
@@ -1527,49 +1681,24 @@
 \label{s:MutualExclusionSynchronization}
 
-Unrestricted nondeterminism is meaningless as there is no way to know when the result is completed without synchronization.
+Unrestricted nondeterminism is meaningless as there is no way to know when a result is completed and safe to access.
 To produce meaningful execution requires clawing back some determinism using mutual exclusion and synchronization, where mutual exclusion provides access control for threads using shared data, and synchronization is a timing relationship among threads~\cite[\S~4]{Buhr05a}.
-Some concurrent systems eliminate mutable shared-state by switching to stateless communication like message passing~\cite{Thoth,Harmony,V-Kernel,MPI} (Erlang, MPI), channels~\cite{CSP} (CSP,Go), actors~\cite{Akka} (Akka, Scala), or functional techniques (Haskell).
+The shared data protected by mutual exlusion is called a \newterm{critical section}~\cite{Dijkstra65}, and the protection can be simple (only 1 thread) or complex (only N kinds of threads, \eg group~\cite{Joung00} or readers/writer~\cite{Courtois71}).
+Without synchronization control in a critical section, an arriving thread can barge ahead of preexisting waiter threads resulting in short/long-term starvation, staleness/freshness problems, and/or incorrect transfer of data.
+Preventing or detecting barging is a challenge with low-level locks, but made easier through higher-level constructs.
+This challenge is often split into two different approaches: barging \emph{avoidance} and \emph{prevention}.
+Approaches that unconditionally releasing a lock for competing threads to acquire must use barging avoidance with flag/counter variable(s) to force barging threads to wait;
+approaches that conditionally hold locks during synchronization, \eg baton-passing~\cite{Andrews89}, prevent barging completely.
+
+At the lowest level, concurrent control is provided by atomic operations, upon which different kinds of locking mechanisms are constructed, \eg spin locks, semaphores~\cite{Dijkstra68b}, barriers, and path expressions~\cite{Campbell74}.
+However, for productivity it is always desirable to use the highest-level construct that provides the necessary efficiency~\cite{Hochstein05}.
+A significant challenge with locks is composability because it takes careful organization for multiple locks to be used while preventing deadlock.
+Easing composability is another feature higher-level mutual-exclusion mechanisms can offer.
+Some concurrent systems eliminate mutable shared-state by switching to non-shared communication like message passing~\cite{Thoth,Harmony,V-Kernel,MPI} (Erlang, MPI), channels~\cite{CSP} (CSP,Go), actors~\cite{Akka} (Akka, Scala), or functional techniques (Haskell).
 However, these approaches introduce a new communication mechanism for concurrency different from the standard communication using function call/return.
 Hence, a programmer must learn and manipulate two sets of design/programming patterns.
 While this distinction can be hidden away in library code, effective use of the library still has to take both paradigms into account.
-In contrast, approaches based on stateful models more closely resemble the standard call/return programming model, resulting in a single programming paradigm.
-
-At the lowest level, concurrent control is implemented by atomic operations, upon which different kinds of locking mechanisms are constructed, \eg semaphores~\cite{Dijkstra68b}, barriers, and path expressions~\cite{Campbell74}.
-However, for productivity it is always desirable to use the highest-level construct that provides the necessary efficiency~\cite{Hochstein05}.
-A newer approach for restricting non-determinism is transactional memory~\cite{Herlihy93}.
-While this approach is pursued in hardware~\cite{Nakaike15} and system languages, like \CC~\cite{Cpp-Transactions}, the performance and feature set is still too restrictive to be the main concurrency paradigm for system languages, which is why it is rejected as the core paradigm for concurrency in \CFA.
-
-One of the most natural, elegant, and efficient mechanisms for mutual exclusion and synchronization for shared-memory systems is the \emph{monitor}.
-First proposed by Brinch Hansen~\cite{Hansen73} and later described and extended by C.A.R.~Hoare~\cite{Hoare74}, many concurrent programming languages provide monitors as an explicit language construct: \eg Concurrent Pascal~\cite{ConcurrentPascal}, Mesa~\cite{Mesa}, Modula~\cite{Modula-2}, Turing~\cite{Turing:old}, Modula-3~\cite{Modula-3}, NeWS~\cite{NeWS}, Emerald~\cite{Emerald}, \uC~\cite{Buhr92a} and Java~\cite{Java}.
-In addition, operating-system kernels and device drivers have a monitor-like structure, although they often use lower-level primitives such as mutex locks or semaphores to simulate monitors.
-For these reasons, \CFA selected monitors as the core high-level concurrency construct, upon which higher-level approaches can be easily constructed.
-
-
-\subsection{Mutual Exclusion}
-
-A group of instructions manipulating a specific instance of shared data that must be performed atomically is called a \newterm{critical section}~\cite{Dijkstra65}, which is enforced by \newterm{simple mutual-exclusion}.
-The generalization is called a \newterm{group critical-section}~\cite{Joung00}, where multiple tasks with the same session use the resource simultaneously and different sessions are segregated, which is enforced by \newterm{complex mutual-exclusion} providing the correct kind and number of threads using a group critical-section.
-The readers/writer problem~\cite{Courtois71} is an instance of a group critical-section, where readers share a session but writers have a unique session.
-
-However, many solutions exist for mutual exclusion, which vary in terms of performance, flexibility and ease of use.
-Methods range from low-level locks, which are fast and flexible but require significant attention for correctness, to higher-level concurrency techniques, which sacrifice some performance to improve ease of use.
-Ease of use comes by either guaranteeing some problems cannot occur, \eg deadlock free, or by offering a more explicit coupling between shared data and critical section.
-For example, the \CC @std::atomic<T>@ offers an easy way to express mutual-exclusion on a restricted set of operations, \eg reading/writing, for numerical types.
-However, a significant challenge with locks is composability because it takes careful organization for multiple locks to be used while preventing deadlock.
-Easing composability is another feature higher-level mutual-exclusion mechanisms can offer.
-
-
-\subsection{Synchronization}
-
-Synchronization enforces relative ordering of execution, and synchronization tools provide numerous mechanisms to establish these timing relationships.
-Low-level synchronization primitives offer good performance and flexibility at the cost of ease of use;
-higher-level mechanisms often simplify usage by adding better coupling between synchronization and data, \eg receive-specific versus receive-any thread in message passing or offering specialized solutions, \eg barrier lock.
-Often synchronization is used to order access to a critical section, \eg ensuring a waiting writer thread enters the critical section before a calling reader thread.
-If the calling reader is scheduled before the waiting writer, the reader has barged.
-Barging can result in staleness/freshness problems, where a reader barges ahead of a writer and reads temporally stale data, or a writer barges ahead of another writer overwriting data with a fresh value preventing the previous value from ever being read (lost computation).
-Preventing or detecting barging is an involved challenge with low-level locks, which is made easier through higher-level constructs.
-This challenge is often split into two different approaches: barging avoidance and prevention.
-Algorithms that unconditionally releasing a lock for competing threads to acquire use barging avoidance during synchronization to force a barging thread to wait;
-algorithms that conditionally hold locks during synchronization, \eg baton-passing~\cite{Andrews89}, prevent barging completely.
+In contrast, approaches based on shared-state models more closely resemble the standard call/return programming model, resulting in a single programming paradigm.
+Finally, a newer approach for restricting non-determinism is transactional memory~\cite{Herlihy93}.
+While this approach is pursued in hardware~\cite{Nakaike15} and system languages, like \CC~\cite{Cpp-Transactions}, the performance and feature set is still too restrictive~\cite{Cascaval08,Boehm09} to be the main concurrency paradigm for system languages.
 
 
@@ -1577,22 +1706,25 @@
 \label{s:Monitor}
 
-A \textbf{monitor} is a set of functions that ensure mutual exclusion when accessing shared state.
-More precisely, a monitor is a programming technique that implicitly binds mutual exclusion to static function scope, as opposed to locks, where mutual-exclusion is defined by acquire/release calls, independent of lexical context (analogous to block and heap storage allocation).
+One of the most natural, elegant, efficient, high-level mechanisms for mutual exclusion and synchronization for shared-memory systems is the \emph{monitor} (Table~\ref{t:ExecutionPropertyComposition} case 2).
+First proposed by Brinch Hansen~\cite{Hansen73} and later described and extended by C.A.R.~Hoare~\cite{Hoare74}, many concurrent programming languages provide monitors as an explicit language construct: \eg Concurrent Pascal~\cite{ConcurrentPascal}, Mesa~\cite{Mesa}, Modula~\cite{Modula-2}, Turing~\cite{Turing:old}, Modula-3~\cite{Modula-3}, NeWS~\cite{NeWS}, Emerald~\cite{Emerald}, \uC~\cite{Buhr92a} and Java~\cite{Java}.
+In addition, operating-system kernels and device drivers have a monitor-like structure, although they often use lower-level primitives such as mutex locks or semaphores to manually implement a monitor.
+For these reasons, \CFA selected monitors as the core high-level concurrency construct, upon which higher-level approaches can be easily constructed.
+
+Specifically, a \textbf{monitor} is a set of functions that ensure mutual exclusion when accessing shared state.
+More precisely, a monitor is a programming technique that implicitly binds mutual exclusion to static function scope by call/return, as opposed to locks, where mutual-exclusion is defined by acquire/release calls, independent of lexical context (analogous to block and heap storage allocation).
 Restricting acquire/release points eases programming, comprehension, and maintenance, at a slight cost in flexibility and efficiency.
 \CFA uses a custom @monitor@ type and leverages declaration semantics (deallocation) to protect active or waiting threads in a monitor.
 
 The following is a \CFA monitor implementation of an atomic counter.
-\begin{cfa}[morekeywords=nomutex]
+\begin{cfa}
 `monitor` Aint { int cnt; }; $\C[4.25in]{// atomic integer counter}$
-int ++?( Aint & `mutex`$\(_{opt}\)$ this ) with( this ) { return ++cnt; } $\C{// increment}$
-int ?=?( Aint & `mutex`$\(_{opt}\)$ lhs, int rhs ) with( lhs ) { cnt = rhs; } $\C{// conversions with int}\CRT$
-int ?=?( int & lhs, Aint & `mutex`$\(_{opt}\)$ rhs ) with( rhs ) { lhs = cnt; }
-\end{cfa}
-% The @Aint@ constructor, @?{}@, uses the \lstinline[morekeywords=nomutex]@nomutex@ qualifier indicating mutual exclusion is unnecessary during construction because an object is inaccessible (private) until after it is initialized.
-% (While a constructor may publish its address into a global variable, doing so generates a race-condition.)
-The prefix increment operation, @++?@, is normally @mutex@, indicating mutual exclusion is necessary during function execution, to protect the incrementing from race conditions, unless there is an atomic increment instruction for the implementation type.
-The assignment operators provide bidirectional conversion between an atomic and normal integer without accessing field @cnt@;
-these operations only need @mutex@, if reading/writing the implementation type is not atomic.
-The atomic counter is used without any explicit mutual-exclusion and provides thread-safe semantics, which is similar to the \CC template @std::atomic@.
+int ++?( Aint & `mutex` this ) with( this ) { return ++cnt; } $\C{// increment}$
+int ?=?( Aint & `mutex` lhs, int rhs ) with( lhs ) { cnt = rhs; } $\C{// conversions with int, mutex optional}\CRT$
+int ?=?( int & lhs, Aint & `mutex` rhs ) with( rhs ) { lhs = cnt; }
+\end{cfa}
+The operators use the parameter-only declaration type-qualifier @mutex@ to mark which parameters require locking during function execution to protect from race conditions.
+The assignment operators provide bidirectional conversion between an atomic and normal integer without accessing field @cnt@.
+(These operations only need @mutex@, if reading/writing the implementation type is not atomic.)
+The atomic counter is used without any explicit mutual-exclusion and provides thread-safe semantics.
 \begin{cfa}
 int i = 0, j = 0, k = 5;
@@ -1602,6 +1734,8 @@
 i = x; j = y; k = z;
 \end{cfa}
+Note, like other concurrent programming languages, \CFA has specializations for the basic types using atomic instructions for performance and a general trait similar to the \CC template @std::atomic@.
 
 \CFA monitors have \newterm{multi-acquire} semantics so the thread in the monitor may acquire it multiple times without deadlock, allowing recursion and calling other interface functions.
+\newpage
 \begin{cfa}
 monitor M { ... } m;
@@ -1612,6 +1746,5 @@
 \end{cfa}
 \CFA monitors also ensure the monitor lock is released regardless of how an acquiring function ends (normal or exceptional), and returning a shared variable is safe via copying before the lock is released.
-Similar safety is offered by \emph{explicit} mechanisms like \CC RAII;
-monitor \emph{implicit} safety ensures no programmer usage errors.
+Similar safety is offered by \emph{explicit} opt-in disciplines like \CC RAII versus the monitor \emph{implicit} language-enforced safety guarantee ensuring no programmer usage errors.
 Furthermore, RAII mechanisms cannot handle complex synchronization within a monitor, where the monitor lock may not be released on function exit because it is passed to an unblocking thread;
 RAII is purely a mutual-exclusion mechanism (see Section~\ref{s:Scheduling}).
@@ -1639,6 +1772,4 @@
 \end{cquote}
 The @dtype@ property prevents \emph{implicit} copy operations and the @is_monitor@ trait provides no \emph{explicit} copy operations, so monitors must be passed by reference (pointer).
-% Copying a lock is insecure because it is possible to copy an open lock and then use the open copy when the original lock is closed to simultaneously access the shared data.
-% Copying a monitor is secure because both the lock and shared data are copies, but copying the shared data is meaningless because it no longer represents a unique entity.
 Similarly, the function definitions ensures there is a mechanism to get (read) the monitor descriptor from its handle, and a special destructor to prevent deallocation if a thread using the shared data.
 The custom monitor type also inserts any locks needed to implement the mutual exclusion semantics.
@@ -1652,11 +1783,7 @@
 For example, a monitor may be passed through multiple helper functions before it is necessary to acquire the monitor's mutual exclusion.
 
-The benefit of mandatory monitor qualifiers is self-documentation, but requiring both @mutex@ and \lstinline[morekeywords=nomutex]@nomutex@ for all monitor parameters is redundant.
-Instead, the semantics has one qualifier as the default and the other required.
-For example, make the safe @mutex@ qualifier the default because assuming \lstinline[morekeywords=nomutex]@nomutex@ may cause subtle errors.
-Alternatively, make the unsafe \lstinline[morekeywords=nomutex]@nomutex@ qualifier the default because it is the \emph{normal} parameter semantics while @mutex@ parameters are rare.
-Providing a default qualifier implies knowing whether a parameter is a monitor.
-Since \CFA relies heavily on traits as an abstraction mechanism, types can coincidentally match the monitor trait but not be a monitor, similar to inheritance where a shape and playing card can both be drawable.
-For this reason, \CFA requires programmers to identify the kind of parameter with the @mutex@ keyword and uses no keyword to mean \lstinline[morekeywords=nomutex]@nomutex@.
+\CFA requires programmers to identify the kind of parameter with the @mutex@ keyword and uses no keyword to mean \lstinline[morekeywords=nomutex]@nomutex@, because @mutex@ parameters are rare and no keyword is the \emph{normal} parameter semantics.
+Hence, @mutex@ parameters are documentation, at the function and its prototype, to both programmer and compiler, without other redundant keywords.
+Furthermore, \CFA relies heavily on traits as an abstraction mechanism, so the @mutex@ qualifier prevents coincidentally matching of a monitor trait with a type that is not a monitor, similar to coincidental inheritance where a shape and playing card can both be drawable.
 
 The next semantic decision is establishing which parameter \emph{types} may be qualified with @mutex@.
@@ -1672,5 +1799,5 @@
 Function @f3@ has a multiple object matrix, and @f4@ a multiple object data structure.
 While shown shortly, multiple object acquisition is possible, but the number of objects must be statically known.
-Therefore, \CFA only acquires one monitor per parameter with at most one level of indirection, excluding pointers as it is impossible to statically determine the size.
+Therefore, \CFA only acquires one monitor per parameter with exactly one level of indirection, and exclude pointer types to unknown sized arrays.
 
 For object-oriented monitors, \eg Java, calling a mutex member \emph{implicitly} acquires mutual exclusion of the receiver object, @`rec`.foo(...)@.
@@ -1679,5 +1806,5 @@
 While object-oriented monitors can be extended with a mutex qualifier for multiple-monitor members, no prior example of this feature could be found.}
 called \newterm{bulk acquire}.
-\CFA guarantees acquisition order is consistent across calls to @mutex@ functions using the same monitors as arguments, so acquiring multiple monitors is safe from deadlock.
+\CFA guarantees bulk acquisition order is consistent across calls to @mutex@ functions using the same monitors as arguments, so acquiring multiple monitors in a bulk acquire is safe from deadlock.
 Figure~\ref{f:BankTransfer} shows a trivial solution to the bank transfer problem~\cite{BankTransfer}, where two resources must be locked simultaneously, using \CFA monitors with implicit locking and \CC with explicit locking.
 A \CFA programmer only has to manage when to acquire mutual exclusion;
@@ -1699,5 +1826,5 @@
 void transfer( BankAccount & `mutex` my,
 	BankAccount & `mutex` your, int me2you ) {
-
+	// bulk acquire
 	deposit( my, -me2you ); // debit
 	deposit( your, me2you ); // credit
@@ -1729,5 +1856,5 @@
 void transfer( BankAccount & my,
 			BankAccount & your, int me2you ) {
-	`scoped_lock lock( my.m, your.m );`
+	`scoped_lock lock( my.m, your.m );` // bulk acquire
 	deposit( my, -me2you ); // debit
 	deposit( your, me2you ); // credit
@@ -1757,11 +1884,11 @@
 \end{figure}
 
-Users can still force the acquiring order by using @mutex@/\lstinline[morekeywords=nomutex]@nomutex@.
+Users can still force the acquiring order by using or not using @mutex@.
 \begin{cfa}
 void foo( M & mutex m1, M & mutex m2 ); $\C{// acquire m1 and m2}$
-void bar( M & mutex m1, M & /* nomutex */ m2 ) { $\C{// acquire m1}$
+void bar( M & mutex m1, M & m2 ) { $\C{// only acquire m1}$
 	... foo( m1, m2 ); ... $\C{// acquire m2}$
 }
-void baz( M & /* nomutex */ m1, M & mutex m2 ) { $\C{// acquire m2}$
+void baz( M & m1, M & mutex m2 ) { $\C{// only acquire m2}$
 	... foo( m1, m2 ); ... $\C{// acquire m1}$
 }
@@ -1806,43 +1933,35 @@
 % There are many aspects of scheduling in a concurrency system, all related to resource utilization by waiting threads, \ie which thread gets the resource next.
 % Different forms of scheduling include access to processors by threads (see Section~\ref{s:RuntimeStructureCluster}), another is access to a shared resource by a lock or monitor.
-This section discusses monitor scheduling for waiting threads eligible for entry, \ie which thread gets the shared resource next. (See Section~\ref{s:RuntimeStructureCluster} for scheduling threads on virtual processors.)
-While monitor mutual-exclusion provides safe access to shared data, the monitor data may indicate that a thread accessing it cannot proceed, \eg a bounded buffer may be full/empty so produce/consumer threads must block.
-Leaving the monitor and trying again (busy waiting) is impractical for high-level programming.
-Monitors eliminate busy waiting by providing synchronization to schedule threads needing access to the shared data, where threads block versus spinning.
+This section discusses scheduling for waiting threads eligible for monitor entry, \ie which user thread gets the shared resource next. (See Section~\ref{s:RuntimeStructureCluster} for scheduling kernel threads on virtual processors.)
+While monitor mutual-exclusion provides safe access to its shared data, the data may indicate a thread cannot proceed, \eg a bounded buffer may be full/\-empty so produce/consumer threads must block.
+Leaving the monitor and retrying (busy waiting) is impractical for high-level programming.
+
+Monitors eliminate busy waiting by providing synchronization within the monitor critical-section to schedule threads needing access to the shared data, where threads block versus spin.
 Synchronization is generally achieved with internal~\cite{Hoare74} or external~\cite[\S~2.9.2]{uC++} scheduling.
-\newterm{Internal scheduling} is characterized by each thread entering the monitor and making an individual decision about proceeding or blocking, while \newterm{external scheduling} is characterized by an entering thread making a decision about proceeding for itself and on behalf of other threads attempting entry.
-Finally, \CFA monitors do not allow calling threads to barge ahead of signalled threads, which simplifies synchronization among threads in the monitor and increases correctness.
-If barging is allowed, synchronization between a signaller and signallee is difficult, often requiring additional flags and multiple unblock/block cycles.
-In fact, signals-as-hints is completely opposite from that proposed by Hoare in the seminal paper on monitors~\cite[p.~550]{Hoare74}.
+\newterm{Internal} (largely) schedules threads located \emph{inside} the monitor and is accomplished using condition variables with signal and wait.
+\newterm{External} (largely) schedules threads located \emph{outside} the monitor and is accomplished with the @waitfor@ statement.
+Note, internal scheduling has a small amount of external scheduling and vice versus, so the naming denotes where the majority of the block threads reside (inside or outside) for scheduling.
+For complex scheduling, the approaches can be combined, so there can be an equal number of threads waiting inside and outside.
+
+\CFA monitors do not allow calling threads to barge ahead of signalled threads (via barging prevention), which simplifies synchronization among threads in the monitor and increases correctness.
+A direct consequence of this semantics is that unblocked waiting threads are not required to recheck the waiting condition, \ie waits are not in a starvation-prone busy-loop as required by the signals-as-hints style with barging.
+Preventing barging comes directly from Hoare's semantics in the seminal paper on monitors~\cite[p.~550]{Hoare74}.
 % \begin{cquote}
 % However, we decree that a signal operation be followed immediately by resumption of a waiting program, without possibility of an intervening procedure call from yet a third program.
 % It is only in this way that a waiting program has an absolute guarantee that it can acquire the resource just released by the signalling program without any danger that a third program will interpose a monitor entry and seize the resource instead.~\cite[p.~550]{Hoare74}
 % \end{cquote}
-Furthermore, \CFA concurrency has no spurious wakeup~\cite[\S~9]{Buhr05a}, which eliminates an implicit form of self barging.
-Hence, a \CFA @wait@ statement is not enclosed in a @while@ loop retesting a blocking predicate, which can cause thread starvation due to barging.
-
-Figure~\ref{f:MonitorScheduling} shows general internal/external scheduling (for the bounded-buffer example in Figure~\ref{f:InternalExternalScheduling}).
-External calling threads block on the calling queue, if the monitor is occupied, otherwise they enter in FIFO order.
-Internal threads block on condition queues via @wait@ and reenter from the condition in FIFO order.
-Alternatively, internal threads block on urgent from the @signal_block@ or @waitfor@, and reenter implicitly when the monitor becomes empty, \ie, the thread in the monitor exits or waits.
-
-There are three signalling mechanisms to unblock waiting threads to enter the monitor.
-Note, signalling cannot have the signaller and signalled thread in the monitor simultaneously because of the mutual exclusion, so either the signaller or signallee can proceed.
-For internal scheduling, threads are unblocked from condition queues using @signal@, where the signallee is moved to urgent and the signaller continues (solid line).
-Multiple signals move multiple signallees to urgent until the condition is empty.
-When the signaller exits or waits, a thread blocked on urgent is processed before calling threads to prevent barging.
+Furthermore, \CFA concurrency has no spurious wakeup~\cite[\S~9]{Buhr05a}, which eliminates an implicit self barging.
+
+Monitor mutual-exclusion means signalling cannot have the signaller and signalled thread in the monitor simultaneously, so only the signaller or signallee can proceed.
+Figure~\ref{f:MonitorScheduling} shows internal/external scheduling for the bounded-buffer examples in Figure~\ref{f:GenericBoundedBuffer}.
+For internal scheduling in Figure~\ref{f:BBInt}, the @signal@ moves the signallee (front thread of the specified condition queue) to urgent and the signaller continues (solid line).
+Multiple signals move multiple signallees to urgent until the condition queue is empty.
+When the signaller exits or waits, a thread is implicitly unblocked from urgent (if available) before unblocking a calling thread to prevent barging.
 (Java conceptually moves the signalled thread to the calling queue, and hence, allows barging.)
-The alternative unblock is in the opposite order using @signal_block@, where the signaller is moved to urgent and the signallee continues (dashed line), and is implicitly unblocked from urgent when the signallee exits or waits.
-
-For external scheduling, the condition queues are not used;
-instead threads are unblocked directly from the calling queue using @waitfor@ based on function names requesting mutual exclusion.
-(The linear search through the calling queue to locate a particular call can be reduced to $O(1)$.)
-The @waitfor@ has the same semantics as @signal_block@, where the signalled thread executes before the signallee, which waits on urgent.
-Executing multiple @waitfor@s from different signalled functions causes the calling threads to move to urgent.
-External scheduling requires urgent to be a stack, because the signaller expects to execute immediately after the specified monitor call has exited or waited.
-Internal scheduling behaves the same for an urgent stack or queue, except for multiple signalling, where the threads unblock from urgent in reverse order from signalling.
-If the restart order is important, multiple signalling by a signal thread can be transformed into daisy-chain signalling among threads, where each thread signals the next thread.
-We tried both a stack for @waitfor@ and queue for signalling, but that resulted in complex semantics about which thread enters next.
-Hence, \CFA uses a single urgent stack to correctly handle @waitfor@ and adequately support both forms of signalling.
+Signal is used when the signaller is providing the cooperation needed by the signallee (\eg creating an empty slot in a buffer for a producer) and the signaller immediately exits the monitor to run concurrently (consume the buffer element) and passes control of the monitor to the signalled thread, which can immediately take advantage of the state change.
+Specifically, the @wait@ function atomically blocks the calling thread and implicitly releases the monitor lock(s) for all monitors in the function's parameter list.
+Signalling is unconditional because signalling an empty condition queue does nothing.
+It is common to declare condition queues as monitor fields to prevent shared access, hence no locking is required for access as the queues are protected by the monitor lock.
+In \CFA, a condition queue can be created/stored independently.
 
 \begin{figure}
@@ -1862,24 +1981,4 @@
 \end{figure}
 
-Figure~\ref{f:BBInt} shows a \CFA generic bounded-buffer with internal scheduling, where producers/consumers enter the monitor, detect the buffer is full/empty, and block on an appropriate condition variable, @full@/@empty@.
-The @wait@ function atomically blocks the calling thread and implicitly releases the monitor lock(s) for all monitors in the function's parameter list.
-The appropriate condition variable is signalled to unblock an opposite kind of thread after an element is inserted/removed from the buffer.
-Signalling is unconditional, because signalling an empty condition variable does nothing.
-It is common to declare condition variables as monitor fields to prevent shared access, hence no locking is required for access as the conditions are protected by the monitor lock.
-In \CFA, a condition variable can be created/stored independently.
-% To still prevent expensive locking on access, a condition variable is tied to a \emph{group} of monitors on first use, called \newterm{branding}, resulting in a low-cost boolean test to detect sharing from other monitors.
-
-% Signalling semantics cannot have the signaller and signalled thread in the monitor simultaneously, which means:
-% \begin{enumerate}
-% \item
-% The signalling thread returns immediately and the signalled thread continues.
-% \item
-% The signalling thread continues and the signalled thread is marked for urgent unblocking at the next scheduling point (exit/wait).
-% \item
-% The signalling thread blocks but is marked for urgent unblocking at the next scheduling point and the signalled thread continues.
-% \end{enumerate}
-% The first approach is too restrictive, as it precludes solving a reasonable class of problems, \eg dating service (see Figure~\ref{f:DatingService}).
-% \CFA supports the next two semantics as both are useful.
-
 \begin{figure}
 \centering
@@ -1893,57 +1992,94 @@
 		T elements[10];
 	};
-	void ?{}( Buffer(T) & buffer ) with(buffer) {
+	void ?{}( Buffer(T) & buf ) with(buf) {
 		front = back = count = 0;
 	}
-	void insert( Buffer(T) & mutex buffer, T elem )
-				with(buffer) {
-		if ( count == 10 ) `wait( empty )`;
-		// insert elem into buffer
+
+	void insert(Buffer(T) & mutex buf, T elm) with(buf){
+		if ( count == 10 ) `wait( empty )`; // full ?
+		// insert elm into buf
 		`signal( full )`;
 	}
-	T remove( Buffer(T) & mutex buffer ) with(buffer) {
-		if ( count == 0 ) `wait( full )`;
-		// remove elem from buffer
+	T remove( Buffer(T) & mutex buf ) with(buf) {
+		if ( count == 0 ) `wait( full )`; // empty ?
+		// remove elm from buf
 		`signal( empty )`;
-		return elem;
+		return elm;
 	}
 }
 \end{cfa}
 \end{lrbox}
-
-% \newbox\myboxB
-% \begin{lrbox}{\myboxB}
-% \begin{cfa}[aboveskip=0pt,belowskip=0pt]
-% forall( otype T ) { // distribute forall
-% 	monitor Buffer {
-%
-% 		int front, back, count;
-% 		T elements[10];
-% 	};
-% 	void ?{}( Buffer(T) & buffer ) with(buffer) {
-% 		[front, back, count] = 0;
-% 	}
-% 	T remove( Buffer(T) & mutex buffer ); // forward
-% 	void insert( Buffer(T) & mutex buffer, T elem )
-% 				with(buffer) {
-% 		if ( count == 10 ) `waitfor( remove, buffer )`;
-% 		// insert elem into buffer
-%
-% 	}
-% 	T remove( Buffer(T) & mutex buffer ) with(buffer) {
-% 		if ( count == 0 ) `waitfor( insert, buffer )`;
-% 		// remove elem from buffer
-%
-% 		return elem;
-% 	}
-% }
-% \end{cfa}
-% \end{lrbox}
 
 \newbox\myboxB
 \begin{lrbox}{\myboxB}
 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
+forall( otype T ) { // distribute forall
+	monitor Buffer {
+
+		int front, back, count;
+		T elements[10];
+	};
+	void ?{}( Buffer(T) & buf ) with(buf) {
+		front = back = count = 0;
+	}
+	T remove( Buffer(T) & mutex buf ); // forward
+	void insert(Buffer(T) & mutex buf, T elm) with(buf){
+		if ( count == 10 ) `waitfor( remove : buf )`;
+		// insert elm into buf
+
+	}
+	T remove( Buffer(T) & mutex buf ) with(buf) {
+		if ( count == 0 ) `waitfor( insert : buf )`;
+		// remove elm from buf
+
+		return elm;
+	}
+}
+\end{cfa}
+\end{lrbox}
+
+\subfloat[Internal scheduling]{\label{f:BBInt}\usebox\myboxA}
+\hspace{1pt}
+\vrule
+\hspace{3pt}
+\subfloat[External scheduling]{\label{f:BBExt}\usebox\myboxB}
+
+\caption{Generic bounded buffer}
+\label{f:GenericBoundedBuffer}
+\end{figure}
+
+The @signal_block@ provides the opposite unblocking order, where the signaller is moved to urgent and the signallee continues and a thread is implicitly unblocked from urgent when the signallee exits or waits (dashed line).
+Signal block is used when the signallee is providing the cooperation needed by the signaller (\eg if the buffer is removed and a producer hands off an item to a consumer, as in Figure~\ref{f:DatingSignalBlock}) so the signaller must wait until the signallee unblocks, provides the cooperation, exits the monitor to run concurrently, and passes control of the monitor to the signaller, which can immediately take advantage of the state change.
+Using @signal@ or @signal_block@ can be a dynamic decision based on whether the thread providing the cooperation arrives before or after the thread needing the cooperation.
+
+External scheduling in Figure~\ref{f:BBExt} simplifies internal scheduling by eliminating condition queues and @signal@/@wait@ (cases where it cannot are discussed shortly), and has existed in the programming language Ada for almost 40 years with variants in other languages~\cite{SR,ConcurrentC++,uC++}.
+While prior languages use external scheduling solely for thread interaction, \CFA generalizes it to both monitors and threads.
+External scheduling allows waiting for events from other threads while restricting unrelated events, that would otherwise have to wait on condition queues in the monitor.
+Scheduling is controlled by the @waitfor@ statement, which atomically blocks the calling thread, releases the monitor lock, and restricts the function calls that can next acquire mutual exclusion.
+Specifically, a thread calling the monitor is unblocked directly from the calling queue based on function names that can fulfill the cooperation required by the signaller.
+(The linear search through the calling queue to locate a particular call can be reduced to $O(1)$.)
+Hence, the @waitfor@ has the same semantics as @signal_block@, where the signallee thread from the calling queue executes before the signaller, which waits on urgent.
+Now when a producer/consumer detects a full/empty buffer, the necessary cooperation for continuation is specified by indicating the next function call that can occur.
+For example, a producer detecting a full buffer must have cooperation from a consumer to remove an item so function @remove@ is accepted, which prevents producers from entering the monitor, and after a consumer calls @remove@, the producer waiting on urgent is \emph{implicitly} unblocked because it can now continue its insert operation.
+Hence, this mechanism is done in terms of control flow, next call, versus in terms of data, channels, as in Go/Rust @select@.
+While both mechanisms have strengths and weaknesses, \CFA uses the control-flow mechanism to be consistent with other language features.
+
+Figure~\ref{f:ReadersWriterLock} shows internal/external scheduling for a readers/writer lock with no barging and threads are serviced in FIFO order to eliminate staleness/freshness among the reader/writer threads.
+For internal scheduling in Figure~\ref{f:RWInt}, the readers and writers wait on the same condition queue in FIFO order, making it impossible to tell if a waiting thread is a reader or writer.
+To clawback the kind of thread, a \CFA condition can store user data in the node for a blocking thread at the @wait@, \ie whether the thread is a @READER@ or @WRITER@.
+An unblocked reader thread checks if the thread at the front of the queue is a reader and unblock it, \ie the readers daisy-chain signal the next group of readers demarcated by the next writer or end of the queue.
+For external scheduling in Figure~\ref{f:RWExt}, a waiting reader checks if a writer is using the resource, and if so, restricts further calls until the writer exits by calling @EndWrite@.
+The writer does a similar action for each reader or writer using the resource.
+Note, no new calls to @StartRead@/@StartWrite@ may occur when waiting for the call to @EndRead@/@EndWrite@.
+
+\begin{figure}
+\centering
+\newbox\myboxA
+\begin{lrbox}{\myboxA}
+\begin{cfa}[aboveskip=0pt,belowskip=0pt]
+enum RW { READER, WRITER };
 monitor ReadersWriter {
-	int rcnt, wcnt; // readers/writer using resource
+	int rcnt, wcnt;	// readers/writer using resource
+	`condition RWers;`
 };
 void ?{}( ReadersWriter & rw ) with(rw) {
@@ -1952,58 +2088,75 @@
 void EndRead( ReadersWriter & mutex rw ) with(rw) {
 	rcnt -= 1;
+	if ( rcnt == 0 ) `signal( RWers )`;
 }
 void EndWrite( ReadersWriter & mutex rw ) with(rw) {
 	wcnt = 0;
+	`signal( RWers );`
 }
 void StartRead( ReadersWriter & mutex rw ) with(rw) {
-	if ( wcnt > 0 ) `waitfor( EndWrite, rw );`
+	if ( wcnt !=0 || ! empty( RWers ) )
+		`wait( RWers, READER )`;
 	rcnt += 1;
+	if ( ! empty(RWers) && `front(RWers) == READER` )
+		`signal( RWers )`;  // daisy-chain signalling
 }
 void StartWrite( ReadersWriter & mutex rw ) with(rw) {
-	if ( wcnt > 0 ) `waitfor( EndWrite, rw );`
-	else while ( rcnt > 0 ) `waitfor( EndRead, rw );`
+	if ( wcnt != 0 || rcnt != 0 ) `wait( RWers, WRITER )`;
+
 	wcnt = 1;
 }
-
 \end{cfa}
 \end{lrbox}
 
-\subfloat[Generic bounded buffer, internal scheduling]{\label{f:BBInt}\usebox\myboxA}
-\hspace{3pt}
+\newbox\myboxB
+\begin{lrbox}{\myboxB}
+\begin{cfa}[aboveskip=0pt,belowskip=0pt]
+
+monitor ReadersWriter {
+	int rcnt, wcnt; // readers/writer using resource
+
+};
+void ?{}( ReadersWriter & rw ) with(rw) {
+	rcnt = wcnt = 0;
+}
+void EndRead( ReadersWriter & mutex rw ) with(rw) {
+	rcnt -= 1;
+
+}
+void EndWrite( ReadersWriter & mutex rw ) with(rw) {
+	wcnt = 0;
+
+}
+void StartRead( ReadersWriter & mutex rw ) with(rw) {
+	if ( wcnt > 0 ) `waitfor( EndWrite : rw );`
+
+	rcnt += 1;
+
+
+}
+void StartWrite( ReadersWriter & mutex rw ) with(rw) {
+	if ( wcnt > 0 ) `waitfor( EndWrite : rw );`
+	else while ( rcnt > 0 ) `waitfor( EndRead : rw );`
+	wcnt = 1;
+}
+\end{cfa}
+\end{lrbox}
+
+\subfloat[Internal scheduling]{\label{f:RWInt}\usebox\myboxA}
+\hspace{1pt}
 \vrule
 \hspace{3pt}
-\subfloat[Readers / writer lock, external scheduling]{\label{f:RWExt}\usebox\myboxB}
-
-\caption{Internal / external scheduling}
-\label{f:InternalExternalScheduling}
+\subfloat[External scheduling]{\label{f:RWExt}\usebox\myboxB}
+
+\caption{Readers / writer lock}
+\label{f:ReadersWriterLock}
 \end{figure}
 
-Figure~\ref{f:BBInt} can be transformed into external scheduling by removing the condition variables and signals/waits, and adding the following lines at the locations of the current @wait@s in @insert@/@remove@, respectively.
-\begin{cfa}[aboveskip=2pt,belowskip=1pt]
-if ( count == 10 ) `waitfor( remove, buffer )`;       |      if ( count == 0 ) `waitfor( insert, buffer )`;
-\end{cfa}
-Here, the producers/consumers detects a full/\-empty buffer and prevents more producers/consumers from entering the monitor until there is a free/empty slot in the buffer.
-External scheduling is controlled by the @waitfor@ statement, which atomically blocks the calling thread, releases the monitor lock, and restricts the function calls that can next acquire mutual exclusion.
-If the buffer is full, only calls to @remove@ can acquire the buffer, and if the buffer is empty, only calls to @insert@ can acquire the buffer.
-Threads calling excluded functions block outside of (external to) the monitor on the calling queue, versus blocking on condition queues inside of (internal to) the monitor.
-Figure~\ref{f:RWExt} shows a readers/writer lock written using external scheduling, where a waiting reader detects a writer using the resource and restricts further calls until the writer exits by calling @EndWrite@.
-The writer does a similar action for each reader or writer using the resource.
-Note, no new calls to @StarRead@/@StartWrite@ may occur when waiting for the call to @EndRead@/@EndWrite@.
-External scheduling allows waiting for events from other threads while restricting unrelated events, that would otherwise have to wait on conditions in the monitor.
-The mechnaism can be done in terms of control flow, \eg Ada @accept@ or \uC @_Accept@, or in terms of data, \eg Go @select@ on channels.
-While both mechanisms have strengths and weaknesses, this project uses the control-flow mechanism to be consistent with other language features.
-% Two challenges specific to \CFA for external scheduling are loose object-definitions (see Section~\ref{s:LooseObjectDefinitions}) and multiple-monitor functions (see Section~\ref{s:Multi-MonitorScheduling}).
-
-Figure~\ref{f:DatingService} shows a dating service demonstrating non-blocking and blocking signalling.
-The dating service matches girl and boy threads with matching compatibility codes so they can exchange phone numbers.
-A thread blocks until an appropriate partner arrives.
-The complexity is exchanging phone numbers in the monitor because of the mutual-exclusion property.
-For signal scheduling, the @exchange@ condition is necessary to block the thread finding the match, while the matcher unblocks to take the opposite number, post its phone number, and unblock the partner.
-For signal-block scheduling, the implicit urgent-queue replaces the explict @exchange@-condition and @signal_block@ puts the finding thread on the urgent condition and unblocks the matcher.
-The dating service is an example of a monitor that cannot be written using external scheduling because it requires knowledge of calling parameters to make scheduling decisions, and parameters of waiting threads are unavailable;
-as well, an arriving thread may not find a partner and must wait, which requires a condition variable, and condition variables imply internal scheduling.
-Furthermore, barging corrupts the dating service during an exchange because a barger may also match and change the phone numbers, invalidating the previous exchange phone number.
-Putting loops around the @wait@s does not correct the problem;
-the simple solution must be restructured to account for barging.
+Finally, external scheduling requires urgent to be a stack, because the signaller expects to execute immediately after the specified monitor call has exited or waited.
+Internal schedulling performing multiple signalling results in unblocking from urgent in the reverse order from signalling.
+It is rare for the unblocking order to be important as an unblocked thread can be time-sliced immediately after leaving the monitor.
+If the unblocking order is important, multiple signalling can be restructured into daisy-chain signalling, where each thread signals the next thread.
+Hence, \CFA uses a single urgent stack to correctly handle @waitfor@ and adequately support both forms of signalling.
+(Advanced @waitfor@ features are discussed in Section~\ref{s:ExtendedWaitfor}.)
 
 \begin{figure}
@@ -2019,5 +2172,5 @@
 };
 int girl( DS & mutex ds, int phNo, int ccode ) {
-	if ( is_empty( Boys[ccode] ) ) {
+	if ( empty( Boys[ccode] ) ) {
 		wait( Girls[ccode] );
 		GirlPhNo = phNo;
@@ -2046,5 +2199,5 @@
 };
 int girl( DS & mutex ds, int phNo, int ccode ) {
-	if ( is_empty( Boys[ccode] ) ) { // no compatible
+	if ( empty( Boys[ccode] ) ) { // no compatible
 		wait( Girls[ccode] ); // wait for boy
 		GirlPhNo = phNo; // make phone number available
@@ -2066,18 +2219,26 @@
 \qquad
 \subfloat[\lstinline@signal_block@]{\label{f:DatingSignalBlock}\usebox\myboxB}
-\caption{Dating service}
-\label{f:DatingService}
+\caption{Dating service Monitor}
+\label{f:DatingServiceMonitor}
 \end{figure}
 
-In summation, for internal scheduling, non-blocking signalling (as in the producer/consumer example) is used when the signaller is providing the cooperation for a waiting thread;
-the signaller enters the monitor and changes state, detects a waiting threads that can use the state, performs a non-blocking signal on the condition queue for the waiting thread, and exits the monitor to run concurrently.
-The waiter unblocks next from the urgent queue, uses/takes the state, and exits the monitor.
-Blocking signal is the reverse, where the waiter is providing the cooperation for the signalling thread;
-the signaller enters the monitor, detects a waiting thread providing the necessary state, performs a blocking signal to place it on the urgent queue and unblock the waiter.
-The waiter changes state and exits the monitor, and the signaller unblocks next from the urgent queue to use/take the state.
+Figure~\ref{f:DatingServiceMonitor} shows a dating service demonstrating non-blocking and blocking signalling.
+The dating service matches girl and boy threads with matching compatibility codes so they can exchange phone numbers.
+A thread blocks until an appropriate partner arrives.
+The complexity is exchanging phone numbers in the monitor because of the mutual-exclusion property.
+For signal scheduling, the @exchange@ condition is necessary to block the thread finding the match, while the matcher unblocks to take the opposite number, post its phone number, and unblock the partner.
+For signal-block scheduling, the implicit urgent-queue replaces the explicit @exchange@-condition and @signal_block@ puts the finding thread on the urgent stack and unblocks the matcher.
+
+The dating service is an important example of a monitor that cannot be written using external scheduling.
+First, because scheduling requires knowledge of calling parameters to make matching decisions, and parameters of calling threads are unavailable within the monitor.
+For example, a girl thread within the monitor cannot examine the @ccode@ of boy threads waiting on the calling queue to determine if there is a matching partner.
+Second, because a scheduling decision may be delayed when there is no immediate match, which requires a condition queue for waiting, and condition queues imply internal scheduling.
+For example, if a girl thread could determine there is no calling boy with the same @ccode@, it must wait until a matching boy arrives.
+Finally, barging corrupts the dating service during an exchange because a barger may also match and change the phone numbers, invalidating the previous exchange phone number.
+This situation shows rechecking the waiting condition and waiting again (signals-as-hints) fails, requiring significant restructured to account for barging.
 
 Both internal and external scheduling extend to multiple monitors in a natural way.
 \begin{cquote}
-\begin{tabular}{@{}l@{\hspace{3\parindentlnth}}l@{}}
+\begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
 \begin{cfa}
 monitor M { `condition e`; ... };
@@ -2090,9 +2251,9 @@
 &
 \begin{cfa}
-void rtn$\(_1\)$( M & mutex m1, M & mutex m2 );
+void rtn$\(_1\)$( M & mutex m1, M & mutex m2 ); // overload rtn
 void rtn$\(_2\)$( M & mutex m1 );
 void bar( M & mutex m1, M & mutex m2 ) {
-	... waitfor( `rtn` ); ...       // $\LstCommentStyle{waitfor( rtn\(_1\), m1, m2 )}$
-	... waitfor( `rtn, m1` ); ... // $\LstCommentStyle{waitfor( rtn\(_2\), m1 )}$
+	... waitfor( `rtn`${\color{red}\(_1\)}$ ); ...       // $\LstCommentStyle{waitfor( rtn\(_1\) : m1, m2 )}$
+	... waitfor( `rtn${\color{red}\(_2\)}$ : m1` ); ...
 }
 \end{cfa}
@@ -2101,6 +2262,6 @@
 For @wait( e )@, the default semantics is to atomically block the signaller and release all acquired mutex parameters, \ie @wait( e, m1, m2 )@.
 To override the implicit multi-monitor wait, specific mutex parameter(s) can be specified, \eg @wait( e, m1 )@.
-Wait cannot statically verifies the released monitors are the acquired mutex-parameters without disallowing separately compiled helper functions calling @wait@.
-While \CC supports bulk locking, @wait@ only accepts a single lock for a condition variable, so bulk locking with condition variables is asymmetric.
+Wait cannot statically verify the released monitors are the acquired mutex-parameters without disallowing separately compiled helper functions calling @wait@.
+While \CC supports bulk locking, @wait@ only accepts a single lock for a condition queue, so bulk locking with condition queues is asymmetric.
 Finally, a signaller,
 \begin{cfa}
@@ -2111,6 +2272,6 @@
 must have acquired at least the same locks as the waiting thread signalled from a condition queue to allow the locks to be passed, and hence, prevent barging.
 
-Similarly, for @waitfor( rtn )@, the default semantics is to atomically block the acceptor and release all acquired mutex parameters, \ie @waitfor( rtn, m1, m2 )@.
-To override the implicit multi-monitor wait, specific mutex parameter(s) can be specified, \eg @waitfor( rtn, m1 )@.
+Similarly, for @waitfor( rtn )@, the default semantics is to atomically block the acceptor and release all acquired mutex parameters, \ie @waitfor( rtn : m1, m2 )@.
+To override the implicit multi-monitor wait, specific mutex parameter(s) can be specified, \eg @waitfor( rtn : m1 )@.
 @waitfor@ does statically verify the monitor types passed are the same as the acquired mutex-parameters of the given function or function pointer, hence the function (pointer) prototype must be accessible.
 % When an overloaded function appears in an @waitfor@ statement, calls to any function with that name are accepted.
@@ -2120,20 +2281,21 @@
 void rtn( M & mutex m );
 `int` rtn( M & mutex m );
-waitfor( (`int` (*)( M & mutex ))rtn, m );
-\end{cfa}
-
-The ability to release a subset of acquired monitors can result in a \newterm{nested monitor}~\cite{Lister77} deadlock.
+waitfor( (`int` (*)( M & mutex ))rtn : m );
+\end{cfa}
+
+The ability to release a subset of acquired monitors can result in a \newterm{nested monitor}~\cite{Lister77} deadlock (see Section~\ref{s:MutexAcquisition}).
+\newpage
 \begin{cfa}
 void foo( M & mutex m1, M & mutex m2 ) {
-	... wait( `e, m1` ); ...				$\C{// release m1, keeping m2 acquired )}$
-void bar( M & mutex m1, M & mutex m2 ) {	$\C{// must acquire m1 and m2 )}$
+	... wait( `e, m1` ); ...				$\C{// release m1, keeping m2 acquired}$
+void bar( M & mutex m1, M & mutex m2 ) {	$\C{// must acquire m1 and m2}$
 	... signal( `e` ); ...
 \end{cfa}
 The @wait@ only releases @m1@ so the signalling thread cannot acquire @m1@ and @m2@ to enter @bar@ and @signal@ the condition.
-While deadlock can occur with multiple/nesting acquisition, this is a consequence of locks, and by extension monitors, not being perfectly composable.
-
+While deadlock can occur with multiple/nesting acquisition, this is a consequence of locks, and by extension monitor locking is not perfectly composable.
 
 
 \subsection{\texorpdfstring{Extended \protect\lstinline@waitfor@}{Extended waitfor}}
+\label{s:ExtendedWaitfor}
 
 Figure~\ref{f:ExtendedWaitfor} shows the extended form of the @waitfor@ statement to conditionally accept one of a group of mutex functions, with an optional statement to be performed \emph{after} the mutex function finishes.
@@ -2146,5 +2308,6 @@
 Hence, the terminating @else@ clause allows a conditional attempt to accept a call without blocking.
 If both @timeout@ and @else@ clause are present, the @else@ must be conditional, or the @timeout@ is never triggered.
-There is also a traditional future wait queue (not shown) (\eg Microsoft (@WaitForMultipleObjects@)), to wait for a specified number of future elements in the queue.
+There is also a traditional future wait queue (not shown) (\eg Microsoft @WaitForMultipleObjects@), to wait for a specified number of future elements in the queue.
+Finally, there is a shorthand for specifying multiple functions using the same set of monitors: @waitfor( f, g, h : m1, m2, m3 )@.
 
 \begin{figure}
@@ -2173,11 +2336,11 @@
 The right example accepts either @mem1@ or @mem2@ if @C1@ and @C2@ are true.
 
-An interesting use of @waitfor@ is accepting the @mutex@ destructor to know when an object is deallocated, \eg assume the bounded buffer is restructred from a monitor to a thread with the following @main@.
+An interesting use of @waitfor@ is accepting the @mutex@ destructor to know when an object is deallocated, \eg assume the bounded buffer is restructured from a monitor to a thread with the following @main@.
 \begin{cfa}
 void main( Buffer(T) & buffer ) with(buffer) {
 	for () {
-		`waitfor( ^?{}, buffer )` break;
-		or when ( count != 20 ) waitfor( insert, buffer ) { ... }
-		or when ( count != 0 ) waitfor( remove, buffer ) { ... }
+		`waitfor( ^?{} : buffer )` break;
+		or when ( count != 20 ) waitfor( insert : buffer ) { ... }
+		or when ( count != 0 ) waitfor( remove : buffer ) { ... }
 	}
 	// clean up
@@ -2271,32 +2434,64 @@
 To support this efficient semantics (and prevent barging), the implementation maintains a list of monitors acquired for each blocked thread.
 When a signaller exits or waits in a monitor function/statement, the front waiter on urgent is unblocked if all its monitors are released.
-Implementing a fast subset check for the necessary released monitors is important.
+Implementing a fast subset check for the necessary released monitors is important and discussed in the following sections.
 % The benefit is encapsulating complexity into only two actions: passing monitors to the next owner when they should be released and conditionally waking threads if all conditions are met.
 
 
-\subsection{Loose Object Definitions}
-\label{s:LooseObjectDefinitions}
-
-In an object-oriented programming language, a class includes an exhaustive list of operations.
-A new class can add members via static inheritance but the subclass still has an exhaustive list of operations.
-(Dynamic member adding, \eg JavaScript~\cite{JavaScript}, is not considered.)
-In the object-oriented scenario, the type and all its operators are always present at compilation (even separate compilation), so it is possible to number the operations in a bit mask and use an $O(1)$ compare with a similar bit mask created for the operations specified in a @waitfor@.
-
-However, in \CFA, monitor functions can be statically added/removed in translation units, making a fast subset check difficult.
-\begin{cfa}
-	monitor M { ... }; // common type, included in .h file
-translation unit 1
-	void `f`( M & mutex m );
-	void g( M & mutex m ) { waitfor( `f`, m ); }
-translation unit 2
-	void `f`( M & mutex m ); $\C{// replacing f and g for type M in this translation unit}$
-	void `g`( M & mutex m );
-	void h( M & mutex m ) { waitfor( `f`, m ) or waitfor( `g`, m ); } $\C{// extending type M in this translation unit}$
-\end{cfa}
-The @waitfor@ statements in each translation unit cannot form a unique bit-mask because the monitor type does not carry that information.
+\subsection{\texorpdfstring{\protect\lstinline@waitfor@ Implementation}{waitfor Implementation}}
+\label{s:waitforImplementation}
+
+In a statically-typed object-oriented programming language, a class has an exhaustive list of members, even when members are added via static inheritance (see Figure~\ref{f:uCinheritance}).
+Knowing all members at compilation (even separate compilation) allows uniquely numbered them so the accept-statement implementation can use a fast/compact bit mask with $O(1)$ compare.
+
+\begin{figure}
+\centering
+\begin{lrbox}{\myboxA}
+\begin{uC++}[aboveskip=0pt,belowskip=0pt]
+$\emph{translation unit 1}$
+_Monitor B { // common type in .h file
+	_Mutex virtual void `f`( ... );
+	_Mutex virtual void `g`( ... );
+	_Mutex virtual void w1( ... ) { ... _Accept(`f`, `g`); ... }
+};
+$\emph{translation unit 2}$
+// include B
+_Monitor D : public B { // inherit
+	_Mutex void `h`( ... ); // add
+	_Mutex void w2( ... ) { ... _Accept(`f`, `h`); ... }
+};
+\end{uC++}
+\end{lrbox}
+
+\begin{lrbox}{\myboxB}
+\begin{cfa}[aboveskip=0pt,belowskip=0pt]
+$\emph{translation unit 1}$
+monitor M { ... }; // common type in .h file
+void `f`( M & mutex m, ... );
+void `g`( M & mutex m, ... );
+void w1( M & mutex m, ... ) { ... waitfor(`f`, `g` : m); ... }
+
+$\emph{translation unit 2}$
+// include M
+extern void `f`( M & mutex m, ... ); // import f but not g
+void `h`( M & mutex m ); // add
+void w2( M & mutex m, ... ) { ... waitfor(`f`, `h` : m); ... }
+
+\end{cfa}
+\end{lrbox}
+
+\subfloat[\uC]{\label{f:uCinheritance}\usebox\myboxA}
+\hspace{3pt}
+\vrule
+\hspace{3pt}
+\subfloat[\CFA]{\label{f:CFinheritance}\usebox\myboxB}
+\caption{Member / Function visibility}
+\label{f:MemberFunctionVisibility}
+\end{figure}
+
+However, the @waitfor@ statement in translation unit 2 (see Figure~\ref{f:CFinheritance}) cannot see function @g@ in translation unit 1 precluding a unique numbering for a bit-mask because the monitor type only carries the protected shared-data.
+(A possible way to construct a dense mapping is at link or load-time.)
 Hence, function pointers are used to identify the functions listed in the @waitfor@ statement, stored in a variable-sized array.
-Then, the same implementation approach used for the urgent stack is used for the calling queue.
-Each caller has a list of monitors acquired, and the @waitfor@ statement performs a (usually short) linear search matching functions in the @waitfor@ list with called functions, and then verifying the associated mutex locks can be transfers.
-(A possible way to construct a dense mapping is at link or load-time.)
+Then, the same implementation approach used for the urgent stack (see Section~\ref{s:Scheduling}) is used for the calling queue.
+Each caller has a list of monitors acquired, and the @waitfor@ statement performs a (short) linear search matching functions in the @waitfor@ list with called functions, and then verifying the associated mutex locks can be transfers.
 
 
@@ -2313,5 +2508,5 @@
 The solution is for the programmer to disambiguate:
 \begin{cfa}
-waitfor( f, `m2` ); $\C{// wait for call to f with argument m2}$
+waitfor( f : `m2` ); $\C{// wait for call to f with argument m2}$
 \end{cfa}
 Both locks are acquired by function @g@, so when function @f@ is called, the lock for monitor @m2@ is passed from @g@ to @f@, while @g@ still holds lock @m1@.
@@ -2320,11 +2515,11 @@
 monitor M { ... };
 void f( M & mutex m1, M & mutex m2 );
-void g( M & mutex m1, M & mutex m2 ) { waitfor( f, `m1, m2` ); $\C{// wait for call to f with arguments m1 and m2}$
+void g( M & mutex m1, M & mutex m2 ) { waitfor( f : `m1, m2` ); $\C{// wait for call to f with arguments m1 and m2}$
 \end{cfa}
 Again, the set of monitors passed to the @waitfor@ statement must be entirely contained in the set of monitors already acquired by the accepting function.
-Also, the order of the monitors in a @waitfor@ statement is unimportant.
-
-Figure~\ref{f:UnmatchedMutexSets} shows an example where, for internal and external scheduling with multiple monitors, a signalling or accepting thread must match exactly, \ie partial matching results in waiting.
-For both examples, the set of monitors is disjoint so unblocking is impossible.
+% Also, the order of the monitors in a @waitfor@ statement must match the order of the mutex parameters.
+
+Figure~\ref{f:UnmatchedMutexSets} shows internal and external scheduling with multiple monitors that must match exactly with a signalling or accepting thread, \ie partial matching results in waiting.
+In both cases, the set of monitors is disjoint so unblocking is impossible.
 
 \begin{figure}
@@ -2355,5 +2550,5 @@
 }
 void g( M1 & mutex m1, M2 & mutex m2 ) {
-	waitfor( f, m1, m2 );
+	waitfor( f : m1, m2 );
 }
 g( `m11`, m2 ); // block on accept
@@ -2370,14 +2565,4 @@
 \end{figure}
 
-
-\subsection{\texorpdfstring{\protect\lstinline@mutex@ Threads}{mutex Threads}}
-
-Threads in \CFA can also be monitors to allow \emph{direct communication} among threads, \ie threads can have mutex functions that are called by other threads.
-Hence, all monitor features are available when using threads.
-Figure~\ref{f:DirectCommunication} shows a comparison of direct call communication in \CFA with direct channel communication in Go.
-(Ada provides a similar mechanism to the \CFA direct communication.)
-The program main in both programs communicates directly with the other thread versus indirect communication where two threads interact through a passive monitor.
-Both direct and indirection thread communication are valuable tools in structuring concurrent programs.
-
 \begin{figure}
 \centering
@@ -2386,5 +2571,5 @@
 
 struct Msg { int i, j; };
-thread GoRtn { int i;  float f;  Msg m; };
+monitor thread GoRtn { int i;  float f;  Msg m; };
 void mem1( GoRtn & mutex gortn, int i ) { gortn.i = i; }
 void mem2( GoRtn & mutex gortn, float f ) { gortn.f = f; }
@@ -2396,8 +2581,8 @@
 	for () {
 
-		`waitfor( mem1, gortn )` sout | i;  // wait for calls
-		or `waitfor( mem2, gortn )` sout | f;
-		or `waitfor( mem3, gortn )` sout | m.i | m.j;
-		or `waitfor( ^?{}, gortn )` break;
+		`waitfor( mem1 : gortn )` sout | i;  // wait for calls
+		or `waitfor( mem2 : gortn )` sout | f;
+		or `waitfor( mem3 : gortn )` sout | m.i | m.j;
+		or `waitfor( ^?{} : gortn )` break; // low priority
 
 	}
@@ -2453,6 +2638,36 @@
 \hspace{3pt}
 \subfloat[Go]{\label{f:Gochannel}\usebox\myboxB}
-\caption{Direct communication}
-\label{f:DirectCommunication}
+\caption{Direct versus indirect communication}
+\label{f:DirectCommunicationComparison}
+
+\medskip
+
+\begin{cfa}
+monitor thread DatingService {
+	condition Girls[CompCodes], Boys[CompCodes];
+	int girlPhoneNo, boyPhoneNo, ccode;
+};
+int girl( DatingService & mutex ds, int phoneno, int code ) with( ds ) {
+	girlPhoneNo = phoneno;  ccode = code;
+	`wait( Girls[ccode] );`								$\C{// wait for boy}$
+	girlPhoneNo = phoneno;  return boyPhoneNo;
+}
+int boy( DatingService & mutex ds, int phoneno, int code ) with( ds ) {
+	boyPhoneNo = phoneno;  ccode = code;
+	`wait( Boys[ccode] );`								$\C{// wait for girl}$
+	boyPhoneNo = phoneno;  return girlPhoneNo;
+}
+void main( DatingService & ds ) with( ds ) {			$\C{// thread starts, ds defaults to mutex}$
+	for () {
+		waitfor( ^?{} ) break;							$\C{// high priority}$
+		or waitfor( girl )								$\C{// girl called, compatible boy ? restart boy then girl}$
+			if ( ! is_empty( Boys[ccode] ) ) { `signal_block( Boys[ccode] );  signal_block( Girls[ccode] );` }
+		or waitfor( boy ) {								$\C{// boy called, compatible girl ? restart girl then boy}$
+			if ( ! is_empty( Girls[ccode] ) ) { `signal_block( Girls[ccode] );  signal_block( Boys[ccode] );` }
+	}
+}
+\end{cfa}
+\caption{Direct communication dating service}
+\label{f:DirectCommunicationDatingService}
 \end{figure}
 
@@ -2469,5 +2684,5 @@
 void main( Ping & pi ) {
 	for ( 10 ) {
-		`waitfor( ping, pi );`
+		`waitfor( ping : pi );`
 		`pong( po );`
 	}
@@ -2482,5 +2697,5 @@
 	for ( 10 ) {
 		`ping( pi );`
-		`waitfor( pong, po );`
+		`waitfor( pong : po );`
 	}
 }
@@ -2497,39 +2712,23 @@
 
 
-\subsection{Execution Properties}
-
-Table~\ref{t:ObjectPropertyComposition} shows how the \CFA high-level constructs cover 3 fundamental execution properties: thread, stateful function, and mutual exclusion.
-Case 1 is a basic object, with none of the new execution properties.
-Case 2 allows @mutex@ calls to Case 1 to protect shared data.
-Case 3 allows stateful functions to suspend/resume but restricts operations because the state is stackless.
-Case 4 allows @mutex@ calls to Case 3 to protect shared data.
-Cases 5 and 6 are the same as 3 and 4 without restriction because the state is stackful.
-Cases 7 and 8 are rejected because a thread cannot execute without a stackful state in a preemptive environment when context switching from the signal handler.
-Cases 9 and 10 have a stackful thread without and with @mutex@ calls.
-For situations where threads do not require direct communication, case 9 provides faster creation/destruction by eliminating @mutex@ setup.
-
-\begin{table}
-\caption{Object property composition}
-\centering
-\label{t:ObjectPropertyComposition}
-\renewcommand{\arraystretch}{1.25}
-%\setlength{\tabcolsep}{5pt}
-\begin{tabular}{c|c||l|l}
-\multicolumn{2}{c||}{object properties} & \multicolumn{2}{c}{mutual exclusion} \\
-\hline
-thread	& stateful				& \multicolumn{1}{c|}{No} & \multicolumn{1}{c}{Yes} \\
-\hline
-\hline
-No		& No					& \textbf{1}\ \ \ aggregate type		& \textbf{2}\ \ \ @monitor@ aggregate type \\
-\hline
-No		& Yes (stackless)		& \textbf{3}\ \ \ @generator@			& \textbf{4}\ \ \ @monitor@ @generator@ \\
-\hline
-No		& Yes (stackful)		& \textbf{5}\ \ \ @coroutine@			& \textbf{6}\ \ \ @monitor@ @coroutine@ \\
-\hline
-Yes		& No / Yes (stackless)	& \textbf{7}\ \ \ {\color{red}rejected}	& \textbf{8}\ \ \ {\color{red}rejected} \\
-\hline
-Yes		& Yes (stackful)		& \textbf{9}\ \ \ @thread@				& \textbf{10}\ \ @monitor@ @thread@ \\
-\end{tabular}
-\end{table}
+\subsection{\texorpdfstring{\protect\lstinline@monitor@ Generators / Coroutines / Threads}{monitor Generators / Coroutines / Threads}}
+
+\CFA generators, coroutines, and threads can also be monitors (Table~\ref{t:ExecutionPropertyComposition} cases 4, 6, 12) allowing safe \emph{direct communication} with threads, \ie the custom types can have mutex functions that are called by other threads.
+All monitor features are available within these mutex functions.
+For example, if the formatter generator (or coroutine equivalent) in Figure~\ref{f:CFAFormatGen} is extended with the monitor property and this interface function is used to communicate with the formatter:
+\begin{cfa}
+void fmt( Fmt & mutex fmt, char ch ) { fmt.ch = ch; resume( fmt ) }
+\end{cfa}
+multiple threads can safely pass characters for formatting.
+
+Figure~\ref{f:DirectCommunicationComparison} shows a comparison of direct call-communication in \CFA versus indirect channel-communication in Go.
+(Ada has a similar mechanism to \CFA direct communication.)
+The program thread in \CFA @main@ uses the call/return paradigm to directly communicate with the @GoRtn main@, whereas Go switches to the channel paradigm to indirectly communicate with the goroutine.
+Communication by multiple threads is safe for the @gortn@ thread via mutex calls in \CFA or channel assignment in Go.
+
+Figure~\ref{f:DirectCommunicationDatingService} shows the dating-service problem in Figure~\ref{f:DatingServiceMonitor} extended from indirect monitor communication to direct thread communication.
+When converting a monitor to a thread (server), the coding pattern is to move as much code as possible from the accepted members into the thread main so it does an much work as possible.
+Notice, the dating server is postponing requests for an unspecified time while continuing to accept new requests.
+For complex servers (web-servers), there can be hundreds of lines of code in the thread main and safe interaction with clients can be complex.
 
 
@@ -2537,5 +2736,5 @@
 
 For completeness and efficiency, \CFA provides a standard set of low-level locks: recursive mutex, condition, semaphore, barrier, \etc, and atomic instructions: @fetchAssign@, @fetchAdd@, @testSet@, @compareSet@, \etc.
-Some of these low-level mechanism are used in the \CFA runtime, but we strongly advocate using high-level mechanisms whenever possible.
+Some of these low-level mechanism are used to build the \CFA runtime, but we always advocate using high-level mechanisms whenever possible.
 
 
@@ -2580,5 +2779,5 @@
 \begin{cfa}
 struct Adder {
-    int * row, cols;
+	int * row, cols;
 };
 int operator()() {
@@ -2639,5 +2838,8 @@
 \label{s:RuntimeStructureCluster}
 
-A \newterm{cluster} is a collection of threads and virtual processors (abstract kernel-thread) that execute the (user) threads from its own ready queue (like an OS executing kernel threads).
+A \newterm{cluster} is a collection of user and kernel threads, where the kernel threads run the user threads from the cluster's ready queue, and the operating system runs the kernel threads on the processors from its ready queue.
+The term \newterm{virtual processor} is introduced as a synonym for kernel thread to disambiguate between user and kernel thread.
+From the language perspective, a virtual processor is an actual processor (core).
+
 The purpose of a cluster is to control the amount of parallelism that is possible among threads, plus scheduling and other execution defaults.
 The default cluster-scheduler is single-queue multi-server, which provides automatic load-balancing of threads on processors.
@@ -2658,7 +2860,7 @@
 Programs may use more virtual processors than hardware processors.
 On a multiprocessor, kernel threads are distributed across the hardware processors resulting in virtual processors executing in parallel.
-(It is possible to use affinity to lock a virtual processor onto a particular hardware processor~\cite{affinityLinux, affinityWindows, affinityFreebsd, affinityNetbsd, affinityMacosx}, which is used when caching issues occur or for heterogeneous hardware processors.)
+(It is possible to use affinity to lock a virtual processor onto a particular hardware processor~\cite{affinityLinux,affinityWindows}, which is used when caching issues occur or for heterogeneous hardware processors.) %, affinityFreebsd, affinityNetbsd, affinityMacosx
 The \CFA runtime attempts to block unused processors and unblock processors as the system load increases;
-balancing the workload with processors is difficult because it requires future knowledge, \ie what will the applicaton workload do next.
+balancing the workload with processors is difficult because it requires future knowledge, \ie what will the application workload do next.
 Preemption occurs on virtual processors rather than user threads, via operating-system interrupts.
 Thus virtual processors execute user threads, where preemption frequency applies to a virtual processor, so preemption occurs randomly across the executed user threads.
@@ -2695,19 +2897,15 @@
 Nondeterministic preemption provides fairness from long-running threads, and forces concurrent programmers to write more robust programs, rather than relying on code between cooperative scheduling to be atomic.
 This atomic reliance can fail on multi-core machines, because execution across cores is nondeterministic.
-A different reason for not supporting preemption is that it significantly complicates the runtime system, \eg Microsoft runtime does not support interrupts and on Linux systems, interrupts are complex (see below).
+A different reason for not supporting preemption is that it significantly complicates the runtime system, \eg Windows runtime does not support interrupts and on Linux systems, interrupts are complex (see below).
 Preemption is normally handled by setting a countdown timer on each virtual processor.
-When the timer expires, an interrupt is delivered, and the interrupt handler resets the countdown timer, and if the virtual processor is executing in user code, the signal handler performs a user-level context-switch, or if executing in the language runtime kernel, the preemption is ignored or rolled forward to the point where the runtime kernel context switches back to user code.
+When the timer expires, an interrupt is delivered, and its signal handler resets the countdown timer, and if the virtual processor is executing in user code, the signal handler performs a user-level context-switch, or if executing in the language runtime kernel, the preemption is ignored or rolled forward to the point where the runtime kernel context switches back to user code.
 Multiple signal handlers may be pending.
 When control eventually switches back to the signal handler, it returns normally, and execution continues in the interrupted user thread, even though the return from the signal handler may be on a different kernel thread than the one where the signal is delivered.
 The only issue with this approach is that signal masks from one kernel thread may be restored on another as part of returning from the signal handler;
 therefore, the same signal mask is required for all virtual processors in a cluster.
-Because preemption frequency is usually long (1 millisecond) performance cost is negligible.
-
-Linux switched a decade ago from specific to arbitrary process signal-delivery for applications with multiple kernel threads.
-\begin{cquote}
-A process-directed signal may be delivered to any one of the threads that does not currently have the signal blocked.
-If more than one of the threads has the signal unblocked, then the kernel chooses an arbitrary thread to which it will deliver the signal.
-SIGNAL(7) - Linux Programmer's Manual
-\end{cquote}
+Because preemption interval is usually long (1 millisecond) performance cost is negligible.
+
+Linux switched a decade ago from specific to arbitrary virtual-processor signal-delivery for applications with multiple kernel threads.
+In the new semantics, a virtual-processor directed signal may be delivered to any virtual processor created by the application that does not have the signal blocked.
 Hence, the timer-expiry signal, which is generated \emph{externally} by the Linux kernel to an application, is delivered to any of its Linux subprocesses (kernel threads).
 To ensure each virtual processor receives a preemption signal, a discrete-event simulation is run on a special virtual processor, and only it sets and receives timer events.
@@ -2727,68 +2925,42 @@
 \label{s:Performance}
 
-To verify the implementation of the \CFA runtime, a series of microbenchmarks are performed comparing \CFA with pthreads, Java OpenJDK-9, Go 1.12.6 and \uC 7.0.0.
+To test the performance of the \CFA runtime, a series of microbenchmarks are used to compare \CFA with pthreads, Java 11.0.6, Go 1.12.6, Rust 1.37.0, Python 3.7.6, Node.js 12.14.1, and \uC 7.0.0.
 For comparison, the package must be multi-processor (M:N), which excludes libdill/libmil~\cite{libdill} (M:1)), and use a shared-memory programming model, \eg not message passing.
-The benchmark computer is an AMD Opteron\texttrademark\ 6380 NUMA 64-core, 8 socket, 2.5 GHz processor, running Ubuntu 16.04.6 LTS, and \CFA/\uC are compiled with gcc 6.5.
+The benchmark computer is an AMD Opteron\texttrademark\ 6380 NUMA 64-core, 8 socket, 2.5 GHz processor, running Ubuntu 16.04.6 LTS, and pthreads/\CFA/\uC are compiled with gcc 9.2.1.
 
 All benchmarks are run using the following harness. (The Java harness is augmented to circumvent JIT issues.)
 \begin{cfa}
-unsigned int N = 10_000_000;
-#define BENCH( `run` ) Time before = getTimeNsec();  `run;`  Duration result = (getTimeNsec() - before) / N;
-\end{cfa}
-The method used to get time is @clock_gettime( CLOCK_REALTIME )@.
-Each benchmark is performed @N@ times, where @N@ varies depending on the benchmark;
-the total time is divided by @N@ to obtain the average time for a benchmark.
-Each benchmark experiment is run 31 times.
+#define BENCH( `run` ) uint64_t start = cputime_ns();  `run;`  double result = (double)(cputime_ns() - start) / N;
+\end{cfa}
+where CPU time in nanoseconds is from the appropriate language clock.
+Each benchmark is performed @N@ times, where @N@ is selected so the benchmark runs in the range of 2--20 seconds for the specific programming language.
+The total time is divided by @N@ to obtain the average time for a benchmark.
+Each benchmark experiment is run 13 times and the average appears in the table.
 All omitted tests for other languages are functionally identical to the \CFA tests and available online~\cite{CforallBenchMarks}.
-% tar --exclude=.deps --exclude=Makefile --exclude=Makefile.in --exclude=c.c --exclude=cxx.cpp --exclude=fetch_add.c -cvhf benchmark.tar benchmark
-
-\paragraph{Object Creation}
-
-Object creation is measured by creating/deleting the specific kind of concurrent object.
-Figure~\ref{f:creation} shows the code for \CFA, with results in Table~\ref{tab:creation}.
-The only note here is that the call stacks of \CFA coroutines are lazily created, therefore without priming the coroutine to force stack creation, the creation cost is artificially low.
-
-\begin{multicols}{2}
-\lstset{language=CFA,moredelim=**[is][\color{red}]{@}{@},deletedelim=**[is][]{`}{`}}
-\begin{cfa}
-@thread@ MyThread {};
-void @main@( MyThread & ) {}
-int main() {
-	BENCH( for ( N ) { @MyThread m;@ } )
-	sout | result`ns;
-}
-\end{cfa}
-\captionof{figure}{\CFA object-creation benchmark}
-\label{f:creation}
-
-\columnbreak
-
-\vspace*{-16pt}
-\captionof{table}{Object creation comparison (nanoseconds)}
-\label{tab:creation}
-
-\begin{tabular}[t]{@{}r*{3}{D{.}{.}{5.2}}@{}}
-\multicolumn{1}{@{}c}{} & \multicolumn{1}{c}{Median} & \multicolumn{1}{c}{Average} & \multicolumn{1}{c@{}}{Std Dev} \\
-\CFA Coroutine Lazy		& 13.2		& 13.1		& 0.44		\\
-\CFA Coroutine Eager	& 531.3		& 536.0		& 26.54		\\
-\CFA Thread				& 2074.9	& 2066.5	& 170.76	\\
-\uC Coroutine			& 89.6		& 90.5		& 1.83		\\
-\uC Thread				& 528.2		& 528.5		& 4.94		\\
-Goroutine				& 4068.0	& 4113.1	& 414.55	\\
-Java Thread				& 103848.5	& 104295.4	& 2637.57	\\
-Pthreads				& 33112.6	& 33127.1	& 165.90
-\end{tabular}
-\end{multicols}
-
-
-\paragraph{Context-Switching}
+% tar --exclude-ignore=exclude -cvhf benchmark.tar benchmark
+
+\paragraph{Context Switching}
 
 In procedural programming, the cost of a function call is important as modularization (refactoring) increases.
-(In many cases, a compiler inlines function calls to eliminate this cost.)
-Similarly, when modularization extends to coroutines/tasks, the time for a context switch becomes a relevant factor.
+(In many cases, a compiler inlines function calls to increase the size and number of basic blocks for optimizing.)
+Similarly, when modularization extends to coroutines/threads, the time for a context switch becomes a relevant factor.
 The coroutine test is from resumer to suspender and from suspender to resumer, which is two context switches.
+%For async-await systems, the test is scheduling and fulfilling @N@ empty promises, where all promises are allocated before versus interleaved with fulfillment to avoid garbage collection.
+For async-await systems, the test measures the cost of the @await@ expression entering the event engine by awaiting @N@ promises, where each created promise is resolved by an immediate event in the engine (using Node.js @setImmediate@).
 The thread test is using yield to enter and return from the runtime kernel, which is two context switches.
 The difference in performance between coroutine and thread context-switch is the cost of scheduling for threads, whereas coroutines are self-scheduling.
-Figure~\ref{f:ctx-switch} only shows the \CFA code for coroutines/threads (other systems are similar) with all results in Table~\ref{tab:ctx-switch}.
+Figure~\ref{f:ctx-switch} shows the \CFA code for a coroutine/thread with results in Table~\ref{t:ctx-switch}.
+
+% From: Gregor Richards <gregor.richards@uwaterloo.ca>
+% To: "Peter A. Buhr" <pabuhr@plg2.cs.uwaterloo.ca>
+% Date: Fri, 24 Jan 2020 13:49:18 -0500
+% 
+% I can also verify that the previous version, which just tied a bunch of promises together, *does not* go back to the
+% event loop at all in the current version of Node. Presumably they're taking advantage of the fact that the ordering of
+% events is intentionally undefined to just jump right to the next 'then' in the chain, bypassing event queueing
+% entirely. That's perfectly correct behavior insofar as its difference from the specified behavior isn't observable, but
+% it isn't typical or representative of much anything useful, because most programs wouldn't have whole chains of eager
+% promises. Also, it's not representative of *anything* you can do with async/await, as there's no way to encode such an
+% eager chain that way.
 
 \begin{multicols}{2}
@@ -2796,12 +2968,12 @@
 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
 @coroutine@ C {} c;
-void main( C & ) { for ( ;; ) { @suspend;@ } }
+void main( C & ) { while () { @suspend;@ } }
 int main() { // coroutine test
 	BENCH( for ( N ) { @resume( c );@ } )
-	sout | result`ns;
-}
-int main() { // task test
+	sout | result;
+}
+int main() { // thread test
 	BENCH( for ( N ) { @yield();@ } )
-	sout | result`ns;
+	sout | result;
 }
 \end{cfa}
@@ -2813,58 +2985,73 @@
 \vspace*{-16pt}
 \captionof{table}{Context switch comparison (nanoseconds)}
-\label{tab:ctx-switch}
+\label{t:ctx-switch}
 \begin{tabular}{@{}r*{3}{D{.}{.}{3.2}}@{}}
 \multicolumn{1}{@{}c}{} & \multicolumn{1}{c}{Median} &\multicolumn{1}{c}{Average} & \multicolumn{1}{c@{}}{Std Dev} \\
-C function		& 1.8	& 1.8	& 0.01	\\
-\CFA generator	& 2.4	& 2.2	& 0.25	\\
-\CFA Coroutine	& 36.2	& 36.2	& 0.25	\\
-\CFA Thread		& 93.2	& 93.5	& 2.09	\\
-\uC Coroutine	& 52.0	& 52.1	& 0.51	\\
-\uC Thread		& 96.2	& 96.3	& 0.58	\\
-Goroutine		& 141.0	& 141.3	& 3.39	\\
-Java Thread		& 374.0	& 375.8	& 10.38	\\
-Pthreads Thread	& 361.0	& 365.3 & 13.19
+C function			& 1.8		& 1.8		& 0.0	\\
+\CFA generator		& 1.8		& 1.8		& 0.1	\\
+\CFA coroutine		& 32.5		& 32.9		& 0.8	\\
+\CFA thread			& 93.8		& 93.6		& 2.2	\\
+\uC coroutine		& 50.3		& 50.3		& 0.2	\\
+\uC thread			& 97.3		& 97.4		& 1.0	\\
+Python generator	& 40.9		& 41.3		& 1.5	\\
+Node.js generator	& 32.6		& 32.2		& 1.0	\\
+Node.js await		& 1852.2	& 1854.7	& 16.4	\\
+Goroutine thread	& 143.0		& 143.3		& 1.1	\\
+Rust thread			& 332.0		& 331.4		& 2.4	\\
+Java thread			& 405.0		& 415.0		& 17.6	\\
+Pthreads thread		& 334.3		& 335.2		& 3.9
 \end{tabular}
 \end{multicols}
 
-
-\paragraph{Mutual-Exclusion}
-
-Uncontented mutual exclusion, which frequently occurs, is measured by entering/leaving a critical section.
-For monitors, entering and leaving a monitor function is measured.
-To put the results in context, the cost of entering a non-inline function and the cost of acquiring and releasing a @pthread_mutex@ lock is also measured.
-Figure~\ref{f:mutex} shows the code for \CFA with all results in Table~\ref{tab:mutex}.
+\paragraph{Internal Scheduling}
+
+Internal scheduling is measured using a cycle of two threads signalling and waiting.
+Figure~\ref{f:schedint} shows the code for \CFA, with results in Table~\ref{t:schedint}.
 Note, the incremental cost of bulk acquire for \CFA, which is largely a fixed cost for small numbers of mutex objects.
+Java scheduling is significantly greater because the benchmark explicitly creates multiple thread in order to prevent the JIT from making the program sequential, \ie removing all locking.
 
 \begin{multicols}{2}
 \lstset{language=CFA,moredelim=**[is][\color{red}]{@}{@},deletedelim=**[is][]{`}{`}}
 \begin{cfa}
+volatile int go = 0;
+@condition c;@
 @monitor@ M {} m1/*, m2, m3, m4*/;
-void __attribute__((noinline))
-do_call( M & @mutex m/*, m2, m3, m4*/@ ) {}
+void call( M & @mutex p1/*, p2, p3, p4*/@ ) {
+	@signal( c );@
+}
+void wait( M & @mutex p1/*, p2, p3, p4*/@ ) {
+	go = 1;	// continue other thread
+	for ( N ) { @wait( c );@ } );
+}
+thread T {};
+void main( T & ) {
+	while ( go == 0 ) { yield(); } // waiter must start first
+	BENCH( for ( N ) { call( m1/*, m2, m3, m4*/ ); } )
+	sout | result;
+}
 int main() {
-	BENCH(
-		for( N ) do_call( m1/*, m2, m3, m4*/ );
-	)
-	sout | result`ns;
-}
-\end{cfa}
-\captionof{figure}{\CFA acquire/release mutex benchmark}
-\label{f:mutex}
+	T t;
+	wait( m1/*, m2, m3, m4*/ );
+}
+\end{cfa}
+\captionof{figure}{\CFA Internal-scheduling benchmark}
+\label{f:schedint}
 
 \columnbreak
 
 \vspace*{-16pt}
-\captionof{table}{Mutex comparison (nanoseconds)}
-\label{tab:mutex}
-\begin{tabular}{@{}r*{3}{D{.}{.}{3.2}}@{}}
-\multicolumn{1}{@{}c}{} & \multicolumn{1}{c}{Median} &\multicolumn{1}{c}{Average} & \multicolumn{1}{c@{}}{Std Dev} \\
-test and test-and-test lock		& 19.1	& 18.9	& 0.40	\\
-\CFA @mutex@ function, 1 arg.	& 45.9	& 46.6	& 1.45	\\
-\CFA @mutex@ function, 2 arg.	& 105.0	& 104.7	& 3.08	\\
-\CFA @mutex@ function, 4 arg.	& 165.0	& 167.6	& 5.65	\\
-\uC @monitor@ member rtn.		& 54.0	& 53.7	& 0.82	\\
-Java synchronized method		& 31.0	& 31.1	& 0.50	\\
-Pthreads Mutex Lock				& 33.6	& 32.6	& 1.14
+\captionof{table}{Internal-scheduling comparison (nanoseconds)}
+\label{t:schedint}
+\bigskip
+
+\begin{tabular}{@{}r*{3}{D{.}{.}{5.2}}@{}}
+\multicolumn{1}{@{}c}{} & \multicolumn{1}{c}{Median} & \multicolumn{1}{c}{Average} & \multicolumn{1}{c@{}}{Std Dev} \\
+\CFA @signal@, 1 monitor	& 364.4		& 364.2		& 4.4		\\
+\CFA @signal@, 2 monitor	& 484.4		& 483.9		& 8.8		\\
+\CFA @signal@, 4 monitor	& 709.1		& 707.7		& 15.0		\\
+\uC @signal@ monitor		& 328.3		& 327.4		& 2.4		\\
+Rust cond. variable			& 7514.0	& 7437.4	& 397.2		\\
+Java @notify@ monitor		& 9623.0	& 9654.6	& 236.2		\\
+Pthreads cond. variable		& 5553.7	& 5576.1	& 345.6
 \end{tabular}
 \end{multicols}
@@ -2874,5 +3061,5 @@
 
 External scheduling is measured using a cycle of two threads calling and accepting the call using the @waitfor@ statement.
-Figure~\ref{f:ext-sched} shows the code for \CFA, with results in Table~\ref{tab:ext-sched}.
+Figure~\ref{f:schedext} shows the code for \CFA with results in Table~\ref{t:schedext}.
 Note, the incremental cost of bulk acquire for \CFA, which is largely a fixed cost for small numbers of mutex objects.
 
@@ -2881,27 +3068,21 @@
 \vspace*{-16pt}
 \begin{cfa}
-volatile int go = 0;
-@monitor@ M {} m;
+@monitor@ M {} m1/*, m2, m3, m4*/;
+void call( M & @mutex p1/*, p2, p3, p4*/@ ) {}
+void wait( M & @mutex p1/*, p2, p3, p4*/@ ) {
+	for ( N ) { @waitfor( call : p1/*, p2, p3, p4*/ );@ }
+}
 thread T {};
-void __attribute__((noinline))
-do_call( M & @mutex@ ) {}
 void main( T & ) {
-	while ( go == 0 ) { yield(); }
-	while ( go == 1 ) { do_call( m ); }
-}
-int __attribute__((noinline))
-do_wait( M & @mutex@ m ) {
-	go = 1;	// continue other thread
-	BENCH( for ( N ) { @waitfor( do_call, m );@ } )
-	go = 0;	// stop other thread
-	sout | result`ns;
+	BENCH( for ( N ) { call( m1/*, m2, m3, m4*/ ); } )
+	sout | result;
 }
 int main() {
 	T t;
-	do_wait( m );
+	wait( m1/*, m2, m3, m4*/ );
 }
 \end{cfa}
 \captionof{figure}{\CFA external-scheduling benchmark}
-\label{f:ext-sched}
+\label{f:schedext}
 
 \columnbreak
@@ -2909,67 +3090,112 @@
 \vspace*{-16pt}
 \captionof{table}{External-scheduling comparison (nanoseconds)}
-\label{tab:ext-sched}
+\label{t:schedext}
 \begin{tabular}{@{}r*{3}{D{.}{.}{3.2}}@{}}
 \multicolumn{1}{@{}c}{} & \multicolumn{1}{c}{Median} &\multicolumn{1}{c}{Average} & \multicolumn{1}{c@{}}{Std Dev} \\
-\CFA @waitfor@, 1 @monitor@	& 376.4	& 376.8	& 7.63	\\
-\CFA @waitfor@, 2 @monitor@	& 491.4	& 492.0	& 13.31	\\
-\CFA @waitfor@, 4 @monitor@	& 681.0	& 681.7	& 19.10	\\
-\uC @_Accept@				& 331.1	& 331.4	& 2.66
+\CFA @waitfor@, 1 monitor	& 367.1	& 365.3	& 5.0	\\
+\CFA @waitfor@, 2 monitor	& 463.0	& 464.6	& 7.1	\\
+\CFA @waitfor@, 4 monitor	& 689.6	& 696.2	& 21.5	\\
+\uC \lstinline[language=uC++]|_Accept| monitor	& 328.2	& 329.1	& 3.4	\\
+Go \lstinline[language=Golang]|select| channel	& 365.0	& 365.5	& 1.2
 \end{tabular}
 \end{multicols}
 
-
-\paragraph{Internal Scheduling}
-
-Internal scheduling is measured using a cycle of two threads signalling and waiting.
-Figure~\ref{f:int-sched} shows the code for \CFA, with results in Table~\ref{tab:int-sched}.
-Note, the incremental cost of bulk acquire for \CFA, which is largely a fixed cost for small numbers of mutex objects.
-Java scheduling is significantly greater because the benchmark explicitly creates multiple thread in order to prevent the JIT from making the program sequential, \ie removing all locking.
+\paragraph{Mutual-Exclusion}
+
+Uncontented mutual exclusion, which frequently occurs, is measured by entering/leaving a critical section.
+For monitors, entering and leaving a monitor function is measured, otherwise the language-appropriate mutex-lock is measured.
+For comparison, a spinning (versus blocking) test-and-test-set lock is presented.
+Figure~\ref{f:mutex} shows the code for \CFA with results in Table~\ref{t:mutex}.
+Note the incremental cost of bulk acquire for \CFA, which is largely a fixed cost for small numbers of mutex objects.
 
 \begin{multicols}{2}
 \lstset{language=CFA,moredelim=**[is][\color{red}]{@}{@},deletedelim=**[is][]{`}{`}}
 \begin{cfa}
-volatile int go = 0;
-@monitor@ M { @condition c;@ } m;
-void __attribute__((noinline))
-do_call( M & @mutex@ a1 ) { @signal( c );@ }
-thread T {};
-void main( T & this ) {
-	while ( go == 0 ) { yield(); }
-	while ( go == 1 ) { do_call( m ); }
-}
-int  __attribute__((noinline))
-do_wait( M & mutex m ) with(m) {
-	go = 1;	// continue other thread
-	BENCH( for ( N ) { @wait( c );@ } );
-	go = 0;	// stop other thread
-	sout | result`ns;
-}
+@monitor@ M {} m1/*, m2, m3, m4*/;
+call( M & @mutex p1/*, p2, p3, p4*/@ ) {}
 int main() {
-	T t;
-	do_wait( m );
-}
-\end{cfa}
-\captionof{figure}{\CFA Internal-scheduling benchmark}
-\label{f:int-sched}
+	BENCH( for( N ) call( m1/*, m2, m3, m4*/ ); )
+	sout | result;
+}
+\end{cfa}
+\captionof{figure}{\CFA acquire/release mutex benchmark}
+\label{f:mutex}
 
 \columnbreak
 
 \vspace*{-16pt}
-\captionof{table}{Internal-scheduling comparison (nanoseconds)}
-\label{tab:int-sched}
-\bigskip
-
-\begin{tabular}{@{}r*{3}{D{.}{.}{5.2}}@{}}
-\multicolumn{1}{@{}c}{} & \multicolumn{1}{c}{Median} & \multicolumn{1}{c}{Average} & \multicolumn{1}{c@{}}{Std Dev} \\
-\CFA @signal@, 1 @monitor@	& 372.6		& 374.3		& 14.17		\\
-\CFA @signal@, 2 @monitor@	& 492.7		& 494.1		& 12.99		\\
-\CFA @signal@, 4 @monitor@	& 749.4		& 750.4		& 24.74		\\
-\uC @signal@				& 320.5		& 321.0		& 3.36		\\
-Java @notify@				& 10160.5	& 10169.4	& 267.71	\\
-Pthreads Cond. Variable		& 4949.6	& 5065.2	& 363
+\captionof{table}{Mutex comparison (nanoseconds)}
+\label{t:mutex}
+\begin{tabular}{@{}r*{3}{D{.}{.}{3.2}}@{}}
+\multicolumn{1}{@{}c}{} & \multicolumn{1}{c}{Median} &\multicolumn{1}{c}{Average} & \multicolumn{1}{c@{}}{Std Dev} \\
+test-and-test-set lock			& 19.1	& 18.9	& 0.4	\\
+\CFA @mutex@ function, 1 arg.	& 48.3	& 47.8	& 0.9	\\
+\CFA @mutex@ function, 2 arg.	& 86.7	& 87.6	& 1.9	\\
+\CFA @mutex@ function, 4 arg.	& 173.4	& 169.4	& 5.9	\\
+\uC @monitor@ member rtn.		& 54.8	& 54.8	& 0.1	\\
+Goroutine mutex lock			& 34.0	& 34.0	& 0.0	\\
+Rust mutex lock					& 33.0	& 33.2	& 0.8	\\
+Java synchronized method		& 31.0	& 31.0	& 0.0	\\
+Pthreads mutex Lock				& 31.0	& 31.1	& 0.4
 \end{tabular}
 \end{multicols}
 
+\paragraph{Creation}
+
+Creation is measured by creating/deleting a specific kind of control-flow object.
+Figure~\ref{f:creation} shows the code for \CFA with results in Table~\ref{t:creation}.
+Note, the call stacks of \CFA coroutines are lazily created on the first resume, therefore the cost of creation with and without a stack are presented.
+
+\begin{multicols}{2}
+\lstset{language=CFA,moredelim=**[is][\color{red}]{@}{@},deletedelim=**[is][]{`}{`}}
+\begin{cfa}
+@coroutine@ MyCoroutine {};
+void ?{}( MyCoroutine & this ) {
+#ifdef EAGER
+	resume( this );
+#endif
+}
+void main( MyCoroutine & ) {}
+int main() {
+	BENCH( for ( N ) { @MyCoroutine c;@ } )
+	sout | result;
+}
+\end{cfa}
+\captionof{figure}{\CFA creation benchmark}
+\label{f:creation}
+
+\columnbreak
+
+\vspace*{-16pt}
+\captionof{table}{Creation comparison (nanoseconds)}
+\label{t:creation}
+
+\begin{tabular}[t]{@{}r*{3}{D{.}{.}{5.2}}@{}}
+\multicolumn{1}{@{}c}{} & \multicolumn{1}{c}{Median} & \multicolumn{1}{c}{Average} & \multicolumn{1}{c@{}}{Std Dev} \\
+\CFA generator			& 0.6		& 0.6		& 0.0		\\
+\CFA coroutine lazy		& 13.4		& 13.1		& 0.5		\\
+\CFA coroutine eager	& 144.7		& 143.9		& 1.5		\\
+\CFA thread				& 466.4		& 468.0		& 11.3		\\
+\uC coroutine			& 155.6		& 155.7		& 1.7		\\
+\uC thread				& 523.4		& 523.9		& 7.7		\\
+Python generator		& 123.2		& 124.3		& 4.1		\\
+Node.js generator		& 32.3		& 32.2		& 0.3		\\
+Goroutine thread		& 751.0		& 750.5		& 3.1		\\
+Rust thread				& 53801.0	& 53896.8	& 274.9		\\
+Java thread				& 120274.0	& 120722.9	& 2356.7	\\
+Pthreads thread			& 31465.5	& 31419.5	& 140.4
+\end{tabular}
+\end{multicols}
+
+
+\subsection{Discussion}
+
+Languages using 1:1 threading based on pthreads can at best meet or exceed (due to language overhead) the pthread results.
+Note, pthreads has a fast zero-contention mutex lock checked in user space.
+Languages with M:N threading have better performance than 1:1 because there is no operating-system interactions.
+Languages with stackful coroutines have higher cost than stackless coroutines because of stack allocation and context switching;
+however, stackful \uC and \CFA coroutines have approximately the same performance as stackless Python and Node.js generators.
+The \CFA stackless generator is approximately 25 times faster for suspend/resume and 200 times faster for creation than stackless Python and Node.js generators.
+
 
 \section{Conclusion}
@@ -2977,13 +3203,14 @@
 Advanced control-flow will always be difficult, especially when there is temporal ordering and nondeterminism.
 However, many systems exacerbate the difficulty through their presentation mechanisms.
-This paper shows it is possible to present a hierarchy of control-flow features, generator, coroutine, thread, and monitor, providing an integrated set of high-level, efficient, and maintainable control-flow features.
-Eliminated from \CFA are spurious wakeup and barging, which are nonintuitive and lead to errors, and having to work with a bewildering set of low-level locks and acquisition techniques.
-\CFA high-level race-free monitors and tasks provide the core mechanisms for mutual exclusion and synchronization, without having to resort to magic qualifiers like @volatile@/@atomic@.
+This paper shows it is possible to understand high-level control-flow using three properties: statefulness, thread, mutual-exclusion/synchronization.
+Combining these properties creates a number of high-level, efficient, and maintainable control-flow types: generator, coroutine, thread, each of which can be a monitor.
+Eliminated from \CFA are barging and spurious wakeup, which are nonintuitive and lead to errors, and having to work with a bewildering set of low-level locks and acquisition techniques.
+\CFA high-level race-free monitors and threads provide the core mechanisms for mutual exclusion and synchronization, without having to resort to magic qualifiers like @volatile@/@atomic@.
 Extending these mechanisms to handle high-level deadlock-free bulk acquire across both mutual exclusion and synchronization is a unique contribution.
 The \CFA runtime provides concurrency based on a preemptive M:N user-level threading-system, executing in clusters, which encapsulate scheduling of work on multiple kernel threads providing parallelism.
 The M:N model is judged to be efficient and provide greater flexibility than a 1:1 threading model.
 These concepts and the \CFA runtime-system are written in the \CFA language, extensively leveraging the \CFA type-system, which demonstrates the expressiveness of the \CFA language.
-Performance comparisons with other concurrent systems/languages show the \CFA approach is competitive across all low-level operations, which translates directly into good performance in well-written concurrent applications.
-C programmers should feel comfortable using these mechanisms for developing complex control-flow in applications, with the ability to obtain maximum available performance by selecting mechanisms at the appropriate level of need.
+Performance comparisons with other concurrent systems/languages show the \CFA approach is competitive across all basic operations, which translates directly into good performance in well-written applications with advanced control-flow.
+C programmers should feel comfortable using these mechanisms for developing complex control-flow in applications, with the ability to obtain maximum available performance by selecting mechanisms at the appropriate level of need using only calling communication.
 
 
@@ -3005,5 +3232,5 @@
 \label{futur:nbio}
 
-Many modern workloads are not bound by computation but IO operations, a common case being web servers and XaaS~\cite{XaaS} (anything as a service).
+Many modern workloads are not bound by computation but IO operations, common cases being web servers and XaaS~\cite{XaaS} (anything as a service).
 These types of workloads require significant engineering to amortizing costs of blocking IO-operations.
 At its core, non-blocking I/O is an operating-system level feature queuing IO operations, \eg network operations, and registering for notifications instead of waiting for requests to complete.
@@ -3033,9 +3260,9 @@
 \section{Acknowledgements}
 
-The authors would like to recognize the design assistance of Aaron Moss, Rob Schluntz, Andrew Beach and Michael Brooks on the features described in this paper.
-Funding for this project has been provided by Huawei Ltd.\ (\url{http://www.huawei.com}). %, and Peter Buhr is partially funded by the Natural Sciences and Engineering Research Council of Canada.
+The authors recognize the design assistance of Aaron Moss, Rob Schluntz, Andrew Beach, and Michael Brooks; David Dice for commenting and helping with the Java benchmarks; and Gregor Richards for helping with the Node.js benchmarks.
+This research is funded by a grant from Waterloo-Huawei (\url{http://www.huawei.com}) Joint Innovation Lab. %, and Peter Buhr is partially funded by the Natural Sciences and Engineering Research Council of Canada.
 
 {%
-\fontsize{9bp}{12bp}\selectfont%
+\fontsize{9bp}{11.5bp}\selectfont%
 \bibliography{pl,local}
 }%
Index: doc/papers/concurrency/examples/DatingServiceThread.cfa
===================================================================
--- doc/papers/concurrency/examples/DatingServiceThread.cfa	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
+++ doc/papers/concurrency/examples/DatingServiceThread.cfa	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -0,0 +1,110 @@
+#include <stdlib.hfa>									// random
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <thread.hfa>
+#include <unistd.h>										// getpid
+
+enum { CompCodes = 20 };								// number of compatibility codes
+
+thread DatingService {
+	condition Girls[CompCodes], Boys[CompCodes];
+	unsigned int girlPhoneNo, boyPhoneNo, ccode;
+}; // DatingService
+
+unsigned int girl( DatingService & mutex ds, unsigned int phoneno, unsigned int code ) with( ds ) {
+	girlPhoneNo = phoneno;  ccode = code;
+	wait( Girls[ccode] );								// wait for boy
+	girlPhoneNo = phoneno;
+	sout | "Girl:" | girlPhoneNo | "is dating Boy at" | boyPhoneNo | "with ccode" | ccode;
+	return boyPhoneNo;
+} // DatingService girl
+
+unsigned int boy( DatingService & mutex ds, unsigned int phoneno, unsigned int code ) with( ds ) {
+	boyPhoneNo = phoneno;  ccode = code;
+	wait( Boys[ccode] );								// wait for girl
+	boyPhoneNo = phoneno;
+	sout | " Boy:" | boyPhoneNo | "is dating Girl" | girlPhoneNo | "with ccode" | ccode;
+	return girlPhoneNo;
+} // DatingService boy
+
+void main( DatingService & ds ) with( ds ) {			// thread starts
+	for () {
+		waitfor( ^?{} : ds ) {
+			break;
+		} or waitfor( girl : ds ) {
+			if ( ! is_empty( Boys[ccode] ) ) {			// no compatible boy ?
+				signal_block( Boys[ccode] );			// restart boy to set phone number
+				signal_block( Girls[ccode] );			// restart girl to set phone number
+			} // if
+		} or waitfor( boy : ds ) {
+			if ( ! is_empty( Girls[ccode] ) ) {			// no compatible girl ?
+				signal_block( Girls[ccode] );			// restart girl to set phone number
+				signal_block( Boys[ccode] );			// restart boy to set phone number
+			} // if
+		}
+	}
+} // DatingService main
+
+unsigned int girlck[CompCodes];
+unsigned int boyck[CompCodes];
+
+thread Girl {
+	DatingService & TheExchange;
+	unsigned int id, ccode;
+}; // Girl
+
+void main( Girl & g ) with( g ) {
+	yield( random( 100 ) );								// do not start at the same time
+	unsigned int partner = girl( TheExchange, id, ccode );
+	girlck[id] = partner;
+} // Girl main
+
+void ?{}( Girl & g, DatingService * TheExchange, unsigned int id, unsigned int ccode ) {
+	&g.TheExchange = TheExchange;
+	g.id = id;
+	g.ccode = ccode;
+} // Girl ?{}
+
+thread Boy {
+	DatingService & TheExchange;
+	unsigned int id, ccode;
+}; // Boy
+
+void main( Boy & b ) with( b ) {
+	yield( random( 100 ) );								// don't all start at the same time
+	unsigned int partner = boy( TheExchange, id, ccode );
+	boyck[id] = partner;
+} // Boy main
+
+void ?{}( Boy & b, DatingService * TheExchange, unsigned int id, unsigned int ccode ) {
+	&b.TheExchange = TheExchange;
+	b.id = id;
+	b.ccode = ccode;
+} // Boy ?{}
+
+int main() {
+	DatingService TheExchange;
+	Girl * girls[CompCodes];
+	Boy  * boys[CompCodes];
+
+	srandom( /*getpid()*/ 103 );
+
+	for ( i; (unsigned int)CompCodes ) {
+		girls[i] = new( &TheExchange, i, i );			// TheExchange constructor needs unsigned int
+		boys[i]  = new( &TheExchange, i, CompCodes - ( i + 1 ) );
+	} // for
+
+	for ( i; CompCodes ) {
+		delete( boys[i] );
+		delete( girls[i] );
+	} // for
+
+	for ( i; CompCodes ) {
+		if ( girlck[ boyck[i] ] != boyck[ girlck[i] ] ) abort();
+	} // for
+} // main
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa DatingServiceThread.cfa" //
+// End: //
Index: doc/papers/concurrency/examples/Fib.js
===================================================================
--- doc/papers/concurrency/examples/Fib.js	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
+++ doc/papers/concurrency/examples/Fib.js	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -0,0 +1,18 @@
+function * fib() {
+	var fn1 = 1, fn = 0;
+	while ( true ) {
+		var ret = fn; fn = fn1; fn1 = fn + ret;
+		yield ret;
+	} // while
+}
+
+f1 = fib();
+f2 = fib();
+for ( var i = fib.length; i < 10; i += 1 ) {
+	console.log( f1.next().value, f2.next().value );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "node Fib.js" //
+// End: //
Index: doc/papers/concurrency/examples/Fib.py
===================================================================
--- doc/papers/concurrency/examples/Fib.py	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Fib.py	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -4,6 +4,4 @@
 	while True:
 		fn = fn1 + fn2; fn2 = fn1; fn1 = fn; yield fn
-
-
 
 f1 = Fib()
@@ -14,4 +12,4 @@
 # Local Variables: #
 # tab-width: 4 #
-# compile-command: "python3.5 Fib.py" #
+# compile-command: "python3.7 Fib.py" #
 # End: #
Index: doc/papers/concurrency/examples/Fib2.c
===================================================================
--- doc/papers/concurrency/examples/Fib2.c	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Fib2.c	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -1,26 +1,19 @@
 #include <stdio.h>
 
-void mary() {
-	printf( "MARY\n" );
-}
-
 #define FIB_INIT { 0 }
-typedef struct { int next; int fn1, fn2; } Fib;
+typedef struct { int restart; int fn1, fn2; } Fib;
 int fib( Fib * f ) {
-	static void * states[] = { &&s1, &&s2, &&s3 };
-	goto *states[f->next];
+	static void * states[] = { &&s0, &&s1, &&s2 };
+	goto *states[f->restart];
+  s0:
+	f->fn1 = 0;
+	f->restart = 1;
+	return f->fn1;
   s1:
-	mary();
-	f->fn1 = 0;
-	f->next = 1;
-	return f->fn1;
-  s2:
-	mary();
 	f->fn2 = f->fn1;
 	f->fn1 = 1;
-	f->next = 2;
+	f->restart = 2;
 	return f->fn1;
-  s3:;
-	mary();
+  s2:;
 	int fn = f->fn1 + f->fn2;
 	f->fn2 = f->fn1;
Index: doc/papers/concurrency/examples/Fib2.py
===================================================================
--- doc/papers/concurrency/examples/Fib2.py	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Fib2.py	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -1,6 +1,6 @@
 def Fib():
-    fn1, fn = 0, 1
+    fn1, fn = 1, 0
     while True:
-        yield fn1
+        yield fn
         fn1, fn = fn, fn1 + fn
 
@@ -12,4 +12,4 @@
 # Local Variables: #
 # tab-width: 4 #
-# compile-command: "python3.5 Fib2.py" #
+# compile-command: "python3.7 Fib2.py" #
 # End: #
Index: doc/papers/concurrency/examples/Fib3.c
===================================================================
--- doc/papers/concurrency/examples/Fib3.c	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Fib3.c	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -2,12 +2,12 @@
 
 typedef struct {
-	int fn1, fn;
-	void * next;
+	int restart, fn1, fn;
 } Fib;
-#define FibCtor { 1, 0, NULL }
+#define FibCtor { 0, 1, 0 }
 
 Fib * comain( Fib * f ) {
-	if ( __builtin_expect(f->next != 0, 1) ) goto *f->next;
-	f->next = &&s1;
+	static void * states[] = {&&s0, &&s1};
+	goto *states[f->restart];
+  s0: f->restart = 1;
 	for ( ;; ) {
 		return f;
Index: doc/papers/concurrency/examples/FibRefactor.py
===================================================================
--- doc/papers/concurrency/examples/FibRefactor.py	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/FibRefactor.py	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -22,4 +22,4 @@
 # Local Variables: #
 # tab-width: 4 #
-# compile-command: "python3.5 FibRefactor.py" #
+# compile-command: "python3.7 FibRefactor.py" #
 # End: #
Index: doc/papers/concurrency/examples/Format.c
===================================================================
--- doc/papers/concurrency/examples/Format.c	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Format.c	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -2,17 +2,18 @@
 
 typedef struct {
-	void * next;
+	int restart, g, b;
 	char ch;
-	int g, b;
 } Fmt;
 
 void comain( Fmt * f ) {
-	if ( __builtin_expect(f->next != 0, 1) ) goto *f->next;
-	f->next = &&s1;
+	static void * states[] = {&&s0, &&s1};
+	goto *states[f->restart];
+  s0: f->restart = 1;
 	for ( ;; ) {
 		for ( f->g = 0; f->g < 5; f->g += 1 ) {			// groups
 			for ( f->b = 0; f->b < 4; f->b += 1 ) {		// blocks
-				return;
-			  s1:;  while ( f->ch == '\n' ) return;		// ignore
+				do {
+					return;  s1: ;
+				} while ( f->ch == '\n' );				// ignore
 				printf( "%c", f->ch );					// print character
 			}
@@ -24,5 +25,5 @@
 
 int main() {
-	Fmt fmt = { NULL };
+	Fmt fmt = { 0 };
 	comain( &fmt );										// prime
 	for ( ;; ) {
Index: doc/papers/concurrency/examples/Format.cc
===================================================================
--- doc/papers/concurrency/examples/Format.cc	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Format.cc	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -6,8 +6,8 @@
 			for ( g = 0; g < 5; g += 1 ) { // groups of 5 blocks
 				for ( b = 0; b < 4; b += 1 ) { // blocks of 4 characters
-//					for ( ;; ) { // for newline characters
+					for ( ;; ) { // for newline characters
 						suspend();
-//						if ( ch != '\n' ) break; // ignore newline
-//					}
+						if ( ch != '\n' ) break; // ignore newline
+					}
 //					cout << ch; // print character
 				}
@@ -31,4 +31,4 @@
 // Local Variables: //
 // tab-width: 4 //
-// compile-command: "u++-work -O2 -nodebubg Format.cc" //
+// compile-command: "u++-work -O2 -nodebug Format.cc" //
 // End: //
Index: doc/papers/concurrency/examples/Format.cfa
===================================================================
--- doc/papers/concurrency/examples/Format.cfa	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Format.cfa	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -11,7 +11,7 @@
 		for ( g = 0; g < 5; g += 1 ) {		// groups of 5 blocks
 			for ( b = 0; b < 4; b += 1 ) {	// blocks of 4 characters
-//				do {
+				do {
 					suspend();
-//				} while ( ch == '\n' || ch == '\t' );
+				} while ( ch == '\n' || ch == '\t' );
 				sout | ch;					// print character
 			}
Index: doc/papers/concurrency/examples/Format.data
===================================================================
--- doc/papers/concurrency/examples/Format.data	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Format.data	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -1,1 +1,3 @@
-abcdefghijklmnopqrstuvwxyzxxxxxxxxxxxxxx
+abcdefghijklmnop
+qrstuvwxyzx
+xxxxxxxxxxxxx
Index: doc/papers/concurrency/examples/Format.js
===================================================================
--- doc/papers/concurrency/examples/Format.js	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
+++ doc/papers/concurrency/examples/Format.js	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -0,0 +1,33 @@
+function * Format() {
+	var g, b;
+	fini: while ( true ) {
+		for ( g = 0; g < 5; g += 1 ) {					// groups of 5 blocks
+			for ( b = 0; b < 4; b += 1 ) {				// blocks of 4 characters
+				while ( true ) {
+					ch = (yield)						// receive from send
+					if ( ch == '\0' ) break fini;
+					if ( '\n' != ch ) break
+				}
+				process.stdout.write( ch )				// receive from send
+			}
+			process.stdout.write( '  ' )				// block separator
+		}
+		process.stdout.write( '\n' )					// group separator
+	}
+	if ( g != 0 || b != 0 ) process.stdout.write( '\n' )
+}
+
+var input = "abcdefghijklmnop\nqrstuvwx\nyzxxxxxxxxxxxxx"
+
+fmt = Format()
+fmt.next()												// prime generator
+for ( var i = 0; i < input.length; i += 1 ) {
+	fmt.next( input[i] );								// send to yield
+}
+fmt.next( '\0' );										// EOF
+
+// Local Variables: //
+// comment-column: 56 //
+// tab-width: 4 //
+// compile-command: "node Format.js" //
+// End: //
Index: doc/papers/concurrency/examples/Format.py
===================================================================
--- doc/papers/concurrency/examples/Format.py	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Format.py	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -4,5 +4,9 @@
 			for g in range( 5 ): 	# groups of 5 blocks
 				for b in range( 4 ): # blocks of 4 characters
-					print( (yield), end='' ) # receive from send
+					while True:
+						ch = (yield) # receive from send
+						if '\n' not in ch:
+							break
+					print( ch, end='' ) # receive from send
 				print( '  ', end='' ) # block separator
 			print()					# group separator
@@ -11,11 +15,13 @@
 			print()
 
+input = "abcdefghijklmnop\nqrstuvwx\nyzxxxxxxxxxxxxxx\n"
+
 fmt = Format()
 next( fmt )							# prime generator
-for i in range( 41 ):
-	fmt.send( 'a' );				# send to yield
+for i in input:
+	fmt.send( i );				# send to yield
 
 # Local Variables: #
 # tab-width: 4 #
-# compile-command: "python3.5 Format.py" #
+# compile-command: "python3.7 Format.py" #
 # End: #
Index: doc/papers/concurrency/examples/Format1.c
===================================================================
--- doc/papers/concurrency/examples/Format1.c	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Format1.c	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -2,38 +2,38 @@
 
 typedef struct {
-	void * next;
+	int restart, g, b;
 	char ch;
-	int g, b;
 } Fmt;
 
 void format( Fmt * f ) {
-	if ( __builtin_expect(f->next != 0, 1) ) goto *f->next;
-	f->next = &&s1;
+	static void * states[] = {&&s0, &&s1};
+	goto *states[f->restart];
+  s0: f->restart = 1;
 	for ( ;; ) {
 		for ( f->g = 0; f->g < 5; f->g += 1 ) {			// groups
 			for ( f->b = 0; f->b < 4; f->b += 1 ) {		// blocks
 				return;
-			  s1: ;
-				if ( f->ch == '\0' ) goto fini;			// EOF ?
+			  s1: if ( f->ch == '\0' ) goto fini;		// EOF ?
 				while ( f->ch == '\n' ) return;			// ignore
-				printf( "%c", f->ch );					// print character
+//				printf( "%c", f->ch );					// print character
 			}
-			printf( " " );								// block separator
+//			printf( " " );								// block separator
 		}
-		printf( "\n" );									// group separator
+//		printf( "\n" );									// group separator
 	}
-  fini:
-	if ( f->g != 0 || f->b != 0 ) printf( "\n" );
+  fini:;
+//	if ( f->g != 0 || f->b != 0 ) printf( "\n" );
 }
 
 int main() {
-	Fmt fmt = { NULL };
+	Fmt fmt = { 0 };
 	format( &fmt );										// prime
-	for ( ;; ) {
-		scanf( "%c", &fmt.ch );							// direct read into communication variable
-	  if ( feof( stdin ) ) break;
+	fmt.ch = 'a';
+	for ( long int i = 0; i < 1000000000; i += 1 ) {
+//		scanf( "%c", &fmt.ch );							// direct read into communication variable
+//	  if ( feof( stdin ) ) break;
 		format( &fmt );
 	}
-	fmt.ch = '\0';
+	fmt.ch = '\0';										// sentential (EOF)
 	format( &fmt );
 }
Index: doc/papers/concurrency/examples/PingPong.c
===================================================================
--- doc/papers/concurrency/examples/PingPong.c	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/PingPong.c	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -2,33 +2,16 @@
 
 typedef struct PingPong {
+	int restart;										// style 1
+	int N, i;
 	const char * name;
-	int N, i;
 	struct PingPong * partner;
-	void * next;
+	void * next;										// style 2
 } PingPong;
-#define PPCtor( name, N ) { name, N, 0, NULL, NULL }
+#define PPCtor( name, N ) { 0, N, 0, name, NULL, NULL }
+
 void comain( PingPong * pp ) __attribute__(( noinline ));
 void comain( PingPong * pp ) {
+#if 0
 	if ( __builtin_expect(pp->next != 0, 1) ) goto *pp->next;
-#if 0
-	pp->next = &&here;
-		asm( "mov  %0,%%rdi" : "=m" (pp) );
-		asm( "mov  %rdi,%rax" );
-#ifndef OPT
-#ifdef PRINT
-		asm( "add  $16, %rsp" );
-#endif // PRINT
-		asm( "popq %rbp" );
-#endif // ! OPT
-
-#ifdef OPT
-#ifdef PRINT
-		asm( "popq %rbx" );
-#endif // PRINT
-#endif // OPT
-		asm( "jmp  comain" );
-  here: ;
-#endif // 0
-
 	pp->next = &&cycle;
 	for ( ; pp->i < pp->N; pp->i += 1 ) {
@@ -53,4 +36,32 @@
 	  cycle: ;
 	} // for
+#endif // 0
+
+#if 1
+	static void * states[] = {&&s0, &&s1};
+	goto *states[pp->restart];
+  s0: pp->restart = 1;
+	for ( ; pp->i < pp->N; pp->i += 1 ) {
+#ifdef PRINT
+		printf( "%s %d\n", pp->name, pp->i );
+#endif // PRINT
+		asm( "mov  %0,%%rdi" : "=m" (pp->partner) );
+		asm( "mov  %rdi,%rax" );
+#ifndef OPT
+#ifdef PRINT
+		asm( "add  $16, %rsp" );
+#endif // PRINT
+		asm( "popq %rbp" );
+#endif // ! OPT
+
+#ifdef OPT
+#ifdef PRINT
+		asm( "popq %rbx" );
+#endif // PRINT
+#endif // OPT
+		asm( "jmp  comain" );
+	  s1: ;
+	} // for
+#endif // 0
 }
 
@@ -70,4 +81,4 @@
 // Local Variables: //
 // tab-width: 4 //
-// compile-command: "gcc-8 -g -DPRINT PingPong.c" //
+// compile-command: "gcc-9 -g -DPRINT PingPong.c" //
 // End: //
Index: doc/papers/concurrency/examples/Pingpong.py
===================================================================
--- doc/papers/concurrency/examples/Pingpong.py	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Pingpong.py	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -1,32 +1,35 @@
 def PingPong( name, N ):
-	partner = (yield)           # get partner
-	yield                       # resume scheduler
+	partner = yield				# get partner
+	yield						# resume scheduler
 	for i in range( N ):
 		print( name )
-		yield partner           # execute next
+		yield partner			# execute next
 	print( "end", name )
 
 def Scheduler():
-	n = (yield)                 # starting coroutine
-	while True:
-		n = next( n )           # schedule coroutine
+	n = yield					# starting coroutine
+	try:
+		while True:
+			n = next( n )		# schedule coroutine
+	except StopIteration:
+		pass
 
 pi = PingPong( "ping", 5 )
 po = PingPong( "pong", 5 )
-next( pi )                      # prime
-pi.send( po )                   # send partner
-next( po )                      # prime
-po.send( pi )                   # send partner
+next( pi )						# prime
+pi.send( po )					# send partner
+next( po )						# prime
+po.send( pi )					# send partner
 
 s = Scheduler();
-next( s )                       # prime
+next( s )						# prime
 try:
 	s.send( pi )				# start cycle
-except StopIteration:
-	print( "scheduler stop" )
+except StopIteration:			# scheduler stopped
+	pass
 print( "stop" )
 
 # Local Variables: #
 # tab-width: 4 #
-# compile-command: "python3.5 Pingpong.py" #
+# compile-command: "python3.7 Pingpong.py" #
 # End: #
Index: doc/papers/concurrency/examples/ProdCons.py
===================================================================
--- doc/papers/concurrency/examples/ProdCons.py	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/ProdCons.py	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -1,40 +1,43 @@
 def Prod( N ):
-	cons = (yield)              # get cons
-	yield                       # resume scheduler
+	cons = yield				# get cons
+	yield						# resume scheduler
 	for i in range( N ):
 		print( "prod" )
-		yield cons              # execute next
+		yield cons				# execute next
 	print( "end", "prod" )
 
 def Cons( N ):
-	prod = (yield)              # get prod
-	yield                       # resume scheduler
+	prod = yield				# get prod
+	yield						# resume scheduler
 	for i in range( N ):
 		print( "cons" )
-		yield prod              # execute next
+		yield prod				# execute next
 	print( "end", "cons" )
 
 def Scheduler():
-	n = (yield)                 # starting coroutine
-	while True:
-		n = next( n )           # schedule coroutine
+	n = yield					# starting coroutine
+	try:
+		while True:
+			n = next( n )		# schedule coroutine
+	except StopIteration:
+		pass
 
 prod = Prod( 5 )
 cons = Cons( 5 )
-next( prod )                    # prime
-prod.send( cons )               # send cons
-next( cons )                    # prime
-cons.send( prod )               # send prod
+next( prod )					# prime
+prod.send( cons )				# send cons
+next( cons )					# prime
+cons.send( prod )				# send prod
 
 s = Scheduler();
-next( s )                       # prime
+next( s )						# prime
 try:
 	s.send( prod )				# start cycle
-except StopIteration:
-	print( "scheduler stop" )
+except StopIteration:			# scheduler stopped
+	pass
 print( "stop" )
 
 # Local Variables: #
 # tab-width: 4 #
-# compile-command: "python3.5 ProdCons.py" #
+# compile-command: "python3.7 ProdCons.py" #
 # End: #
Index: doc/papers/concurrency/examples/RWMonitor.cfa
===================================================================
--- doc/papers/concurrency/examples/RWMonitor.cfa	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ 	(revision )
@@ -1,63 +1,0 @@
-#include <fstream.hfa>
-#include <thread.hfa>
-
-volatile int SharedRW = 0;								// shared variable to test readers and writers
-
-monitor ReadersWriter {
-	int rcnt, wcnt;										// number of readers/writer using resource
-};
-void EndRead( ReadersWriter & mutex rw ) with(rw) { rcnt -= 1; }
-void EndWrite( ReadersWriter & mutex rw ) with(rw) { wcnt = 0; }
-void StartRead( ReadersWriter & mutex rw ) with(rw) {
-	if ( wcnt > 0 ) waitfor( EndWrite, rw );
-	rcnt += 1;
-}
-void StartWrite( ReadersWriter & mutex rw ) with(rw) {
-	if ( wcnt > 0 ) waitfor( EndWrite, rw );
-	else while ( rcnt > 0 ) waitfor( EndRead, rw );
-	wcnt = 1;
-}
-void ?{}( ReadersWriter & rw ) with(rw) { rcnt = wcnt = 0; }
-int readers( ReadersWriter & rw ) { return rw.rcnt; }
-void Read( ReadersWriter & rw ) {
-	StartRead( rw );
-	sout | "Reader:" | active_thread() | ", shared:" | SharedRW | " with:" | readers( rw ) | " readers";
-	yield( 3 );
-	EndRead( rw );
-}
-void Write( ReadersWriter & rw ) {
-	StartWrite( rw );
-
-	SharedRW += 1;
-	sout | "Writer:" | active_thread() | ",  wrote:" | SharedRW;
-	yield( 1 );
-	EndWrite( rw );
-}
-thread Worker {
-	ReadersWriter &rw;
-};
-void ?{}( Worker & w, ReadersWriter * rw ) { &w.rw = rw; }
-void main( Worker & w ) with(w) {
-	for ( 10 ) {
-		if ( rand() % 100 < 70 ) {					// decide to be a reader or writer
-			Read( rw );
-		} else {
-			Write( rw );
-		} // if
-	} // for
-}
-int main() {
-	enum { MaxTask = 5 };
-	ReadersWriter rw;
-	Worker *workers[MaxTask];
-
-	for ( i; MaxTask ) workers[i] = new( &rw );
-	for ( i; MaxTask ) delete( workers[i] );
-	sout | "successful completion";
-} // main
-
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa -O2 RWMonitor.cfa" //
-// End: //
Index: doc/papers/concurrency/examples/RWMonitorEXT.cfa
===================================================================
--- doc/papers/concurrency/examples/RWMonitorEXT.cfa	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
+++ doc/papers/concurrency/examples/RWMonitorEXT.cfa	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -0,0 +1,66 @@
+#include <fstream.hfa>
+#include <thread.hfa>
+
+volatile int SharedRW = 0;								// shared variable to test readers and writers
+
+monitor ReadersWriter {
+	int rcnt, wcnt;										// number of readers/writer using resource
+};
+
+void ?{}( ReadersWriter & rw ) with(rw) { rcnt = wcnt = 0; }
+void EndRead( ReadersWriter & mutex rw ) with(rw) { rcnt -= 1; }
+void EndWrite( ReadersWriter & mutex rw ) with(rw) { wcnt = 0; }
+void StartRead( ReadersWriter & mutex rw ) with(rw) {
+	if ( wcnt > 0 ) waitfor( EndWrite : rw );
+	rcnt += 1;
+}
+void StartWrite( ReadersWriter & mutex rw ) with(rw) {
+	if ( wcnt > 0 ) waitfor( EndWrite : rw );
+	else while ( rcnt > 0 ) waitfor( EndRead : rw );
+	wcnt = 1;
+}
+int readers( ReadersWriter & rw ) { return rw.rcnt; }
+
+void Read( ReadersWriter & rw ) {
+	StartRead( rw );
+	sout | "Reader:" | active_thread() | ", shared:" | SharedRW | " with:" | readers( rw ) | " readers";
+	yield( 3 );
+	EndRead( rw );
+}
+void Write( ReadersWriter & rw ) {
+	StartWrite( rw );
+
+	SharedRW += 1;
+	sout | "Writer:" | active_thread() | ",  wrote:" | SharedRW;
+	yield( 1 );
+	EndWrite( rw );
+}
+
+thread Worker {
+	ReadersWriter &rw;
+};
+void ?{}( Worker & w, ReadersWriter * rw ) { &w.rw = rw; }
+void main( Worker & w ) with(w) {
+	for ( 10 ) {
+		if ( rand() % 100 < 70 ) {					// decide to be a reader or writer
+			Read( rw );
+		} else {
+			Write( rw );
+		} // if
+	} // for
+}
+
+int main() {
+	enum { MaxTask = 5 };
+	ReadersWriter rw;
+	Worker *workers[MaxTask];
+
+	for ( i; MaxTask ) workers[i] = new( &rw );
+	for ( i; MaxTask ) delete( workers[i] );
+	sout | "successful completion";
+} // main
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa -O2 RWMonitorEXT.cfa" //
+// End: //
Index: doc/papers/concurrency/examples/RWMonitorINT.cfa
===================================================================
--- doc/papers/concurrency/examples/RWMonitorINT.cfa	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
+++ doc/papers/concurrency/examples/RWMonitorINT.cfa	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -0,0 +1,74 @@
+#include <fstream.hfa>
+#include <thread.hfa>
+
+volatile int SharedRW = 0;								// shared variable to test readers and writers
+
+enum RW { READER, WRITER };
+monitor ReadersWriter {
+	int rcnt, wcnt;										// number of readers/writer using resource
+	condition RWers;
+};
+
+void ?{}( ReadersWriter & rw ) with(rw) { rcnt = wcnt = 0; }
+void StartRead( ReadersWriter & mutex rw ) with(rw) {
+	if ( wcnt !=0 || ! is_empty( RWers ) ) wait( RWers, READER );
+	rcnt += 1;
+	if ( ! is_empty( RWers ) && front( RWers ) == READER ) signal( RWers );
+}
+void EndRead( ReadersWriter & mutex rw ) with(rw) {
+	rcnt -= 1;
+	if ( rcnt == 0 ) signal( RWers );
+}
+void StartWrite( ReadersWriter & mutex rw ) with(rw) {
+	if ( wcnt != 0 || rcnt != 0 ) wait( RWers, WRITER );
+	wcnt = 1;
+}
+void EndWrite( ReadersWriter & mutex rw ) with(rw) {
+	wcnt = 0;
+	signal( RWers );
+}
+int readers( ReadersWriter & rw ) { return rw.rcnt; }
+
+void Read( ReadersWriter & rw ) {
+	StartRead( rw );
+	sout | "Reader:" | active_thread() | ", shared:" | SharedRW | " with:" | readers( rw ) | " readers";
+	yield( 3 );
+	EndRead( rw );
+}
+void Write( ReadersWriter & rw ) {
+	StartWrite( rw );
+
+	SharedRW += 1;
+	sout | "Writer:" | active_thread() | ",  wrote:" | SharedRW;
+	yield( 1 );
+	EndWrite( rw );
+}
+
+thread Worker {
+	ReadersWriter &rw;
+};
+void ?{}( Worker & w, ReadersWriter * rw ) { &w.rw = rw; }
+void main( Worker & w ) with(w) {
+	for ( 10 ) {
+		if ( rand() % 100 < 70 ) {					// decide to be a reader or writer
+			Read( rw );
+		} else {
+			Write( rw );
+		} // if
+	} // for
+}
+
+int main() {
+	enum { MaxTask = 5 };
+	ReadersWriter rw;
+	Worker *workers[MaxTask];
+
+	for ( i; MaxTask ) workers[i] = new( &rw );
+	for ( i; MaxTask ) delete( workers[i] );
+	sout | "successful completion";
+} // main
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa -O2 RWMonitorINT.cfa" //
+// End: //
Index: doc/papers/concurrency/examples/Refactor.py
===================================================================
--- doc/papers/concurrency/examples/Refactor.py	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/examples/Refactor.py	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -26,4 +26,4 @@
 # Local Variables: #
 # tab-width: 4 #
-# compile-command: "python3.5 Refactor.py" #
+# compile-command: "python3.7 Refactor.py" #
 # End: #
Index: doc/papers/concurrency/examples/channels.go
===================================================================
--- doc/papers/concurrency/examples/channels.go	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
+++ doc/papers/concurrency/examples/channels.go	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -0,0 +1,35 @@
+package main
+import "fmt"
+func main() {
+	type Msg struct{ i, j int }
+
+	ch1 := make( chan int )
+	ch2 := make( chan float32 )
+	ch3 := make( chan Msg )
+	hand := make( chan string )
+	shake := make( chan string )
+	gortn := func() { // thread starts
+		var i int;  var f float32;  var m Msg
+		L: for {
+			select { // wait for message
+			  case i = <- ch1: fmt.Println( i )
+			  case f = <- ch2: fmt.Println( f )
+			  case m = <- ch3: fmt.Println( m )
+			  case <- hand: break L // sentinel
+			}
+		}
+		shake <- "SHAKE" // completion
+	}
+
+	go gortn() // start thread
+	ch1 <- 0 // different messages
+	ch2 <- 2.5
+	ch3 <- Msg{1, 2}
+	hand <- "HAND" // sentinel value
+	<- shake // wait for completion
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "go run channels.go" //
+// End: //
Index: doc/papers/concurrency/examples/channels.rs
===================================================================
--- doc/papers/concurrency/examples/channels.rs	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
+++ doc/papers/concurrency/examples/channels.rs	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -0,0 +1,34 @@
+#![feature(async_await)]
+
+use std::thread;
+use std::sync::mpsc;
+
+fn main() {
+	let (tx1, rx1) = mpsc::channel();
+	let (tx2, rx2) = mpsc::channel();
+	let (tx3, rx3) = mpsc::channel();
+	let (tx4, rx4) = mpsc::channel();
+	struct Msg { i : i64,  j : i64 }
+	let th = thread::spawn( || {
+		let i : i64; let f : f64; let m : Msg;
+		loop {
+			select! {
+				i = rx1.recv() => println( i );
+				f = rx2.recv() => println( f );
+				m = rx3.recv() => println( m );
+				_ = rx4.recv() => break;
+			}
+		}
+	});
+
+	tx1.send( 0 ); // different messages
+	tx2.send( 2.5 );
+	tx3.send( Msg { i:1, j:2 } );
+	tx4.send( "done" );
+	th.join().unwrap();
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "rustc -C opt-level=3 channels.rs" //
+// End: //
Index: doc/papers/concurrency/examples/future.rs
===================================================================
--- doc/papers/concurrency/examples/future.rs	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
+++ doc/papers/concurrency/examples/future.rs	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -0,0 +1,10 @@
+use futures::executor::block_on;
+
+async fn hello_world() {
+    println!("hello, world!");
+}
+
+fn main() {
+    let future = hello_world(); // Nothing is printed
+    block_on(future); // `future` is run and "hello, world!" is printed
+}
Index: doc/papers/concurrency/figures/FullCoroutinePhases.fig
===================================================================
--- doc/papers/concurrency/figures/FullCoroutinePhases.fig	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/figures/FullCoroutinePhases.fig	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -8,10 +8,11 @@
 -2
 1200 2
-5 1 0 1 0 7 100 0 -1 0.000 0 0 1 0 4575.000 2437.500 4275 1875 4575 1800 4875 1875
+5 1 0 1 0 7 100 0 -1 0.000 0 0 1 0 5175.000 2437.500 4875 1875 5175 1800 5475 1875
 	1 1 1.00 45.00 90.00
-5 1 0 1 0 7 100 0 -1 0.000 0 0 1 0 4575.000 1537.500 4875 2100 4575 2175 4275 2100
+5 1 0 1 0 7 100 0 -1 0.000 0 0 1 0 5175.000 1537.500 5475 2100 5175 2175 4875 2100
 	1 1 1.00 45.00 90.00
-5 1 0 1 0 7 50 -1 -1 0.000 0 1 1 0 4207.500 1642.500 4125 1425 3975 1650 4200 1875
+5 1 0 1 0 7 50 -1 -1 0.000 0 1 1 0 4807.500 1642.500 4725 1425 4575 1650 4800 1875
 	1 1 1.00 45.00 90.00
+6 1575 1575 2700 2025
 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 1 0 2
 	1 1 1.00 45.00 90.00
@@ -20,20 +21,25 @@
 	1 1 1.00 45.00 90.00
 	 2175 1575 2400 1800
+4 1 0 100 0 4 10 0.0000 2 165 300 1725 1950 ping\001
+4 1 0 100 0 4 10 0.0000 2 135 360 2475 1950 pong\001
+-6
+6 3075 1575 4200 2025
+6 3075 1575 4200 2025
 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 1 0 2
 	1 1 1.00 45.00 90.00
-	 3300 1575 3300 1800
+	 3525 1575 3300 1800
 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 1 0 2
 	1 1 1.00 45.00 90.00
-	 3300 2025 3300 2250
-4 1 0 100 0 0 10 0.0000 2 105 555 2100 1200 creation\001
-4 1 0 100 0 4 10 0.0000 2 165 300 1725 1950 ping\001
-4 1 0 100 0 4 10 0.0000 2 135 360 2475 1950 pong\001
-4 1 0 100 0 4 10 0.0000 2 165 300 3300 1950 ping\001
-4 1 0 100 0 4 10 0.0000 2 135 360 3300 2400 pong\001
-4 1 0 100 0 0 10 0.0000 2 105 675 4575 1200 execution\001
-4 1 0 100 0 4 10 0.0000 2 165 300 4275 2025 ping\001
-4 1 0 100 0 4 10 0.0000 2 135 360 4875 2025 pong\001
-4 1 0 100 0 0 10 0.0000 2 90 420 3300 1200 starter\001
+	 3675 1575 3900 1800
+4 1 0 100 0 4 10 0.0000 2 165 300 3225 1950 ping\001
+4 1 0 100 0 4 10 0.0000 2 135 360 3975 1950 pong\001
+-6
+-6
 4 1 0 100 0 4 10 0.0000 2 165 705 2100 1500 pgm main\001
-4 1 0 100 0 4 10 0.0000 2 165 705 3300 1500 pgm main\001
-4 1 0 100 0 4 10 0.0000 2 165 705 4500 1500 pgm main\001
+4 1 0 100 0 4 10 0.0000 2 165 705 3600 1500 pgm main\001
+4 1 0 100 0 4 10 0.0000 2 165 300 4875 2025 ping\001
+4 1 0 100 0 4 10 0.0000 2 135 360 5475 2025 pong\001
+4 1 0 100 0 4 10 0.0000 2 165 705 5100 1500 pgm main\001
+4 1 0 100 0 2 10 0.0000 2 105 540 2100 1275 creator\001
+4 1 0 100 0 2 10 0.0000 2 105 495 3600 1275 starter\001
+4 1 0 100 0 2 10 0.0000 2 105 690 5175 1275 execution\001
Index: doc/papers/concurrency/figures/RunTimeStructure.fig
===================================================================
--- doc/papers/concurrency/figures/RunTimeStructure.fig	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/figures/RunTimeStructure.fig	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -36,27 +36,33 @@
 1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 4500 3600 15 15 4500 3600 4515 3615
 -6
-6 2175 4650 7050 4950
-1 3 0 1 0 0 0 0 0 0.000 1 0.0000 2250 4830 30 30 2250 4830 2280 4860
-1 1 0 1 -1 -1 0 0 -1 0.000 1 0.0000 4200 4800 150 75 4200 4800 4350 4875
-1 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 3275 4800 100 100 3275 4800 3375 4800
+6 3225 4125 4650 4425
+6 4350 4200 4650 4350
+1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 4425 4275 15 15 4425 4275 4440 4290
+1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 4500 4275 15 15 4500 4275 4515 4290
+1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 4575 4275 15 15 4575 4275 4590 4290
+-6
+1 1 0 1 -1 -1 0 0 -1 0.000 1 0.0000 3450 4275 225 150 3450 4275 3675 4425
+1 1 0 1 -1 -1 0 0 -1 0.000 1 0.0000 4050 4275 225 150 4050 4275 4275 4425
+-6
+6 6675 4125 7500 4425
+6 7200 4200 7500 4350
+1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 7275 4275 15 15 7275 4275 7290 4290
+1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 7350 4275 15 15 7350 4275 7365 4290
+1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 7425 4275 15 15 7425 4275 7440 4290
+-6
+1 1 0 1 -1 -1 0 0 -1 0.000 1 0.0000 6900 4275 225 150 6900 4275 7125 4425
+-6
+6 6675 3525 8025 3975
+2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
+	1 1 1.00 45.00 90.00
+	 6675 3750 6975 3750
+2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
+	1 1 1.00 45.00 90.00
+	 7125 3750 7350 3750
 2 2 0 1 -1 -1 0 0 -1 0.000 0 0 0 0 0 5
-	 5400 4950 5400 4725 5175 4725 5175 4950 5400 4950
-2 2 1 1 -1 -1 0 0 -1 3.000 0 0 0 0 0 5
-	 6525 4950 6300 4950 6300 4725 6525 4725 6525 4950
-4 0 -1 0 0 0 10 0.0000 2 105 450 6600 4875 cluster\001
-4 0 -1 0 0 0 10 0.0000 2 105 660 5475 4875 processor\001
-4 0 -1 0 0 0 10 0.0000 2 105 555 4425 4875 monitor\001
-4 0 -1 0 0 0 10 0.0000 2 120 270 3450 4875 task\001
-4 0 -1 0 0 0 10 0.0000 2 105 660 2325 4875 coroutine\001
--6
-6 3450 1275 3750 1425
-1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 3525 1350 15 15 3525 1350 3540 1365
-1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 3600 1350 15 15 3600 1350 3615 1365
-1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 3675 1350 15 15 3675 1350 3690 1365
--6
-6 5550 1275 5850 1425
-1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 5625 1350 15 15 5625 1350 5640 1365
-1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 5700 1350 15 15 5700 1350 5715 1365
-1 3 0 1 -1 -1 0 0 20 0.000 1 0.0000 5775 1350 15 15 5775 1350 5790 1365
+	 7800 3975 7800 3525 7350 3525 7350 3975 7800 3975
+2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
+	1 1 1.00 45.00 90.00
+	 7800 3750 8025 3750
 -6
 1 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 5550 2625 150 150 5550 2625 5700 2625
@@ -67,5 +73,4 @@
 1 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 4425 2850 150 150 4425 2850 4575 2850
 1 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 4650 2475 150 150 4650 2475 4800 2475
-1 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 3525 3600 150 150 3525 3600 3675 3600
 1 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 3975 3600 150 150 3975 3600 4125 3600
 1 3 0 1 0 0 0 0 0 0.000 1 0.0000 3525 3600 30 30 3525 3600 3555 3630
@@ -74,7 +79,9 @@
 1 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 3975 2850 150 150 3975 2850 4125 2850
 1 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 7200 2775 150 150 7200 2775 7350 2775
-1 1 0 1 -1 -1 0 0 -1 0.000 1 0.0000 4650 1350 225 150 4650 1350 4875 1500
-1 1 0 1 -1 -1 0 0 -1 0.000 1 0.0000 5250 1350 225 150 5250 1350 5475 1500
-1 1 0 1 -1 -1 0 0 -1 0.000 1 0.0000 4050 1350 225 150 4050 1350 4275 1500
+1 3 0 1 0 0 0 0 0 0.000 1 0.0000 2250 4830 30 30 2250 4830 2280 4860
+1 3 0 1 0 0 0 0 0 0.000 1 0.0000 7200 2775 30 30 7200 2775 7230 2805
+1 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 3525 3600 150 150 3525 3600 3675 3600
+1 3 0 1 -1 -1 0 0 -1 0.000 1 0.0000 3875 4800 100 100 3875 4800 3975 4800
+1 1 0 1 -1 -1 0 0 -1 0.000 1 0.0000 4650 4800 150 75 4650 4800 4800 4875
 2 2 0 1 -1 -1 0 0 -1 0.000 0 0 0 0 0 5
 	 2400 4200 2400 3750 1950 3750 1950 4200 2400 4200
@@ -140,21 +147,14 @@
 2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
 	1 1 1.00 45.00 90.00
-	 6675 3975 6975 3975
-2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
-	1 1 1.00 45.00 90.00
 	 7050 2775 6825 2775
 2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 0 0 2
-	 6825 2775 6825 3975
-2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
-	1 1 1.00 45.00 90.00
-	 7125 3975 7350 3975
-2 2 0 1 -1 -1 0 0 -1 0.000 0 0 0 0 0 5
-	 7800 4200 7800 3750 7350 3750 7350 4200 7800 4200
-2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 2
-	1 1 1.00 45.00 90.00
-	 7800 3975 8025 3975
+	 6825 2775 6825 3750
 2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 1 0 4
 	1 1 1.00 45.00 90.00
-	 7875 3975 7875 2325 7200 2325 7200 2550
+	 7875 3750 7875 2325 7200 2325 7200 2550
+2 2 0 1 -1 -1 0 0 -1 0.000 0 0 0 0 0 5
+	 5850 4950 5850 4725 5625 4725 5625 4950 5850 4950
+2 2 1 1 -1 -1 0 0 -1 3.000 0 0 0 0 0 5
+	 6975 4950 6750 4950 6750 4725 6975 4725 6975 4950
 4 1 -1 0 0 0 10 0.0000 2 105 720 5550 4425 Processors\001
 4 1 -1 0 0 0 10 0.0000 2 120 1005 4200 3225 Blocked Tasks\001
@@ -165,2 +165,7 @@
 4 1 -1 0 0 0 10 0.0000 2 105 990 2175 3525 Discrete-event\001
 4 1 -1 0 0 0 10 0.0000 2 135 795 2175 4350 preemption\001
+4 0 -1 0 0 0 10 0.0000 2 150 1290 2325 4875 genrator/coroutine\001
+4 0 -1 0 0 0 10 0.0000 2 120 270 4050 4875 task\001
+4 0 -1 0 0 0 10 0.0000 2 105 450 7050 4875 cluster\001
+4 0 -1 0 0 0 10 0.0000 2 105 660 5925 4875 processor\001
+4 0 -1 0 0 0 10 0.0000 2 105 555 4875 4875 monitor\001
Index: doc/papers/concurrency/mail2
===================================================================
--- doc/papers/concurrency/mail2	(revision 41efd336dc716efde67b0b8ea76790180265fdd0)
+++ doc/papers/concurrency/mail2	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -22,2 +22,492 @@
 Software: Practice and Experience Editorial Office
 
+
+
+Date: Tue, 12 Nov 2019 22:25:17 +0000
+From: Richard Jones <onbehalfof@manuscriptcentral.com>
+Reply-To: R.E.Jones@kent.ac.uk
+To: tdelisle@uwaterloo.ca, pabuhr@uwaterloo.ca
+Subject: Software: Practice and Experience - Decision on Manuscript ID
+ SPE-19-0219
+
+12-Nov-2019
+
+Dear Dr Buhr,
+
+Many thanks for submitting SPE-19-0219 entitled "Advanced Control-flow and Concurrency in Cforall" to Software: Practice and Experience. The paper has now been reviewed and the comments of the referees are included at the bottom of this letter.
+
+The decision on this paper is that it requires substantial further work is required. The referees have a number of substantial concerns. All the reviewers found the submission very hard to read; two of the reviewers state that it needs very substantial restructuring. These concerns must be addressed before your submission can be considered further.
+
+A revised version of your manuscript that takes into account the comments of the referees will be reconsidered for publication.
+
+Please note that submitting a revision of your manuscript does not guarantee eventual acceptance, and that your revision will be subject to re-review by the referees before a decision is rendered.
+
+You have 90 days from the date of this email to submit your revision. If you are unable to complete the revision within this time, please contact me to request an extension.
+
+You can upload your revised manuscript and submit it through your Author Center. Log into https://mc.manuscriptcentral.com/spe  and enter your Author Center, where you will find your manuscript title listed under "Manuscripts with Decisions".
+
+When submitting your revised manuscript, you will be able to respond to the comments made by the referee(s) in the space provided.  You can use this space to document any changes you make to the original manuscript.
+
+If you feel that your paper could benefit from English language polishing, you may wish to consider having your paper professionally edited for English language by a service such as Wiley's at http://wileyeditingservices.com. Please note that while this service will greatly improve the readability of your paper, it does not guarantee acceptance of your paper by the journal.
+ 
+Once again, thank you for submitting your manuscript to Software: Practice and Experience and I look forward to receiving your revision.
+
+
+Sincerely,
+
+Prof. Richard Jones
+Software: Practice and Experience
+R.E.Jones@kent.ac.uk
+
+
+Referee(s)' Comments to Author:
+
+Reviewing: 1
+
+Comments to the Author
+This article presents the design and rationale behind the various
+threading and synchronization mechanisms of C-forall, a new low-level
+programming language.  This paper is very similar to a companion paper
+which I have also received: as the papers are similar, so will these
+reviews be --- in particular any general comments from the other
+review apply to this paper also.
+
+As far as I can tell, the article contains three main ideas: an
+asynchronous execution / threading model; a model for monitors to
+provide mutual exclusion; and an implementation.  The first two ideas
+are drawn together in Table 1: unfortunately this is on page 25 of 30
+pages of text. Implementation choices and descriptions are scattered
+throughout the paper - and the sectioning of the paper seems almost
+arbitrary.
+
+The article is about its contributions.  Simply adding feature X to
+language Y isn't by itself a contribution, (when feature X isn't
+already a contribution).  The contribution can be in the design: the
+motivation, the space of potential design options, the particular
+design chosen and the rationale for that choice, or the resulting
+performance.  For example: why support two kinds of generators as well
+as user-level threads?  Why support both low and high level
+synchronization constructs?  Similarly I would have found the article
+easier to follow if it was written top down, presenting the design
+principles, present the space of language features, justify chosen
+language features (and rationale) and those excluded, and then present
+implementation, and performance.
+
+Then the writing of the article is often hard to follow, to say the
+least. Two examples: section 3 "stateful functions" - I've some idea
+what that is (a function with Algol's "own" or C's "static" variables?
+but in fact the paper has a rather more specific idea than that. The
+top of page 3 throws a whole lot of defintions at the reader
+"generator" "coroutine" "stackful" "stackless" "symmetric"
+"asymmetric" without every stopping to define each one --- but then in
+footnote "C" takes the time to explain what C's "main" function is?  I
+cannot imagine a reader of this paper who doesn't know what "main" is
+in C; especially if they understand the other concepts already
+presented in the paper.  The start of section 3 then does the same
+thing: putting up a whole lot of definitions, making distinctions and
+comparisons, even talking about some runtime details, but the critical
+definition of a monitor doesn't appear until three pages later, at the
+start of section 5 on p15, lines 29-34 are a good, clear, description
+of what a monitor actually is.  That needs to come first, rather than
+being buried again after two sections of comparisons, discussions,
+implementations, and options that are ungrounded because they haven't
+told the reader what they are actually talking about.  First tell the
+reader what something is, then how they might use it (as programmers:
+what are the rules and restrictions) and only then start comparison
+with other things, other approaches, other languages, or
+implementations.
+
+The description of the implementation is similarly lost in the trees
+without ever really seeing the wood. Figure 19 is crucial here, but
+it's pretty much at the end of the paper, and comments about
+implementations are threaded throughout the paper without the context
+(fig 19) to understand what's going on.   The protocol for performance
+testing may just about suffice for C (although is N constantly ten
+million, or does it vary for each benchmark) but such evaluation isn't
+appropriate for garbage-collected or JITTed languages like Java or Go.
+
+other comments working through the paper - these are mostly low level
+and are certainly not comprehensive.
+
+p1 only a subset of C-forall extensions?
+
+p1 "has features often associated with object-oriented programming
+languages, such as constructors, destructors, virtuals and simple
+inheritance."   There's no need to quibble about this. Once a language
+has inheritance, it's hard to claim it's not object-oriented.
+
+
+p2 barging? signals-as-hints?
+
+p3 start your discussion of generations with a simple example of a
+C-forall generator.  Fig 1(b) might do: but put it inline instead of
+the python example - and explain the key rules and restrictions on the
+construct.  Then don't even start to compare with coroutines until
+you've presented, described and explained your coroutines...
+p3 I'd probably leave out the various "C" versions unless there are
+key points to make you can't make in C-forall. All the alternatives
+are just confusing.
+
+
+p4 but what's that "with" in Fig 1(B)
+
+p5 start with the high level features of C-forall generators...
+
+p5 why is the paper explaining networking protocols?
+
+p7 lines 1-9 (transforming generator to coroutine - why would I do any
+of this? Why would I want one instead of the other (do not use "stack"
+in your answer!)
+
+p10 last para "A coroutine must retain its last resumer to suspend
+back because the resumer is on a different stack. These reverse
+pointers allow suspend to cycle backwards, "  I've no idea what is
+going on here?  why should I care?  Shouldn't I just be using threads
+instead?  why not?
+
+p16 for the same reasons - what reasons?
+
+p17 if the multiple-monitor entry procedure really is novel, write a
+paper about that, and only about that.
+
+p23 "Loose Object Definitions" - no idea what that means.  in that
+section: you can't leave out JS-style dynamic properties.  Even in
+OOLs that (one way or another) allow separate definitions of methods
+(like Objective-C, Swift, Ruby, C#) at any time a runtime class has a
+fixed definition.  Quite why the detail about bit mask implementation
+is here anyway, I've no idea.
+
+p25 this cluster isn't a CLU cluster then?
+
+* conclusion should conclude the paper, not the related. 
+
+
+Reviewing: 2
+
+Comments to the Author
+This paper describes the concurrency features of an extension of C (whose name I will write as "C\/" here, for convenience), including much design-level discussion of the coroutine- and monitor-based features and some microbenchmarks exploring the current implementation's performance. The key message of the latter is that the system's concurrency abstractions are much lighter-weight than the threading found in mainstream C or Java implementations.
+
+There is much description of the system and its details, but nothing about (non-artificial) uses of it. Although the microbenchmark data is encouraging, arguably not enough practical experience with the system has been reported here to say much about either its usability advantages or its performance.
+
+As such, the main contribution of the paper seem to be to document the existence of the described system and to provide a detailed design rationale and (partial) tutorial. I believe that could be of interest to some readers, so an acceptable manuscript is lurking in here somewhere.
+
+Unfortunately, at present the writing style is somewhere between unclear and infuriating. It omits to define terms; it uses needlessly many terms for what are apparently (but not clearly) the same things; it interrupts itself rather than deliver the natural consequent of whatever it has just said; and so on. Section 5 is particularly bad in these regards -- see my detailed comments below. Fairly major additional efforts will be needed to turn the present text into a digestible design-and-tutorial document. I suspect that a shorter paper could do this job better than the present manuscript, which is overwrought in parts.
+
+p2: lines 4--9 are a little sloppy. It is not the languages but their popular implementations which "adopt" the 1:1 kernel threading model.
+
+line 10: "medium work" -- "medium-sized work"?
+
+line 18: "is all sequential to the compiler" -- not true in modern compilers, and in 2004 H-J Boehm wrote a tech report describing exactly why ("Threads cannot be implemented as a library", HP Labs).
+
+line 20: "knows the optimization boundaries" -- I found this vague. What's an example?
+
+line 31: this paragraph has made a lot of claims. Perhaps forward-reference to the parts of the paper that discuss each one.
+
+line 33: "so the reader can judge if" -- this reads rather passive-aggressively. Perhaps better: "... to support our argument that..."
+
+line 41: "a dynamic partitioning mechanism" -- I couldn't tell what this meant
+
+p3. Presenting concept of a "stateful function" as a new language feature seems odd. In C, functions often have local state thanks to static local variables (or globals, indeed). Of course, that has several limitations. Can you perhaps present your contributions by enumerating these limitations? See also my suggestion below about a possible framing centred on a strawman.
+
+line 2: "an old idea that is new again" -- this is too oblique
+
+lines 2--15: I found this to be a word/concept soup. Stacks, closures, generators, stackless stackful, coroutine, symmetric, asymmetric, resume/suspend versus resume/resume... there needs to be a more gradual and structured way to introduce all this, and ideally one that minimises redundancy. Maybe present it as a series of "definitions" each with its own heading, e.g. "A closure is stackless if its local state has statically known fixed size"; "A generator simply means a stackless closure." And so on. Perhaps also strongly introduce the word "activate" as a direct contrast with resume and suspend. These are just a flavour of the sort of changes that might make this paragraph into something readable.
+
+Continuing the thought: I found it confusing that by these definitinos, a stackful closure is not a stack, even though logically the stack *is* a kind of closure (it is a representation of the current thread's continuation).
+
+lines 24--27: without explaining what the boost functor types mean, I don't think the point here comes across.
+
+line 34: "semantically coupled" -- I wasn't surew hat this meant
+
+p4: the point of Figure 1 (C) was not immediately clear. It seem to be showing how one might "compile down" Figure 1 (B). Or is that Figure 1 (A)?
+
+It's right that the incidental language features of the system are not front-and-centre, but I'd appreciate some brief glossing of non-C languages features as they appear. Examples are the square bracket notation, the pipe notation and the constructor syntax. These explanations could go in the caption of the figure which first uses them, perhaps. Overall I found the figure captions to be terse, and a missed opportunity to explain clearly what was going on.
+
+p5 line 23: "This restriction is removed..." -- give us some up-front summary of your contributions and the elements of the language design that will be talked about, so that this isn't an aside. This will reduce the "twisty passages" feeling that characterises much of the paper.
+
+line 40: "a killer asymmetric generator" -- this is stylistically odd, and the sentence about failures doesn't convincigly argue that C\/ will help with them. Have you any experience writing device drivers using C\/? Or any argument that the kinds of failures can be traced to the "stack-ripping" style that one is forced to use without coroutines? Also, a typo on line 41: "device drives". And saying "Windows/Linux" is sloppy... what does the cited paper actually say?
+
+p6 lines 13--23: this paragraph is difficult to understand. It seems to be talking about a control-flow pattern roughly equivalent to tail recursion. What is the high-level point, other than that this is possible?
+
+line 34: "which they call coroutines" -- a better way to make this point is presumably that the C++20 proposal only provides a specialised kind of coroutine, namely generators, despite its use of the more general word.
+
+line 47: "... due to dynamic stack allocation, execution..." -- this sentence doesn't scan. I suggest adding "and for" in the relevant places where currently there are only commas.
+
+p8 / Figure 5 (B) -- the GNU C extension of unary "&&" needs to be explained. The whole figure needs a better explanation, in fact.
+
+p9, lines 1--10: I wasn't sure this stepping-through really added much value. What are the truly important points to note about this code?
+
+p10: similarly, lines 3--27 again are somewhere between tedious and confusing. I'm sure the motivation and details of "starter semantics" can both be stated much more pithily.
+
+line 32: "a self-resume does not overwrite the last resumer" -- is this a hack or a defensible principled decision?
+
+p11: "a common source of errors" -- among beginners or among production code? Presumably the former.
+
+line 23: "with builtin and library" -- not sure what this means
+
+lines 31--36: these can be much briefer. The only important point here seems to be that coroutines cannot be copied.
+
+p12: line 1: what is a "task"? Does it matter?
+
+line 7: calling it "heap stack" seems to be a recipe for confusion. "Stack-and-heap" might be better, and contrast with "stack-and-VLS" perhaps. When "VLS" is glossed, suggest actually expanding its initials: say "length" not "size".
+
+line 21: are you saying "cooperative threading" is the same as "non-preemptive scheduling", or that one is a special case (kind) of the other? Both are defensible, but be clear.
+
+line 27: "mutual exclusion and synchronization" -- the former is a kind of the latter, so I suggest "and other forms of synchronization".
+
+line 30: "can either be a stackless or stackful" -- stray "a", but also, this seems to be switching from generic/background terminology to C\/-specific terminology.
+
+An expositional idea occurs: start the paper with a strawman naive/limited realisation of coroutines -- say, Simon Tatham's popular "Coroutines in C" web page -- and identify point by point what the limitations are and how C\/ overcomes them. Currently the presentation is often flat (lacking motivating contrasts) and backwards (stating solutions before problems). The foregoing approach might fix both of these.
+
+page 13: line 23: it seems a distraction to mention the Python feature here.
+
+p14 line 5: it seems odd to describe these as "stateless" just because they lack shared mutable state. It means the code itself is even more stateful. Maybe the "stack ripping" argument could usefully be given here.
+
+line 16: "too restrictive" -- would be good to have a reference to justify this, or at least give a sense of what the state-of-the-art performance in transactional memory systems is (both software and hardware)
+
+line 22: "simulate monitors" -- what about just *implementing* monitors? isn't that what these systems do? or is the point more about refining them somehow into something more specialised?
+
+p15: sections 4.1 and 4.2 seem adrift and misplaced. Split them into basic parts (which go earlier) and more advanced parts (e.g. barging, which can be explained later).
+
+line 31: "acquire/release" -- misses an opportunity to contrast the monitor's "enter/exit" abstraction with the less structured acquire/release of locks.
+
+p16 line 12: the "implicit" versus "explicit" point is unclear. Is it perhaps about the contract between an opt-in *discipline* and a language-enforced *guarantee*?
+
+line 28: no need to spend ages dithering about which one is default and which one is the explicit qualifier. Tell us what you decided, briefly justify it, and move on.
+
+p17: Figure 11: since the main point seems to be to highlight bulk acquire, include a comment which identifies the line where this is happening.
+
+line 2: "impossible to statically..." -- or dynamically. Doing it dynamically would be perfectly acceptable (locking is a dynamic operation after all)
+
+"guarantees acquisition order is consistent" -- assuming it's done in a single bulk acquire.
+
+p18: section 5.3: the text here is a mess. The explanations of "internal" versus "external" scheduling are unclear, and "signals as hints" is not explained. "... can cause thread starvation" -- means including a while loop, or not doing so? "There are three signalling mechanisms.." but the text does not follow that by telling us what they are. My own scribbled attempt at unpicking the internal/external thing: "threads already in the monitor, albeit waiting, have priority over those trying to enter".
+
+p19: line 3: "empty condition" -- explain that condition variables don't store anything. So being "empty" means that the queue of waiting threads (threads waiting to be signalled that the condition has become true) is empty.
+
+line 6: "... can be transformed into external scheduling..." -- OK, but give some motivation.
+
+p20: line 6: "mechnaism"
+
+lines 16--20: this is dense and can probably only be made clear with an example
+
+p21 line 21: clarify that nested monitor deadlock was describe earlier (in 5.2). (Is the repetition necessary?)
+
+line 27: "locks, and by extension monitors" -- this is true but the "by extension" argument is faulty. It is perfectly possible to use locks as a primitive and build a compositional mechanism out of them, e.g. transactions.
+
+p22 line 2: should say "restructured"
+
+line 33: "Implementing a fast subset check..." -- make clear that the following section explains how to do this. Restructuring the sections themselves could do this, or noting in the text.
+
+p23: line 3: "dynamic member adding, eg, JavaScript" -- needs to say "as permitted in JavaScript", and "dynamically adding members" is stylistically better
+
+p23: line 18: "urgent stack" -- back-reference to where this was explained before
+
+p24 line 7: I did not understand what was more "direct" about "direct communication". Also, what is a "passive monitor" -- just a monitor, given that monitors are passive by design?
+
+line 14 / section 5.9: this table was useful and it (or something like it) could be used much earlier on to set the structure of the rest of the paper. The explanation at present is too brief, e.g. I did not really understand the point about cases 7 and 8.
+
+p25 line 2: instead of casually dropping in a terse explanation for the newly intrdouced term "virtual processor", introduce it properly. Presumably the point is to give a less ambiguous meaning to "thread" by reserving it only for C\/'s green threads.
+
+Table 1: what does "No / Yes" mean?
+
+p26 line 15: "transforms user threads into fibres" -- a reference is needed to explain what "fibres" means... guessing it's in the sense of Adya et al.
+
+line 20: "Microsoft runtime" -- means Windows?
+
+lines 21--26: don't say "interrupt" to mean "signal", especially not without clear introduction. You can use "POSIX signal" to disambiguate from condition variables' "signal".
+
+p27 line 3: "frequency is usually long" -- that's a "time period" or "interval", not a frequency
+
+line 5: the lengthy quotation is not really necessary; just paraphrase the first sentence and move on.
+
+line 20: "to verify the implementation" -- I don't think that means what is intended
+
+Tables in section 7 -- too many significant figures. How many overall runs are described? What is N in each case?
+
+p29 line 2: "to eliminate this cost" -- arguably confusing since nowadays on commodity CPUs most of the benefits of inlining are not to do with call overheads, but from later optimizations enabled as a consequence of the inlining
+
+line 41: "a hierarchy" -- are they a hierarchy? If so, this could be explained earlier. Also, to say these make up "an integrated set... of control-flow features" verges on the tautologous.
+
+p30 line 15: "a common case being web servers and XaaS" -- that's two cases 
+
+
+Reviewing: 3
+
+Comments to the Author
+# Cforall review
+
+Overall, I quite enjoyed reading the paper. Cforall has some very interesting ideas. I did have some suggestions that I think would be helpful before final publication. I also left notes on various parts of the paper that I find confusing when reading, in hopes that it may be useful to you.
+
+## Summary 
+
+* Expand on the motivations for including both generator and coroutines, vs trying to build one atop the other 
+* Expand on the motivations for having Why both symmetric and asymettric coroutines? 
+* Comparison to async-await model adopted by other languages
+    * C#, JS
+    * Rust and its async/await model
+* Consider performance comparisons against node.js and Rust frameworks
+* Discuss performance of monitors vs finer-grained memory models and atomic operations found in other languages
+* Why both internal/external scheduling for synchronization? 
+
+## Generator/coroutines
+
+In general, this section was clear, but I thought it would be useful to provide a somewhat deeper look into why Cforall opted for the particular combination of features that it offers. I see three main differences from other languages:
+
+* Generators are not exposed as a "function" that returns a generator object, but rather as a kind of struct, with communication happening via mutable state instead of "return values". That is, the generator must be manually resumed and (if I understood) it is expected to store values that can then later be read (perhaps via methods), instead of having a `yield <Expr>` statement that yields up a value explicitly. 
+* Both "symmetric" and "asymmetric" generators are supported, instead of only asymmetric.
+* Coroutines (multi-frame generators) are an explicit mechanism.
+
+In most other languages, coroutines are rather built by layering single-frame generators atop one another (e.g., using a mechanism like async-await), and symmetric coroutines are basically not supported. I'd like to see a bit more justification for Cforall including all the above mechanisms -- it seemed like symmetric coroutines were a useful building block for some of the user-space threading and custom scheduler mechanisms that were briefly mentioned later in the paper.
+
+In the discussion of coroutines, I would have expected a bit more of a comparison to the async-await mechanism offered in other languages. Certainly the semantics of async-await in JavaScript implies significantly more overhead (because each async fn is a distinct heap object). [Rust's approach avoids this overhead][zc], however, and might be worthy of a comparison (see the Performance section).
+
+## Locks and threading
+
+### Comparison to atomics overlooks performance
+
+There are several sections in the paper that compare against atomics -- for example, on page 15, the paper shows a simple monitor that encapsulates an integer and compares that to C++ atomics. Later, the paper compares the simplicity of monitors against the `volatile` quantifier from Java. The conclusion in section 8 also revisits this point.
+
+While I agree that monitors are simpler, they are obviously also significantly different from a performance perspective -- the paper doesn't seem to address this at all. It's plausible that (e.g.) the `Aint` monitor type described in the paper can be compiled and mapped to the specialized instructions offered by hardware, but I didn't see any mention of how this would be done. There is also no mention of the more nuanced memory ordering relations offered by C++11 and how one might achieve similar performance characteristics in Cforall (perhaps the answer is that one simply doesn't need to; I think that's defensible, but worth stating explicitly).
+
+### Justification for external scheduling feels lacking
+
+Cforall includes both internal and external scheduling; I found the explanation for the external scheduling mechanism to be lacking in justification. Why include both mechanisms when most languages seem to make do with only internal scheduling? It would be useful to show some scenarios where external scheduling is truly more powerful.
+
+I would have liked to see some more discussion of external scheduling and how it  interacts with software engineering best practices. It seems somewhat similar to AOP in certain regards. It seems to add a bit of "extra semantics" to monitor methods, in that any method may now also become a kind of synchronization point. The "open-ended" nature of this feels like it could easily lead to subtle bugs, particularly when code refactoring occurs (which may e.g. split an existing method into two). This seems particularly true if external scheduling can occur across compilation units -- the paper suggested that this is true, but I wasn't entirely clear.
+
+I would have also appreciated a few more details on how external scheduling is implemented. It seems to me that there must be some sort of "hooks" on mutex methods so that they can detect whether some other function is waiting on them and awaken those blocked threads. I'm not sure how such hooks are inserted, particularly across compilation units. The material in Section 5.6 didn't quite clarify the matter for me. For example, it left me somewhat confused about whether the `f` and `g` functions declared were meant to be local to a translation unit, or shared with other unit.
+
+### Presentation of monitors is somewhat confusing
+
+I found myself confused fairly often in the section on monitors. I'm just going to leave some notes here on places that I got confused in how that it could be useful to you as feedback on writing that might want to be clarified.
+
+To start, I did not realize that the `mutex_opt` notation was a keyword, I thought it was a type annotation. I think this could be called out more explicitly.
+
+Later, in section 5.2, the paper discusses `nomutex` annotations, which initially threw me, as they had not been introduced (now I realize that this paragraph is there to justify why there is no such keyword). The paragraph might be rearranged to make that clearer, perhaps by leading with the choice that Cforall made.
+
+On page 17, the paper states that "acquiring multiple monitors is safe from deadlock", but this could be stated a bit more precisely: acquiring multiple monitors in a bulk-acquire is safe from deadlock (deadlock can still result from nested acquires).
+
+On page 18, the paper states that wait states do not have to be enclosed in loops, as there is no concern of barging. This seems true but there are also other reasons to use loops (e.g., if there are multiple reasons to notify on the same condition). Thus the statement initially surprised me, as barging is only one of many reasons that I typically employ loops around waits.
+
+I did not understand the diagram in Figure 12 for some time. Initially, I thought that it was generic to all monitors, and I could not understand the state space. It was only later that I realized it was specific to your example. Updating the caption from "Monitor scheduling to "Monitor scheduling in the example from Fig 13" might have helped me quite a bit.
+
+I spent quite some time reading the boy/girl dating example (\*) and I admit I found it somewhat confusing. For example, I couldn't tell whether there were supposed to be many "girl" threads executing at once, or if there was only supposed to be one girl and one boy thread executing in a loop. Are the girl/boy threads supposed to invoke the girl/boy methods or vice versa? Surely there is some easier way to set this up? I believe that when reading the paper I convinced myself of how it was supposed to be working, but I'm writing this review some days later, and I find myself confused all over again and not able to easily figure it out.
+
+(\*) as an aside, I would consider modifying the example to some other form of matching, like customers and support personnel.
+
+## Related work
+
+The paper offered a number of comparisons to Go, C#, Scala, and so forth, but seems to have overlooked another recent language, Rust. In many ways, Rust seems to be closest in philosophy to Cforall, so it seems like an odd omission. I already mentioned above that Rust is in the process of shipping [async-await syntax][aa], which is definitely an alternative to the generator/coroutine approach in Cforall (though one with clear pros/cons).
+
+## Performance
+
+In the performance section in particular, you might consider comparing against some of the Rust web servers and threading systems. For example, actix is top of the [single query TechEmpower Framework benchmarks], and tokio is near the top of the [plainthreading benchmarks][pt] (hyper, the top, is more of an HTTP framework, though it is also written in Rust). It would seem worth trying to compare their "context switching" costs as well -- I believe both actix and tokio have a notion of threads that could be readily compared.
+
+Another addition that might be worth considering is to compare against node.js promises, although I think the comparison to process creation is not as clean.
+
+That said, I think that the performance comparison is not a big focus of the paper, so it may not be necessary to add anything to it.
+
+## Authorship of this review
+
+I'm going to sign this review. This review was authored by Nicholas D. Matsakis. In the intrerest of full disclosure, I'm heavily involved in the Rust project, although I dont' think that influenced this review in particular. Feel free to reach out to me for clarifying questions.
+
+## Links
+
+[aa]: https://blog.rust-lang.org/2019/09/30/Async-await-hits-beta.html
+[zc]: https://aturon.github.io/blog/2016/08/11/futures/
+[sq]: https://www.techempower.com/benchmarks/#section=data-r18&hw=ph&test=db
+[pt]: https://www.techempower.com/benchmarks/#section=data-r18&hw=ph&test=plaintext
+
+
+
+Subject: Re: manuscript SPE-19-0219
+To: "Peter A. Buhr" <pabuhr@uwaterloo.ca>
+From: Richard Jones <R.E.Jones@kent.ac.uk>
+Date: Tue, 12 Nov 2019 22:43:55 +0000
+
+Dear Dr Buhr
+
+Your should have received a decision letter on this today. I am sorry that this
+has taken so long. Unfortunately SP&E receives a lot of submissions and getting
+reviewers is a perennial problem.
+
+Regards
+Richard
+
+Peter A. Buhr wrote on 11/11/2019 13:10:
+>     26-Jun-2019
+>     Your manuscript entitled "Advanced Control-flow and Concurrency in Cforall"
+>     has been received by Software: Practice and Experience. It will be given
+>     full consideration for publication in the journal.
+>
+> Hi, it has been over 4 months since submission of our manuscript SPE-19-0219
+> with no response.
+>
+> Currently, I am refereeing a paper for IEEE that already cites our prior SP&E
+> paper and the Master's thesis forming the bases of the SP&E paper under
+> review. Hence our work is apropos and we want to get it disseminates as soon as
+> possible.
+>
+> [3] A. Moss, R. Schluntz, and P. A. Buhr, "Cforall: Adding modern programming
+>      language features to C," Software - Practice and Experience, vol. 48,
+>      no. 12, pp. 2111-2146, 2018.
+>
+> [4] T. Delisle, "Concurrency in C for all," Master's thesis, University of
+>      Waterloo, 2018.  [Online].  Available:
+>      https://uwspace.uwaterloo.ca/bitstream/handle/10012/12888
+
+
+
+Date: Mon, 13 Jan 2020 05:33:15 +0000
+From: Richard Jones <onbehalfof@manuscriptcentral.com>
+Reply-To: R.E.Jones@kent.ac.uk
+To: pabuhr@uwaterloo.ca
+Subject: Revision reminder - SPE-19-0219
+
+13-Jan-2020
+Dear Dr Buhr
+SPE-19-0219
+
+This is a reminder that your opportunity to revise and re-submit your
+manuscript will expire 28 days from now. If you require more time please
+contact me directly and I may grant an extension to this deadline, otherwise
+the option to submit a revision online, will not be available.
+
+I look forward to receiving your revision.
+
+Sincerely,
+
+Prof. Richard Jones
+Editor, Software: Practice and Experience
+https://mc.manuscriptcentral.com/spe
+
+
+
+Date: Wed, 5 Feb 2020 04:22:18 +0000
+From: Aaron Thomas <onbehalfof@manuscriptcentral.com>
+Reply-To: speoffice@wiley.com
+To: tdelisle@uwaterloo.ca, pabuhr@uwaterloo.ca
+Subject: SPE-19-0219.R1 successfully submitted
+
+04-Feb-2020
+
+Dear Dr Buhr,
+
+Your manuscript entitled "Advanced Control-flow and Concurrency in Cforall" has
+been successfully submitted online and is presently being given full
+consideration for publication in Software: Practice and Experience.
+
+Your manuscript number is SPE-19-0219.R1.  Please mention this number in all
+future correspondence regarding this submission.
+
+You can view the status of your manuscript at any time by checking your Author
+Center after logging into https://mc.manuscriptcentral.com/spe.  If you have
+difficulty using this site, please click the 'Get Help Now' link at the top
+right corner of the site.
+
+Thank you for submitting your manuscript to Software: Practice and Experience.
+
+Sincerely,
+Software: Practice and Experience Editorial Office
+
Index: doc/papers/concurrency/response
===================================================================
--- doc/papers/concurrency/response	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
+++ doc/papers/concurrency/response	(revision 04e6f93974c083b5fc070b751fb62d1ade6be1d9)
@@ -0,0 +1,984 @@
+    A revised version of your manuscript that takes into account the comments
+    of the referees will be reconsidered for publication.
+
+We have attempted to address all the referee's comments in the revised version
+of the paper, with notes below for each comment.
+
+=============================================================================
+
+    Reviewing: 1
+
+    As far as I can tell, the article contains three main ideas: an
+    asynchronous execution / threading model; a model for monitors to provide
+    mutual exclusion; and an implementation.  The first two ideas are drawn
+    together in Table 1: unfortunately this is on page 25 of 30 pages of
+    text. Implementation choices and descriptions are scattered throughout the
+    paper - and the sectioning of the paper seems almost arbitrary.
+
+Fixed, Table 1 is moved to the start and explained in detail.
+
+    The article is about its contributions.  Simply adding feature X to
+    language Y isn't by itself a contribution, (when feature X isn't already a
+    contribution).
+
+C++ (Y) added object-oriented programming (X) to C, where OO programming (X)
+was not a contribution.
+
+    For example: why support two kinds of generators as well as user-level
+    threads?  Why support both low and high level synchronization constructs?
+
+Fixed, as part of discussing Table 1.
+
+    Similarly I would have found the article easier to follow if it was written
+    top down, presenting the design principles, present the space of language
+    features, justify chosen language features (and rationale) and those
+    excluded, and then present implementation, and performance.
+
+Fixed, the paper is now restructured in this form.
+
+    Then the writing of the article is often hard to follow, to say the
+    least. Two examples: section 3 "stateful functions" - I've some idea
+    what that is (a function with Algol's "own" or C's "static" variables?
+    but in fact the paper has a rather more specific idea than that.
+
+Fixed, at the start of this section.
+
+    The top of page 3 throws a whole lot of definitions at the reader
+    "generator" "coroutine" "stackful" "stackless" "symmetric" "asymmetric"
+    without every stopping to define each one
+
+Hopefully fixed by moving Table 1 forward.
+
+    --- but then in footnote "C" takes the time to explain what C's "main"
+    function is? I cannot imagine a reader of this paper who doesn't know what
+    "main" is in C; especially if they understand the other concepts already
+    presented in the paper.
+
+Fixed by shortening.
+
+    The start of section 3 then does the same
+    thing: putting up a whole lot of definitions, making distinctions and
+    comparisons, even talking about some runtime details, but the critical
+    definition of a monitor doesn't appear until three pages later, at the
+    start of section 5 on p15, lines 29-34 are a good, clear, description
+    of what a monitor actually is.  That needs to come first, rather than
+    being buried again after two sections of comparisons, discussions,
+    implementations, and options that are ungrounded because they haven't
+    told the reader what they are actually talking about.  First tell the
+    reader what something is, then how they might use it (as programmers:
+    what are the rules and restrictions) and only then start comparison
+    with other things, other approaches, other languages, or
+    implementations.
+
+Hopefully fixed by moving Table 1 forward.
+
+    The description of the implementation is similarly lost in the trees
+    without ever really seeing the wood. Figure 19 is crucial here, but
+    it's pretty much at the end of the paper, and comments about
+    implementations are threaded throughout the paper without the context
+    (fig 19) to understand what's going on.
+
+We have to agree to disagree on the location of Fig 19. Early discussion about
+implementation for the various control structures are specific to that feature.
+Fig 19 shows the global runtime structure, which manages only the threading
+aspect of the control structures and their global organization.
+
+    The protocol for performance testing may just about suffice for C (although
+    is N constantly ten million, or does it vary for each benchmark)
+
+Fixed, the paper states N varies per language/benchmark so the benchmark runs
+long enough to get a good average per operation.
+
+    but such evaluation isn't appropriate for garbage-collected or JITTed
+    languages like Java or Go.
+
+Please explain. All the actions in the benchmarks occur independently of the
+storage-management scheme, e.g., acquiring a lock is an aspect of execution not
+storage. In fact, garbage-collected or JITTed languages cheat on benchmarks and
+we had to take great care to prevent cheating and measure the actual operation.
+
+    p1 only a subset of C-forall extensions?
+
+Fixed, removed.
+
+    p1 "has features often associated with object-oriented programming
+    languages, such as constructors, destructors, virtuals and simple
+    inheritance."  There's no need to quibble about this. Once a language has
+    inheritance, it's hard to claim it's not object-oriented.
+
+We have to agree to disagree. Object languages are defined by the notion of
+nested functions in a aggregate structure with a special receiver parameter
+"this", not by inheritance.  Inheritance is a polymorphic mechanism, e.g,
+Plan-9 C has simple inheritance but is not object-oriented. Because Cforall
+does not have a specific receiver, it is possible to have multiple function
+parameters as receivers, which introduces new concepts like bulk acquire for
+monitors.
+
+    p2 barging? signals-as-hints?
+
+Added a footnote for barging. We feel these terms are well known in the
+concurrency literature, especially in pthreads and Java, and both terms have
+citations with extensive explanations and further citations.
+
+    p3 start your discussion of generations with a simple example of a
+    C-forall generator.  Fig 1(b) might do: but put it inline instead of
+    the python example - and explain the key rules and restrictions on the
+    construct.  Then don't even start to compare with coroutines until
+    you've presented, described and explained your coroutines...
+    p3 I'd probably leave out the various "C" versions unless there are
+    key points to make you can't make in C-forall. All the alternatives
+    are just confusing.
+
+Hopefully fixed as this block of text has been rewritten.
+
+    p4 but what's that "with" in Fig 1(B)
+
+Footnote D explains the semantic of "with", which is like unqualified access
+for the receiver to the fields of a class from member routines, i.e., no
+"this->".
+
+    p5 start with the high level features of C-forall generators...
+
+Hopefully fixed by moving Table 1 forward.
+
+    p5 why is the paper explaining networking protocols?
+
+Fixed, added discussion on this point.
+
+    p7 lines 1-9 (transforming generator to coroutine - why would I do any of
+    this? Why would I want one instead of the other (do not use "stack" in your
+    answer!)
+
+As stated on line 1 because state declarations from the generator type can be
+moved out of the coroutine type into the coroutine main
+
+    p10 last para "A coroutine must retain its last resumer to suspend back
+    because the resumer is on a different stack. These reverse pointers allow
+    suspend to cycle backwards, " I've no idea what is going on here?  why
+    should I care?  Shouldn't I just be using threads instead?  why not?
+
+Hopefully fixed by moving Table 1 forward.
+
+    p16 for the same reasons - what reasons?
+
+Hopefully fixed by moving Table 1 forward.
+
+    p17 if the multiple-monitor entry procedure really is novel, write a paper
+    about that, and only about that.
+
+We do not believe this is a practical suggestion.
+
+    p23 "Loose Object Definitions" - no idea what that means.  in that
+    section: you can't leave out JS-style dynamic properties.  Even in
+    OOLs that (one way or another) allow separate definitions of methods
+    (like Objective-C, Swift, Ruby, C#) at any time a runtime class has a
+    fixed definition.  Quite why the detail about bit mask implementation
+    is here anyway, I've no idea.
+
+Fixed by rewriting the section.
+
+    p25 this cluster isn't a CLU cluster then?
+
+No. A CLU cluster is like a class in an object-oriented programming language.
+A CFA cluster is a runtime organizational mechanism.
+
+    * conclusion should conclude the paper, not the related.
+
+We do not understand this comment.
+
+=============================================================================
+
+    Reviewing: 2
+
+    There is much description of the system and its details, but nothing about
+    (non-artificial) uses of it. Although the microbenchmark data is
+    encouraging, arguably not enough practical experience with the system has
+    been reported here to say much about either its usability advantages or its
+    performance.
+
+We have a Catch-22 problem. Without publicity, there is no user community;
+without a user community, there are no publications for publicity.
+
+    p2: lines 4--9 are a little sloppy. It is not the languages but their
+    popular implementations which "adopt" the 1:1 kernel threading model.
+
+Fixed.
+
+    line 10: "medium work" -- "medium-sized work"?
+
+Fixed.
+
+    line 18: "is all sequential to the compiler" -- not true in modern
+    compilers, and in 2004 H-J Boehm wrote a tech report describing exactly why
+    ("Threads cannot be implemented as a library", HP Labs).
+
+We will have to disagree on this point. First, I am aware of Hans's 2004 paper
+because in that paper Hans cites my seminal work on this topic from 1995, which
+we cite in this paper.  Second, while modern memory-models have been added to
+languages like Java/C/C++ and new languages usually start with a memory model,
+it is still the programmer's responsibility to use them for racy code. Only
+when the programing language provides race-free constructs is the language
+aware of the concurrency; otherwise the code is sequential. Hans's paper "You
+Don't Know Jack About Shared Variables or Memory Models" talks about these
+issues, and is also cited in the paper.
+
+    line 20: "knows the optimization boundaries" -- I found this vague. What's
+    an example?
+
+Fixed.
+
+    line 31: this paragraph has made a lot of claims. Perhaps forward-reference
+    to the parts of the paper that discuss each one.
+
+Fixed by adding a road-map paragraph at the end of the introduction.
+
+    line 33: "so the reader can judge if" -- this reads rather
+    passive-aggressively. Perhaps better: "... to support our argument that..."
+
+Fixed.
+
+    line 41: "a dynamic partitioning mechanism" -- I couldn't tell what this
+    meant
+
+Fixed.
+
+    p3. Presenting concept of a "stateful function" as a new language feature
+    seems odd. In C, functions often have local state thanks to static local
+    variables (or globals, indeed). Of course, that has several
+    limitations. Can you perhaps present your contributions by enumerating
+    these limitations? See also my suggestion below about a possible framing
+    centred on a strawman.
+
+Fixed, at the start of this section.
+
+    line 2: "an old idea that is new again" -- this is too oblique
+
+Fixed, removed.
+
+    lines 2--15: I found this to be a word/concept soup. Stacks, closures,
+    generators, stackless stackful, coroutine, symmetric, asymmetric,
+    resume/suspend versus resume/resume... there needs to be a more gradual and
+    structured way to introduce all this, and ideally one that minimises
+    redundancy. Maybe present it as a series of "definitions" each with its own
+    heading, e.g. "A closure is stackless if its local state has statically
+    known fixed size"; "A generator simply means a stackless closure." And so
+    on. Perhaps also strongly introduce the word "activate" as a direct
+    contrast with resume and suspend. These are just a flavour of the sort of
+    changes that might make this paragraph into something readable.
+
+    Continuing the thought: I found it confusing that by these definitions, a
+    stackful closure is not a stack, even though logically the stack *is* a
+    kind of closure (it is a representation of the current thread's
+    continuation).
+
+Fixed. Rewrote paragraph and moved Table 1 forward.
+
+    lines 24--27: without explaining what the boost functor types mean, I don't
+    think the point here comes across.
+
+Replaced with uC++ example because boost appears to have dropped symmetric
+coroutines.
+
+    line 34: "semantically coupled" -- I wasn't sure what this meant
+
+Fixed.
+
+    p4: the point of Figure 1 (C) was not immediately clear. It seem to be
+    showing how one might "compile down" Figure 1 (B). Or is that Figure 1 (A)?
+
+Fixed. Rewrote sentence.
+
+    It's right that the incidental language features of the system are not
+    front-and-centre, but I'd appreciate some brief glossing of non-C languages
+    features as they appear. Examples are the square bracket notation, the pipe
+    notation and the constructor syntax. These explanations could go in the
+    caption of the figure which first uses them, perhaps. Overall I found the
+    figure captions to be terse, and a missed opportunity to explain clearly
+    what was going on.
+
+Fixed, added descriptive footnote about Cforall. We prefer to put text in the
+body of the paper and keep captions short.
+
+    p5 line 23: "This restriction is removed..." -- give us some up-front
+    summary of your contributions and the elements of the language design that
+    will be talked about, so that this isn't an aside. This will reduce the
+    "twisty passages" feeling that characterises much of the paper.
+
+Fixed, remove parenthesis.
+
+    line 40: "a killer asymmetric generator" -- this is stylistically odd, and
+    the sentence about failures doesn't convincingly argue that C\/ will help
+    with them. Have you any experience writing device drivers using C\/? Or any
+    argument that the kinds of failures can be traced to the "stack-ripping"
+    style that one is forced to use without coroutines ?
+
+Fixed, added new paragraph.
+
+    Also, a typo on line
+    41: "device drives". And saying "Windows/Linux" is sloppy... what does the
+    cited paper actually say?
+
+Fixed.
+
+    p6 lines 13--23: this paragraph is difficult to understand. It seems to be
+    talking about a control-flow pattern roughly equivalent to tail recursion.
+    What is the high-level point, other than that this is possible?
+
+Fixed, rewrote start of the paragraph.
+
+    line 34: "which they call coroutines" -- a better way to make this point is
+    presumably that the C++20 proposal only provides a specialised kind of
+    coroutine, namely generators, despite its use of the more general word.
+
+Fixed.
+
+    line 47: "... due to dynamic stack allocation, execution..." -- this
+    sentence doesn't scan. I suggest adding "and for" in the relevant places
+    where currently there are only commas.
+
+Fixed.
+
+    p8 / Figure 5 (B) -- the GNU C extension of unary "&&" needs to be
+    explained.
+
+Fixed, added explanation at first usage in Figure 1(C) and reference.
+
+    The whole figure needs a better explanation, in fact.
+
+Fixed, rewrote start of the paragraph.
+
+    p9, lines 1--10: I wasn't sure this stepping-through really added much
+    value. What are the truly important points to note about this code?
+
+Fixed, shortened and merged with previous paragraph.
+
+    p10: similarly, lines 3--27 again are somewhere between tedious and
+    confusing. I'm sure the motivation and details of "starter semantics" can
+    both be stated much more pithily.
+
+Fixed, shortened these paragraphs.
+
+    line 32: "a self-resume does not overwrite the last resumer" -- is this a
+    hack or a defensible principled decision?
+
+Fixed, removed but it is a defensible principled decision.
+
+    p11: "a common source of errors" -- among beginners or among production
+    code? Presumably the former.
+
+Forgetting is not specific to beginners.
+
+    line 23: "with builtin and library" -- not sure what this means
+
+Fixed.
+
+    lines 31--36: these can be much briefer. The only important point here
+    seems to be that coroutines cannot be copied.
+
+Fixed, shortened.
+
+    p12: line 1: what is a "task"? Does it matter?
+
+Fixed, "task" has been changed to "thread" throughout the paper.
+
+     line 7: calling it "heap stack" seems to be a recipe for
+     confusion. "Stack-and-heap" might be better, and contrast with
+     "stack-and-VLS" perhaps. When "VLS" is glossed, suggest actually expanding
+     its initials: say "length" not "size".
+
+Fixed, make correction and rewrote some of the text.
+
+     line 21: are you saying "cooperative threading" is the same as
+     "non-preemptive scheduling", or that one is a special case (kind) of the
+     other? Both are defensible, but be clear.
+
+Fixed, clarified the definitions.
+
+    line 27: "mutual exclusion and synchronization" -- the former is a kind of
+    the latter, so I suggest "and other forms of synchronization".
+
+We have to agree to disagree. Included a citation that explains the
+differences.
+
+    line 30: "can either be a stackless or stackful" -- stray "a", but also,
+    this seems to be switching from generic/background terminology to
+    C\/-specific terminology.
+
+Fixed, but the terms stackless or stackful are not specific to Cforall; they
+are well known in the literature.
+
+    An expositional idea occurs: start the paper with a strawman naive/limited
+    realisation of coroutines -- say, Simon Tatham's popular "Coroutines in C"
+    web page -- and identify point by point what the limitations are and how
+    C\/ overcomes them. Currently the presentation is often flat (lacking
+    motivating contrasts) and backwards (stating solutions before
+    problems). The foregoing approach might fix both of these.
+
+We prefer the current structure of our paper and believe the paper does
+explain basic coding limitations and how they are overcome in using high-level
+control-floe mechanisms.
+
+    page 13: line 23: it seems a distraction to mention the Python feature
+    here.
+
+Why? It is the first location in the paper where dynamic allocation and
+initialization are mentioned.
+
+    p14 line 5: it seems odd to describe these as "stateless" just because they
+    lack shared mutable state. It means the code itself is even more
+    stateful. Maybe the "stack ripping" argument could usefully be given here.
+
+Fixed, changed "stateless" to "non-shared".
+
+    line 16: "too restrictive" -- would be good to have a reference to justify
+    this, or at least give a sense of what the state-of-the-art performance in
+    transactional memory systems is (both software and hardware)
+
+Fixed, added 2 citations.
+
+    line 22: "simulate monitors" -- what about just *implementing* monitors?
+    isn't that what these systems do? or is the point more about refining them
+    somehow into something more specialised?
+
+Fixed, changed "simulate monitors" to "manually implement a monitor".
+
+    p15: sections 4.1 and 4.2 seem adrift and misplaced. Split them into basic
+    parts (which go earlier) and more advanced parts (e.g. barging, which can
+    be explained later).
+
+Fixed, removed them by shortening and merging with previous section.
+
+    line 31: "acquire/release" -- misses an opportunity to contrast the
+    monitor's "enter/exit" abstraction with the less structured acquire/release
+    of locks.
+
+Fixed, added "by call/return" in sentence.
+
+    p16 line 12: the "implicit" versus "explicit" point is unclear. Is it
+    perhaps about the contract between an opt-in *discipline* and a
+    language-enforced *guarantee*?
+
+Fixed.
+
+    line 28: no need to spend ages dithering about which one is default and
+    which one is the explicit qualifier. Tell us what you decided, briefly
+    justify it, and move on.
+
+Fixed, shortened paragraph.
+
+    p17: Figure 11: since the main point seems to be to highlight bulk acquire,
+    include a comment which identifies the line where this is happening.
+
+Fixed.
+
+    line 2: "impossible to statically..." -- or dynamically. Doing it
+    dynamically would be perfectly acceptable (locking is a dynamic operation
+    after all)
+
+Fixed, clarified the "statically" applied to the unknown-sized pointer types.
+
+    "guarantees acquisition order is consistent" -- assuming it's done in a
+    single bulk acquire.
+
+Fixed.
+
+    p18: section 5.3: the text here is a mess. The explanations of "internal"
+    versus "external" scheduling are unclear, and "signals as hints" is not
+    explained. "... can cause thread starvation" -- means including a while
+    loop, or not doing so? "There are three signalling mechanisms.." but the
+    text does not follow that by telling us what they are. My own scribbled
+    attempt at unpicking the internal/external thing: "threads already in the
+    monitor, albeit waiting, have priority over those trying to enter".
+
+Fixed, rewrote and shortened paragraphs.
+
+    p19: line 3: "empty condition" -- explain that condition variables don't
+    store anything. So being "empty" means that the queue of waiting threads
+    (threads waiting to be signalled that the condition has become true) is
+    empty.
+
+Fixed, changed condition variable to condition queue throughout the paper.
+
+    line 6: "... can be transformed into external scheduling..." -- OK, but
+    give some motivation.
+
+The paper states that it removes the condition queues and signal/wait. Changed
+"transform" to "simplified".
+
+    p20: line 6: "mechnaism"
+
+Fixed.
+
+    lines 16--20: this is dense and can probably only be made clear with an
+    example
+    
+Fixed, rewrote and added example.
+
+    p21 line 21: clarify that nested monitor deadlock was describe earlier (in
+    5.2). (Is the repetition necessary?)
+
+Fixed, put in a forward reference, and the point bears repeating because
+releasing a subset of acquired monitors in unique to Cforall concurrency.
+
+    line 27: "locks, and by extension monitors" -- this is true but the "by
+    extension" argument is faulty. It is perfectly possible to use locks as a
+    primitive and build a compositional mechanism out of them,
+    e.g. transactions.
+
+True, but that is not what we said. Locks are not composable, monitors are
+built using locks not transactions, so by extension monitors are not composable.
+
+    p22 line 2: should say "restructured"
+
+Fixed.
+
+    line 33: "Implementing a fast subset check..." -- make clear that the
+    following section explains how to do this. Restructuring the sections
+    themselves could do this, or noting in the text.
+
+Fixed, added a forward reference to the following sections.
+
+    p23: line 3: "dynamic member adding, eg, JavaScript" -- needs to say "as
+    permitted in JavaScript", and "dynamically adding members" is stylistically
+    better
+
+Fixed.
+
+    p23: line 18: "urgent stack" -- back-reference to where this was explained
+    before
+
+Fixed.
+
+    p24 line 7: I did not understand what was more "direct" about "direct
+    communication". Also, what is a "passive monitor" -- just a monitor, given
+    that monitors are passive by design?
+
+The back half of line 7 defines "direct". For example, Go, Java, pthread
+threads cannot directly call/communicate with one another, where they can in
+Ada, uC++, and Cforall threads. Figure 18 show this exact difference.
+
+A monitor object is *passive* because it does not have a thread, while a Go,
+Java, Cforall "thread" object is *active* because it has a thread.
+
+    line 14 / section 5.9: this table was useful and it (or something like it)
+    could be used much earlier on to set the structure of the rest of the
+    paper.
+
+Fixed, Table 1 is moved to the start and explained in detail.
+
+    The explanation at present is too brief, e.g. I did not really understand
+    the point about cases 7 and 8. Table 1: what does "No / Yes" mean?
+
+Fixed, expanded the explanation.
+
+    p25 line 2: instead of casually dropping in a terse explanation for the
+    newly introduced term "virtual processor", introduce it
+    properly. Presumably the point is to give a less ambiguous meaning to
+    "thread" by reserving it only for C\/'s green threads.
+
+Fixed.
+
+    p26 line 15: "transforms user threads into fibres" -- a reference is needed
+    to explain what "fibres" means... guessing it's in the sense of Adya et al.
+
+Fixed. In a prior correct, the term fibre from Adya is defined.
+
+    line 20: "Microsoft runtime" -- means Windows?
+
+Fixed.
+
+    lines 21--26: don't say "interrupt" to mean "signal", especially not
+    without clear introduction. You can use "POSIX signal" to disambiguate from
+    condition variables' "signal".
+
+We have to agree to disagree on this terminology. Interrupt is the action of
+stopping the CPU while a signal is a specific kind of interrupt. The two terms
+seem to be well understood in the literature.
+
+    p27 line 3: "frequency is usually long" -- that's a "time period" or
+    "interval", not a frequency
+
+Fixed.
+
+    line 5: the lengthy quotation is not really necessary; just paraphrase the
+    first sentence and move on.
+
+Fixed.
+
+    line 20: "to verify the implementation" -- I don't think that means what is
+    intended
+
+Fixed, changed "verify" to "test".
+
+    Tables in section 7 -- too many significant figures. How many overall runs
+    are described? What is N in each case?
+
+Fixed. As stated, N=31.
+
+    p29 line 2: "to eliminate this cost" -- arguably confusing since nowadays
+    on commodity CPUs most of the benefits of inlining are not to do with call
+    overheads, but from later optimizations enabled as a consequence of the
+    inlining
+
+Fixed.
+
+    line 41: "a hierarchy" -- are they a hierarchy? If so, this could be
+    explained earlier. Also, to say these make up "an integrated set... of
+    control-flow features" verges on the tautologous.
+
+Fixed, rewrote sentence.
+
+    p30 line 15: "a common case being web servers and XaaS" -- that's two cases
+
+Fixed.
+
+============================================================================
+
+    Reviewing: 3
+
+    * Expand on the motivations for including both generator and coroutines, vs
+      trying to build one atop the other
+
+Fixed, Table 1 is moved to the start and explained in detail.
+
+    * Expand on the motivations for having both symmetric and asymmetric
+      coroutines?
+
+A coroutine is not marked as symmetric or asymmetric, it is a coroutine.
+Symmetric or asymmetric is a stylistic use of a coroutine. By analogy, a
+function is not marked as recursive or non-recursive. Recursion is a style of
+programming with a function. So there is no notion of motivation for having
+both symmetric and asymmetric as they follow from how a programmer uses suspend
+and resume.
+
+    * Comparison to async-await model adopted by other languages
+
+Fixed, added a new section on this topic.
+
+    * Consider performance comparisons against node.js and Rust frameworks
+
+Fixed.
+
+    * Discuss performance of monitors vs finer-grained memory models and atomic
+      operations found in other languages
+
+The paper never suggested high-level concurrency constructs can or should
+replace race programming or hardware atomics. The paper suggests programmers
+use high-level constructs when and where is it feasible because they are easy
+and safer to use. The monitor example of an atomic counter is just that, an
+example, not the way it should be done if maximal performance is required.  We
+have tried to make this point clear in the paper.
+
+    * Why both internal/external scheduling for synchronization?
+
+Some additional motivation has been added.
+
+    * Generators are not exposed as a "function" that returns a generator
+      object, but rather as a kind of struct, with communication happening via
+      mutable state instead of "return values".
+
+Yes, Cforall uses an object-style of coroutine, which allows multiple interface
+functions that pass and return values through a structure. This approach allows
+a generator function to have different kinds of return values and different
+kinds of parameters to produce those values. Our generators can provide this
+capability via multiple interface functions to the generator/coroutine state,
+which is discussed on page 5, lines 13-21.
+
+      That is, the generator must be manually resumed and (if I understood) it
+      is expected to store values that can then later be read (perhaps via
+      methods), instead of having a `yield <Expr>` statement that yields up a
+      value explicitly.
+
+All generators are manually resumed, e.g., Python/nodejs use "next" to resume a
+generator. Yes, yield <Expr> has a single interface with one input/return type,
+versus the Cforall approach allowing arbitrary number of interfaces of
+arbitrary types.
+
+    * Both "symmetric" and "asymmetric" generators are supported, instead of
+      only asymmetric.
+
+Yes, because they support different functionality as discussed in Chris
+Marlin's seminal work and both forms are implemented in Simula67. We did not
+invent symmetric and asymmetric generators/coroutines, we took them from the
+literature.
+
+    * Coroutines (multi-frame generators) are an explicit mechanism.
+
+    In most other languages, coroutines are rather built by layering
+    single-frame generators atop one another (e.g., using a mechanism like
+    async-await),
+
+We disagree. Node.js has async-await but has a separate coroutine feature.
+While there are claims that coroutines can be built from async-await and/or
+continuations, in actuality they cannot.
+
+    and symmetric coroutines are basically not supported. I'd like to see a bit
+    more justification for Cforall including all the above mechanisms -- it
+    seemed like symmetric coroutines were a useful building block for some of
+    the user-space threading and custom scheduler mechanisms that were briefly
+    mentioned later in the paper.
+
+Hopefully fixed by moving Table 1 forward.
+
+    In the discussion of coroutines, I would have expected a bit more of a
+    comparison to the async-await mechanism offered in other languages.
+
+We added a new section at the start to point out there is no comparison between
+coroutines and async-await.
+
+    Certainly the semantics of async-await in JavaScript implies
+    significantly more overhead (because each async fn is a distinct heap
+    object). [Rust's approach avoids this overhead][zc], however, and might be
+    worthy of a comparison (see the Performance section).
+
+We could not get Rust async-await to work, and when reading the description of
+rust async-await, it appears to be Java-style executors with futures (possibly
+fast futures).
+
+    There are several sections in the paper that compare against atomics -- for
+    example, on page 15, the paper shows a simple monitor that encapsulates an
+    integer and compares that to C++ atomics. Later, the paper compares the
+    simplicity of monitors against the `volatile` quantifier from Java. The
+    conclusion in section 8 also revisits this point.
+    While I agree that monitors are simpler, they are obviously also
+    significantly different from a performance perspective -- the paper doesn't
+    seem to address this at all. It's plausible that (e.g.) the `Aint` monitor
+    type described in the paper can be compiled and mapped to the specialized
+    instructions offered by hardware, but I didn't see any mention of how this
+    would be done.
+
+Fixed, see response above.
+
+    There is also no mention of the more nuanced memory ordering
+    relations offered by C++11 and how one might achieve similar performance
+    characteristics in Cforall (perhaps the answer is that one simply doesn't
+    need to; I think that's defensible, but worth stating explicitly).
+
+Cforall is built on C, and therefore has full access to all the gcc atomics,
+and automatically gets any gcc updates.  Furthermore, section 6.9 states that
+Cforall provides the full panoply of low-level locks, as does Java, Go, C++,
+for performance programming.
+
+    Cforall includes both internal and external scheduling; I found the
+    explanation for the external scheduling mechanism to be lacking in
+    justification. Why include both mechanisms when most languages seem to make
+    do with only internal scheduling? It would be useful to show some scenarios
+    where external scheduling is truly more powerful.
+
+Fixed. Pointed out external scheduling is simpler as part of rewriting in that
+section, and added additional examples.
+
+    I would have liked to see some more discussion of external scheduling and
+    how it interacts with software engineering best practices. It seems
+    somewhat similar to AOP in certain regards. It seems to add a bit of "extra
+    semantics" to monitor methods, in that any method may now also become a
+    kind of synchronization point.
+
+Fixed somewhat. Pointed out that external scheduling has been around for a long
+time (40 years) in Ada, so there is a body of the software-engineering
+experience using it. As well, I have been teaching it for 30 years in the
+concurrency course at Waterloo. We don't know what software engineering best
+practices you imagine it interacting with. Yes, monitor functions are
+synchronization points with external scheduling.
+
+    The "open-ended" nature of this feels like it could easily lead to subtle
+    bugs, particularly when code refactoring occurs (which may e.g. split an
+    existing method into two).
+
+Any time a public interface is refactored, it invalids existing calls, so there
+is always an issue. For mutex routines and external scheduling, the waitfor
+statements may have to be updated, but that update is part of the refactoring.
+
+    This seems particularly true if external scheduling can occur across
+    compilation units -- the paper suggested that this is true, but I wasn't
+    entirely clear.
+
+Every aspect of Cforall allows separate compilation. The function prototypes
+necessary for separate compilation provide all the information necessary to
+compile any aspect of a program.
+
+    I would have also appreciated a few more details on how external scheduling
+    is implemented. It seems to me that there must be some sort of "hooks" on
+    mutex methods so that they can detect whether some other function is
+    waiting on them and awaken those blocked threads. I'm not sure how such
+    hooks are inserted, particularly across compilation units.
+
+Hooks are inserted by the Cforall translator, in the same way that Java
+inserted hooks into a "synchronized" member of a monitor. As for Java, as long
+as the type information is consistent across compilation units, the correct
+code is inserted.
+
+    The material in Section 5.6 didn't quite clarify the matter for me. For
+    example, it left me somewhat confused about whether the `f` and `g`
+    functions declared were meant to be local to a translation unit, or shared
+    with other unit.
+
+There are no restrictions with respect to static or external mutex functions.
+Cforall is C. Any form of access or separate compilation in C applies to
+Cforall. As in C, function prototypes carry all necessary information to
+compile the code.
+
+    To start, I did not realize that the `mutex_opt` notation was a keyword, I
+    thought it was a type annotation. I think this could be called out more
+    explicitly.
+
+Fixed, indicated "mutex" is a C-style parameter-only declaration type-qualifier.
+
+    Later, in section 5.2, the paper discusses `nomutex` annotations, which
+    initially threw me, as they had not been introduced (now I realize that
+    this paragraph is there to justify why there is no such keyword). The
+    paragraph might be rearranged to make that clearer, perhaps by leading with
+    the choice that Cforall made.
+
+Fixed, rewrote paragraph removing nomutex.
+
+    On page 17, the paper states that "acquiring multiple monitors is safe from
+    deadlock", but this could be stated a bit more precisely: acquiring
+    multiple monitors in a bulk-acquire is safe from deadlock (deadlock can
+    still result from nested acquires).
+
+Fixed.
+
+    On page 18, the paper states that wait states do not have to be enclosed in
+    loops, as there is no concern of barging. This seems true but there are
+    also other reasons to use loops (e.g., if there are multiple reasons to
+    notify on the same condition). Thus the statement initially surprised me,
+    as barging is only one of many reasons that I typically employ loops around
+    waits.
+
+Fixed. Rewrote the sentence. Note, for all non-barging cases where you employ a
+loop around a wait, the unblocking task must change state before blocking
+again.  In the barging case, the unblocking thread blocks again without
+changing state.
+
+    I did not understand the diagram in Figure 12 for some time. Initially, I
+    thought that it was generic to all monitors, and I could not understand the
+    state space. It was only later that I realized it was specific to your
+    example. Updating the caption from "Monitor scheduling to "Monitor
+    scheduling in the example from Fig 13" might have helped me quite a bit.
+
+Fixed, updated text to clarify. Did not change the caption because the
+signal_block does not apply to Figure 13.
+
+    I spent quite some time reading the boy/girl dating example (\*) and I
+    admit I found it somewhat confusing. For example, I couldn't tell whether
+    there were supposed to be many "girl" threads executing at once, or if
+    there was only supposed to be one girl and one boy thread executing in a
+    loop.
+
+The paper states:
+
+  The dating service matches girl and boy threads with matching compatibility
+  codes so they can exchange phone numbers.
+
+so there are many girl/boy threads. There is nothing preventing an individual
+girl/boy from arranging multiple dates.
+
+    Are the girl/boy threads supposed to invoke the girl/boy methods or vice
+    versa?
+
+As long as the girls/boys are consistent in the calls, it does not matter. The
+goal is to find a partner and exchange phone numbers.
+
+    Surely there is some easier way to set this up?
+
+There are some other solutions using monitors but they all have a similar
+structure.
+
+    The paper offered a number of comparisons to Go, C#, Scala, and so forth,
+    but seems to have overlooked another recent language, Rust. In many ways,
+    Rust seems to be closest in philosophy to Cforall, so it seems like an odd
+    omission. I already mentioned above that Rust is in the process of shipping
+    [async-await syntax][aa], which is definitely an alternative to the
+    generator/coroutine approach in Cforall (though one with clear pros/cons).
+
+We cannot get rust async-await example programs to compile nor does the select!
+macro compile.
+
+  @plg2[1]% rustc --version
+  rustc 1.40.0 (73528e339 2019-12-16)
+  
+  @plg2[2]% cat future.rs 
+  use futures::executor::block_on;
+  
+  async fn hello_world() {
+      println!("hello, world!");
+  }
+  
+  fn main() {
+      let future = hello_world(); // Nothing is printed
+      block_on(future); // `future` is run and "hello, world!" is printed
+  }
+  
+  @plg2[3]% rustc -C opt-level=3 future.rs
+  error[E0670]: `async fn` is not permitted in the 2015 edition
+   --> future.rs:3:1
+    |
+  3 | async fn hello_world() {
+    | ^^^^^
+  
+  error[E0433]: failed to resolve: maybe a missing crate `futures`?
+   --> future.rs:1:5
+    |
+  1 | use futures::executor::block_on;
+    |     ^^^^^^^ maybe a missing crate `futures`?
+  
+  error[E0425]: cannot find function `block_on` in this scope
+   --> future.rs:9:5
+    |
+  9 |     block_on(future); // `future` is run and "hello, world!" is printed
+    |     ^^^^^^^^ not found in this scope
+  
+  error: aborting due to 3 previous errors
+  
+  Some errors have detailed explanations: E0425, E0433, E0670.
+  For more information about an error, try `rustc --explain E0425`.
+
+
+    In the performance section in particular, you might consider comparing
+    against some of the Rust web servers and threading systems.
+
+This paper is not about building web-servers. Nor are web-servers a reasonable
+benchmark for language concurrency. Web-servers are a benchmark for
+non-blocking I/O library efficiency accessed in the underlying operating
+system. Our prior work on web-server performance:
+
+@inproceedings{Pariag07,
+    author	= {David Pariag and Tim Brecht and Ashif Harji and Peter Buhr and Amol Shukla},
+    title	= {Comparing the Performance of Web Server Architectures},
+    booktitle	= {Proceedings of the 2007 Eurosys conference},
+    month	= mar,
+    year	= 2007,
+    pages	= {231--243},
+}
+
+@inproceedings{Harji12,
+    author	= {Ashif S. Harji and Peter A. Buhr and Tim Brecht},
+    title	= {Comparing High-Performance Multi-core Web-Server Architectures},
+    booktitle	= {Proceedings of the 5th Annual International Systems and Storage Conference},
+    series	= {SYSTOR '12},
+    publisher	= {ACM},
+    address	= {New York, NY, USA},
+    location	= {Haifa, Israel},
+    month	= jun,
+    year	= 2012,
+    articleno  	= 1,
+    pages	= {1:1--1:12},
+}
+
+shows the steps to build a high-performance web-server, which are largely
+independent of the server architecture and programing language.
+
+    It would seem worth trying to compare their "context switching" costs as
+    well -- I believe both actix and tokio have a notion of threads that could
+    be readily compared.
+
+Again, context-switching speed is largely irrelevant because the amount of code
+to process an http request is large enough to push any concurrency costs into
+the background.
+
+    Another addition that might be worth considering is to compare against
+    node.js promises, although I think the comparison to process creation is
+    not as clean.
+
+Done.
