Index: doc/theses/thierry_delisle_PhD/thesis/text/core.tex
===================================================================
--- doc/theses/thierry_delisle_PhD/thesis/text/core.tex	(revision 264f6c9ac4174099b8d274d5e27a62a3e2ffbde1)
+++ doc/theses/thierry_delisle_PhD/thesis/text/core.tex	(revision 62424af292b77c62439ac8a7107e71e4bc01b55b)
@@ -10,11 +10,11 @@
 
 \section{Design Goals}
-As with most of the design decisions behind \CFA, an important goal is to match the expectation of the programmer according to their execution mental-model.
-To match expectations, the design must offer the programmer sufficient guarantees so that, as long as they respect the execution mental-model, the system also respects this model.
-
-For threading, a simple and common execution mental-model is the ``Ideal multi-tasking CPU'' :
+As with most of the design decisions behind \CFA, an important goal is to match the expectation of the programmer according to their execution mental model.
+To match expectations, the design must offer the programmer sufficient guarantees so that, as long as they respect the execution mental model, the system also respects this model.
+
+For threading, a simple and common execution mental model is the ``Ideal multi-tasking CPU'' :
 
 \begin{displayquote}[Linux CFS\cite{MAN:linux/cfs}]
-	{[The]} ``Ideal multi-tasking CPU'' is a (non-existent  :-)) CPU that has 100\% physical power and which can run each task at precise equal speed, in parallel, each at [an equal fraction of the] speed.  For example: if there are 2 tasks running, then it runs each at 50\% physical power --- i.e., actually in parallel.
+	{[The]} ``Ideal multi-tasking CPU'' is a (non-existent  :-)) CPU that has 100\% physical power and which can run each task at precise equal speed, in parallel, each at [an equal fraction of the] speed.  For example: if there are 2 running tasks, then it runs each at 50\% physical power --- i.e., actually in parallel.
 	\label{q:LinuxCFS}
 \end{displayquote}
@@ -40,5 +40,5 @@
 This demonstration can be made by comparing applications built in \CFA to applications built with other languages or other models.
 Recall programmer expectation is that the impact of the scheduler can be ignored.
-Therefore, if the cost of scheduling is competitive to other popular languages, the guarantee is consider achieved.
+Therefore, if the cost of scheduling is competitive with other popular languages, the guarantee is considered achieved.
 More precisely the scheduler should be:
 \begin{itemize}
@@ -53,9 +53,9 @@
 In any running system, a \proc can stop dequeuing \ats if it starts running a \at that never blocks.
 Without preemption, traditional work-stealing schedulers do not have starvation freedom in this case.
-Now this requirement begs the question, what about preemption?
-Generally speaking preemption happens on the timescale of several milliseconds, which brings us to the next requirement: ``fast'' load balancing.
+Now, this requirement begs the question, what about preemption?
+Generally speaking, preemption happens on the timescale of several milliseconds, which brings us to the next requirement: ``fast'' load balancing.
 
 \paragraph{Fast load balancing} means that load balancing should happen faster than preemption would normally allow.
-For interactive applications that need to run at 60, 90, 120 frames per second, \ats having to wait for several milliseconds to run are effectively starved.
+For interactive applications that need to run at 60, 90 or 120 frames per second, \ats having to wait for several milliseconds to run are effectively starved.
 Therefore load-balancing should be done at a faster pace, one that can detect starvation at the microsecond scale.
 With that said, this is a much fuzzier requirement since it depends on the number of \procs, the number of \ats and the general \gls{load} of the system.
@@ -69,10 +69,10 @@
 For a scheduler, having good locality, \ie, having the data local to each \gls{hthrd}, generally conflicts with fairness.
 Indeed, good locality often requires avoiding the movement of cache lines, while fairness requires dynamically moving a \at, and as consequence cache lines, to a \gls{hthrd} that is currently available.
-Note that this section discusses \emph{internal locality}, \ie, the locality of the data used by the scheduler versus \emph{external locality}, \ie, how the data used by the application is affected by scheduling.
+Note that this section discusses \emph{internal locality}, \ie, the locality of the data used by the scheduler versus \emph{external locality}, \ie, how scheduling affects the locality of the application's data.
 External locality is a much more complicated subject and is discussed in the next section.
 
 However, I claim that in practice it is possible to strike a balance between fairness and performance because these goals do not necessarily overlap temporally.
 Figure~\ref{fig:fair} shows a visual representation of this behaviour.
-As mentioned, some unfairness is acceptable; therefore it is desirable to have an algorithm that prioritizes cache locality as long as thread delay does not exceed the execution mental-model.
+As mentioned, some unfairness is acceptable; therefore it is desirable to have an algorithm that prioritizes cache locality as long as thread delay does not exceed the execution mental model.
 
 \begin{figure}
@@ -80,5 +80,5 @@
 	\input{fairness.pstex_t}
 	\vspace*{-10pt}
-	\caption[Fairness vs Locality graph]{Rule of thumb Fairness vs Locality graph \smallskip\newline The importance of Fairness and Locality while a ready \at awaits running is shown as the time the ready \at waits increases, Ready Time, the chances that its data is still in cache decreases, Locality.
+	\caption[Fairness vs Locality graph]{Rule of thumb Fairness vs Locality graph \smallskip\newline The importance of Fairness and Locality while a ready \at awaits running is shown as the time the ready \at waits increases (Ready Time) the chances that its data is still in cache decreases (Locality).
 	At the same time, the need for fairness increases since other \ats may have the chance to run many times, breaking the fairness model.
 	Since the actual values and curves of this graph can be highly variable, the graph is an idealized representation of the two opposing goals.}
@@ -94,5 +94,5 @@
 Given a large number of \procs and an even larger number of \ats, scalability measures how fast \procs can enqueue and dequeues \ats.
 One could expect that doubling the number of \procs would double the rate at which \ats are dequeued, but contention on the internal data structure of the scheduler can lead to worst improvements.
-While the ready-queue itself can be sharded to alleviate the main source of contention, auxiliary scheduling features, \eg counting ready \ats, can also be sources of contention.
+While the ready queue itself can be sharded to alleviate the main source of contention, auxiliary scheduling features, \eg counting ready \ats, can also be sources of contention.
 
 \subsubsection{Migration Cost}
@@ -108,5 +108,5 @@
 The problem is a single point of contention when adding/removing \ats.
 As shown in the evaluation sections, most production schedulers do scale when adding \glspl{hthrd}.
-The solution to this problem is to shard the ready-queue: create multiple \emph{subqueues} forming the logical ready-queue and the subqueues are accessed by multiple \glspl{hthrd} without interfering.
+The solution to this problem is to shard the ready queue: create multiple \emph{sub-queues} forming the logical ready queue and the sub-queues are accessed by multiple \glspl{hthrd} without interfering.
 
 Before going into the design of \CFA's scheduler, it is relevant to discuss two sharding solutions that served as the inspiration scheduler in this thesis.
@@ -115,5 +115,5 @@
 
 As mentioned in \ref{existing:workstealing}, a popular sharding approach for the ready-queue is work-stealing.
-In this approach, each \gls{proc} has its own local subqueue and \glspl{proc} only access each other's subqueue if they run out of work on their local ready-queue.
+In this approach, each \gls{proc} has its own local sub-queue and \glspl{proc} only access each other's sub-queue if they run out of work on their local ready-queue.
 The interesting aspect of work stealing happens in the steady-state scheduling case, \ie all \glspl{proc} have work and no load balancing is needed.
 In this case, work stealing is close to optimal scheduling: it can achieve perfect locality and have no contention.
@@ -122,28 +122,28 @@
 Chapter~\ref{microbench} shows that pathological cases work stealing can lead to indefinite starvation.
 
-Based on these observation, the conclusion is that a \emph{perfect} scheduler should behave similar to work-stealing in the steady-state case, but load balance proactively when the need arises.
+Based on these observations, the conclusion is that a \emph{perfect} scheduler should behave similarly to work-stealing in the steady-state case, but load balance proactively when the need arises.
 
 \subsection{Relaxed-FIFO}
 A different scheduling approach is to create a ``relaxed-FIFO'' queue, as in \cite{alistarh2018relaxed}.
-This approach forgoes any ownership between \gls{proc} and subqueue, and simply creates a pool of ready-queues from which \glspl{proc} pick.
+This approach forgoes any ownership between \gls{proc} and sub-queue, and simply creates a pool of ready queues from which \glspl{proc} pick.
 Scheduling is performed as follows:
 \begin{itemize}
 \item
-All subqueues are protected by TryLocks.
-\item
-Timestamps are added to each element of a subqueue.
-\item
-A \gls{proc} randomly tests ready queues until it has acquired one or two queues.
-\item
-If two queues are acquired, the older of the two \ats at the front the acquired queues is dequeued.
-\item
-Otherwise the \ats from the single queue is dequeued.
+All sub-queues are protected by TryLocks.
+\item
+Timestamps are added to each element of a sub-queue.
+\item
+A \gls{proc} randomly tests ready-queues until it has acquired one or two queues.
+\item
+If two queues are acquired, the older of the two \ats is dequeued from the front of the acquired queues.
+\item
+Otherwise, the \at from the single queue is dequeued.
 \end{itemize}
 The result is a queue that has both good scalability and sufficient fairness.
 The lack of ownership ensures that as long as one \gls{proc} is still able to repeatedly dequeue elements, it is unlikely any element will delay longer than any other element.
-This guarantee contrasts with work-stealing, where a \gls{proc} with a long subqueue results in unfairness for its \ats in comparison to a \gls{proc} with a short subqueue.
+This guarantee contrasts with work-stealing, where a \gls{proc} with a long sub-queue results in unfairness for its \ats in comparison to a \gls{proc} with a short sub-queue.
 This unfairness persists until a \gls{proc} runs out of work and steals.
 
-An important aspects of this scheme's fairness approach is that the timestamps make it possible to evaluate how long elements have been on the queue.
+An important aspect of this scheme's fairness approach is that the timestamps make it possible to evaluate how long elements have been in the queue.
 However, \glspl{proc} eagerly search for these older elements instead of focusing on specific queues, which negatively affects locality.
 
@@ -152,57 +152,57 @@
 
 \section{Relaxed-FIFO++}
-The inherent fairness and good performance with many \ats, makes the relaxed-FIFO queue a good candidate to form the basis of a new scheduler.
+The inherent fairness and good performance with many \ats make the relaxed-FIFO queue a good candidate to form the basis of a new scheduler.
 The problem case is workloads where the number of \ats is barely greater than the number of \procs.
-In these situations, the wide sharding of the ready queue means most of its subqueues are empty.
-Furthermore, the non-empty subqueues are unlikely to hold more than one item.
-The consequence is that a random dequeue operation is likely to pick an empty subqueue, resulting in an unbounded number of selections.
-This state is generally unstable: each subqueue is likely to frequently toggle between being empty and nonempty.
-Indeed, when the number of \ats is \emph{equal} to the number of \procs, every pop operation is expected to empty a subqueue and every push is expected to add to an empty subqueue.
-In the worst case, a check of the subqueues sees all are empty or full.
+In these situations, the wide sharding of the ready queue means most of its sub-queues are empty.
+Furthermore, the non-empty sub-queues are unlikely to hold more than one item.
+The consequence is that a random dequeue operation is likely to pick an empty sub-queue, resulting in an unbounded number of selections.
+This state is generally unstable: each sub-queue is likely to frequently toggle between being empty and nonempty.
+Indeed, when the number of \ats is \emph{equal} to the number of \procs, every pop operation is expected to empty a sub-queue and every push is expected to add to an empty sub-queue.
+In the worst case, a check of the sub-queues sees all are empty or full.
 
 As this is the most obvious challenge, it is worth addressing first.
-The obvious solution is to supplement each sharded subqueue with data that indicates if the queue is empty/nonempty to simplify finding nonempty queues, \ie ready \glspl{at}.
-This sharded data can be organized in different forms, \eg a bitmask or a binary tree that tracks the nonempty subqueues.
+The obvious solution is to supplement each sharded sub-queue with data that indicates if the queue is empty/nonempty to simplify finding nonempty queues, \ie ready \glspl{at}.
+This sharded data can be organized in different forms, \eg a bitmask or a binary tree that tracks the nonempty sub-queues.
 Specifically, many modern architectures have powerful bitmask manipulation instructions or searching a binary tree has good Big-O complexity.
-However, precisely tracking nonempty subqueues is problematic.
-The reason is that the subqueues are initially sharded with a width presumably chosen to avoid contention.
-However, tracking which ready queue is nonempty is only useful if the tracking data is dense, \ie denser than the sharded subqueues.
-Otherwise, it does not provide useful information because reading this new data structure risks being as costly as simply picking a subqueue at random.
-But if the tracking mechanism \emph{is} denser than the shared subqueues, than constant updates invariably create a new source of contention.
+However, precisely tracking nonempty sub-queues is problematic.
+The reason is that the sub-queues are initially sharded with a width presumably chosen to avoid contention.
+However, tracking which ready queue is nonempty is only useful if the tracking data is dense, \ie denser than the sharded sub-queues.
+Otherwise, it does not provide useful information because reading this new data structure risks being as costly as simply picking a sub-queue at random.
+But if the tracking mechanism \emph{is} denser than the shared sub-queues, then constant updates invariably create a new source of contention.
 Early experiments with this approach showed that randomly picking, even with low success rates, is often faster than bit manipulations or tree walks.
 
 The exception to this rule is using local tracking.
-If each \proc locally keeps track of empty subqueues, than this can be done with a very dense data structure without introducing a new source of contention.
+If each \proc locally keeps track of empty sub-queues, then this can be done with a very dense data structure without introducing a new source of contention.
 However, the consequence of local tracking is that the information is incomplete.
-Each \proc is only aware of the last state it saw about each subqueue so this information quickly becomes stale.
+Each \proc is only aware of the last state it saw about each sub-queue so this information quickly becomes stale.
 Even on systems with low \gls{hthrd} count, \eg 4 or 8, this approach can quickly lead to the local information being no better than the random pick.
 This result is due in part to the cost of maintaining information and its poor quality.
 
-However, using a very low cost but inaccurate approach for local tracking can actually be beneficial.
-If the local tracking is no more costly than a random pick, than \emph{any} improvement to the success rate, however low it is, leads to a performance benefits.
-This suggests to the following approach:
+However, using a very low-cost but inaccurate approach for local tracking can still be beneficial.
+If the local tracking is no more costly than a random pick, then \emph{any} improvement to the success rate, however low it is, leads to a performance benefit.
+This suggests the following approach:
 
 \subsection{Dynamic Entropy}\cite{xkcd:dynamicentropy}
-The Relaxed-FIFO approach can be made to handle the case of mostly empty subqueues by tweaking the \glsxtrlong{prng}.
-The \glsxtrshort{prng} state can be seen as containing a list of all the future subqueues that will be accessed.
-While this concept is not particularly useful on its own, the consequence is that if the \glsxtrshort{prng} algorithm can be run \emph{backwards}, then the state also contains a list of all the subqueues that were accessed.
+The Relaxed-FIFO approach can be made to handle the case of mostly empty sub-queues by tweaking the \glsxtrlong{prng}.
+The \glsxtrshort{prng} state can be seen as containing a list of all the future sub-queues that will be accessed.
+While this concept is not particularly useful on its own, the consequence is that if the \glsxtrshort{prng} algorithm can be run \emph{backwards}, then the state also contains a list of all the sub-queues that were accessed.
 Luckily, bidirectional \glsxtrshort{prng} algorithms do exist, \eg some Linear Congruential Generators\cite{wiki:lcg} support running the algorithm backwards while offering good quality and performance.
 This particular \glsxtrshort{prng} can be used as follows:
 \begin{itemize}
 \item
-Each \proc maintains two \glsxtrshort{prng} states, refereed to as $F$ and $B$.
-\item
-When a \proc attempts to dequeue a \at, it picks a subqueue by running $B$ backwards.
-\item
-When a \proc attempts to enqueue a \at, it runs $F$ forward picking a subqueue to enqueue to.
-If the enqueue is successful, the state $B$ is overwritten with the content of $F$.
+Each \proc maintains two \glsxtrshort{prng} states, referred to as $F$ and $B$.
+\item
+When a \proc attempts to dequeue a \at, it picks a sub-queue by running $B$ backwards.
+\item
+When a \proc attempts to enqueue a \at, it runs $F$ forward picking a sub-queue to enqueue to.
+If the enqueue is successful, state $B$ is overwritten with the content of $F$.
 \end{itemize}
 The result is that each \proc tends to dequeue \ats that it has itself enqueued.
-When most subqueues are empty, this technique increases the odds of finding \ats at very low cost, while also offering an improvement on locality in many cases.
+When most sub-queues are empty, this technique increases the odds of finding \ats at a very low cost, while also offering an improvement on locality in many cases.
 
 Tests showed this approach performs better than relaxed-FIFO in many cases.
 However, it is still not competitive with work-stealing algorithms.
 The fundamental problem is that the constant randomness limits how much locality the scheduler offers.
-This becomes problematic both because the scheduler is likely to get cache misses on internal data-structures and because migrations become frequent.
+This becomes problematic both because the scheduler is likely to get cache misses on internal data structures and because migrations become frequent.
 Therefore, the attempt to modify the relaxed-FIFO algorithm to behave more like work stealing did not pan out.
 The alternative is to do it the other way around.
@@ -210,7 +210,7 @@
 \section{Work Stealing++}\label{helping}
 To add stronger fairness guarantees to work stealing a few changes are needed.
-First, the relaxed-FIFO algorithm has fundamentally better fairness because each \proc always monitors all subqueues.
+First, the relaxed-FIFO algorithm has fundamentally better fairness because each \proc always monitors all sub-queues.
 Therefore, the work-stealing algorithm must be prepended with some monitoring.
-Before attempting to dequeue from a \proc's subqueue, the \proc must make some effort to ensure other subqueues are not being neglected.
+Before attempting to dequeue from a \proc's sub-queue, the \proc must make some effort to ensure other sub-queues are not being neglected.
 To make this possible, \procs must be able to determine which \at has been on the ready queue the longest.
 Second, the relaxed-FIFO approach needs timestamps for each \at to make this possible.
@@ -219,6 +219,6 @@
 	\centering
 	\input{base.pstex_t}
-	\caption[Base \CFA design]{Base \CFA design \smallskip\newline A pool of subqueues offers the sharding, two per \glspl{proc}.
-	Each \gls{proc} can access all of the subqueues.
+	\caption[Base \CFA design]{Base \CFA design \smallskip\newline A pool of sub-queues offers the sharding, two per \proc.
+	Each \gls{proc} can access all of the sub-queues.
 	Each \at is timestamped when enqueued.}
 	\label{fig:base}
@@ -226,50 +226,50 @@
 
 Figure~\ref{fig:base} shows the algorithm structure.
-This structure is similar to classic work-stealing except the subqueues are placed in an array so \procs can access them in constant time.
+This structure is similar to classic work-stealing except the sub-queues are placed in an array so \procs can access them in constant time.
 Sharding width can be adjusted based on contention.
 Note, as an optimization, the TS of a \at is stored in the \at in front of it, so the first TS is in the array and the last \at has no TS.
 This organization keeps the highly accessed front TSs directly in the array.
-When a \proc attempts to dequeue a \at, it first picks a random remote subqueue and compares its timestamp to the timestamps of its local subqueue(s).
+When a \proc attempts to dequeue a \at, it first picks a random remote sub-queue and compares its timestamp to the timestamps of its local sub-queue(s).
 The oldest waiting \at is dequeued to provide global fairness.
 
-However, this na\"ive implemented has performance problems.
+However, this na\"ive implementation has performance problems.
 First, it is necessary to have some damping effect on helping.
 Random effects like cache misses and preemption can add spurious but short bursts of latency negating the attempt to help.
-These bursts can cause increased migrations and make this work stealing approach slowdown to the level of relaxed-FIFO.
+These bursts can cause increased migrations and make this work-stealing approach slow down to the level of relaxed-FIFO.
 
 \begin{figure}
 	\centering
 	\input{base_avg.pstex_t}
-	\caption[\CFA design with Moving Average]{\CFA design with Moving Average \smallskip\newline A moving average is added to each subqueue.}
+	\caption[\CFA design with Moving Average]{\CFA design with Moving Average \smallskip\newline A moving average is added to each sub-queue.}
 	\label{fig:base-ma}
 \end{figure}
 
-A simple solution to this problem is to use an exponential moving average\cite{wiki:ma} (MA) instead of a raw timestamps, shown in Figure~\ref{fig:base-ma}.
-Note, this is more complex because the \at at the head of a subqueue is still waiting, so its wait time has not ended.
-Therefore, the exponential moving average is actually an exponential moving average of how long each dequeued \at has waited.
-To compare subqueues, the timestamp at the head must be compared to the current time, yielding the best-case wait-time for the \at at the head of the queue.
+A simple solution to this problem is to use an exponential moving average\cite{wiki:ma} (MA) instead of a raw timestamp, as shown in Figure~\ref{fig:base-ma}.
+Note, that this is more complex because the \at at the head of a sub-queue is still waiting, so its wait time has not ended.
+Therefore, the exponential moving average is an average of how long each dequeued \at has waited.
+To compare sub-queues, the timestamp at the head must be compared to the current time, yielding the best-case wait time for the \at at the head of the queue.
 This new waiting is averaged with the stored average.
-To further limit \glslink{atmig}{migrations}, a bias can be added to a local subqueue, where a remote subqueue is helped only if its moving average is more than $X$ times the local subqueue's average.
+To further limit \glslink{atmig}{migrations}, a bias can be added to a local sub-queue, where a remote sub-queue is helped only if its moving average is more than $X$ times the local sub-queue's average.
 Tests for this approach indicate the choice of the weight for the moving average or the bias is not important, \ie weights and biases of similar \emph{magnitudes} have similar effects.
 
 With these additions to work stealing, scheduling can be made as fair as the relaxed-FIFO approach, avoiding the majority of unnecessary migrations.
 Unfortunately, the work to achieve fairness has a performance cost, especially when the workload is inherently fair, and hence, there is only short-term or no starvation.
-The problem is that the constant polling, \ie reads, of remote subqueues generally entail a cache miss because the TSs are constantly being updated, \ie, writes.
-To make things worst, remote subqueues that are very active, \ie \ats are frequently enqueued and dequeued from them, lead to higher chances that polling will incur a cache-miss.
-Conversely, the active subqueues do not benefit much from helping since starvation is already a non-issue.
-This puts this algorithm in the awkward situation of paying for a cost that is largely unnecessary.
+The problem is that the constant polling, \ie reads, of remote sub-queues generally entails cache misses because the TSs are constantly being updated, \ie, writes.
+To make things worst, remote sub-queues that are very active, \ie \ats are frequently enqueued and dequeued from them, lead to higher chances that polling will incur a cache-miss.
+Conversely, the active sub-queues do not benefit much from helping since starvation is already a non-issue.
+This puts this algorithm in the awkward situation of paying for a largely unnecessary cost.
 The good news is that this problem can be mitigated
 
 \subsection{Redundant Timestamps}\label{relaxedtimes}
-The problem with polling remote subqueues is that correctness is critical.
-There must be a consensus among \procs on which subqueues hold which \ats, as the \ats are in constant motion.
-Furthermore, since timestamps are use for fairness, it is critical to have consensus on which \at is the oldest.
-However, when deciding if a remote subqueue is worth polling, correctness is less of a problem.
-Since the only requirement is that a subqueue is eventually polled, some data staleness is acceptable.
+The problem with polling remote sub-queues is that correctness is critical.
+There must be a consensus among \procs on which sub-queues hold which \ats, as the \ats are in constant motion.
+Furthermore, since timestamps are used for fairness, it is critical to have a consensus on which \at is the oldest.
+However, when deciding if a remote sub-queue is worth polling, correctness is less of a problem.
+Since the only requirement is that a sub-queue is eventually polled, some data staleness is acceptable.
 This leads to a situation where stale timestamps are only problematic in some cases.
-Furthermore, stale timestamps can be desirable since lower freshness requirements mean less cache invalidations.
+Furthermore, stale timestamps can be desirable since lower freshness requirements mean fewer cache invalidations.
 
 Figure~\ref{fig:base-ts2} shows a solution with a second array containing a copy of the timestamps and average.
-This copy is updated \emph{after} the subqueue's critical sections using relaxed atomics.
+This copy is updated \emph{after} the sub-queue's critical sections using relaxed atomics.
 \Glspl{proc} now check if polling is needed by comparing the copy of the remote timestamp instead of the actual timestamp.
 The result is that since there is no fencing, the writes can be buffered in the hardware and cause fewer cache invalidations.
@@ -285,12 +285,12 @@
 The correctness argument is somewhat subtle.
 The data used for deciding whether or not to poll a queue can be stale as long as it does not cause starvation.
-Therefore, it is acceptable if stale data makes queues appear older than they really are but appearing fresher can be a problem.
-For the timestamps, this means missing writes to the timestamp is acceptable since they make the head \at look older.
+Therefore, it is acceptable if stale data makes queues appear older than they are but appearing fresher can be a problem.
+For the timestamps, this means it is acceptable to miss writes to the timestamp since they make the head \at look older.
 For the moving average, as long as the operations are just atomic reads/writes, the average is guaranteed to yield a value that is between the oldest and newest values written.
-Therefore, this unprotected read of the timestamp and average satisfy the limited correctness that is required.
+Therefore, this unprotected read of the timestamp and average satisfies the limited correctness that is required.
 
 With redundant timestamps, this scheduling algorithm achieves both the fairness and performance requirements on most machines.
 The problem is that the cost of polling and helping is not necessarily consistent across each \gls{hthrd}.
-For example, on machines with a CPU containing multiple hyperthreads and cores and multiple CPU sockets, cache misses can be satisfied from the caches on same (local) CPU, or by a CPU on a different (remote) socket.
+For example, on machines with a CPU containing multiple hyper threads and cores and multiple CPU sockets, cache misses can be satisfied from the caches on the same (local) CPU, or by a CPU on a different (remote) socket.
 Cache misses satisfied by a remote CPU have significantly higher latency than from the local CPU.
 However, these delays are not specific to systems with multiple CPUs.
@@ -313,9 +313,9 @@
 In Figure~\ref{fig:cache-share}, all cache misses are either private to a CPU or shared with another CPU.
 This means latency due to cache misses is fairly consistent.
-In contrast, in Figure~\ref{fig:cache-noshare} misses in the L2 cache can be satisfied by either instance of L3 cache.
+In contrast, in Figure~\ref{fig:cache-noshare} misses in the L2 cache can be satisfied by either instance of the L3 cache.
 However, the memory-access latency to the remote L3 is higher than the memory-access latency to the local L3.
 The impact of these different designs on this algorithm is that scheduling only scales well on architectures with a wide L3 cache, similar to Figure~\ref{fig:cache-share}, and less well on architectures with many narrower L3 cache instances, similar to Figure~\ref{fig:cache-noshare}.
-Hence, as the number of L3 instances grow, so too does the chance that the random helping causes significant cache latency.
-The solution is for the scheduler be aware of the cache topology.
+Hence, as the number of L3 instances grows, so too does the chance that the random helping causes significant cache latency.
+The solution is for the scheduler to be aware of the cache topology.
 
 \subsection{Per CPU Sharding}
@@ -323,29 +323,29 @@
 Unfortunately, there is no portable way to discover cache topology, and it is outside the scope of this thesis to solve this problem.
 This work uses the cache topology information from Linux's @/sys/devices/system/cpu@ directory.
-This leaves the challenge of matching \procs to cache structure, or more precisely identifying which subqueues of the ready queue are local to which subcomponents of the cache structure.
-Once a matching is generated, the helping algorithm is changed to add bias so that \procs more often help subqueues local to the same cache substructure.\footnote{
+This leaves the challenge of matching \procs to cache structure, or more precisely identifying which sub-queues of the ready queue are local to which subcomponents of the cache structure.
+Once a match is generated, the helping algorithm is changed to add bias so that \procs more often help sub-queues local to the same cache substructure.\footnote{
 Note that like other biases mentioned in this section, the actual bias value does not appear to need precise tuning.}
 
-The simplest approach for mapping subqueues to cache structure is to statically tie subqueues to CPUs.
-Instead of having each subqueue local to a specific \proc, the system is initialized with subqueues for each hardware hyperthread/core up front.
-Then \procs dequeue and enqueue by first asking which CPU id they are executing on, in order to identify which subqueues are the local ones.
+The simplest approach for mapping sub-queues to cache structure is to statically tie sub-queues to CPUs.
+Instead of having each sub-queue local to a specific \proc, the system is initialized with sub-queues for each hardware hyperthread/core up front.
+Then \procs dequeue and enqueue by first asking which CPU id they are executing on, to identify which sub-queues are the local ones.
 \Glspl{proc} can get the CPU id from @sched_getcpu@ or @librseq@.
 
 This approach solves the performance problems on systems with topologies with narrow L3 caches, similar to Figure \ref{fig:cache-noshare}.
 However, it can still cause some subtle fairness problems in systems with few \procs and many \glspl{hthrd}.
-In this case, the large number of subqueues and the bias against subqueues tied to different cache substructures make it unlikely that every subqueue is picked.
-To make things worst, the small number of \procs mean that few helping attempts are made.
-This combination of low selection and few helping attempts allow a \at to become stranded on a subqueue for a long time until it gets randomly helped.
-On a system with 2 \procs, 256 \glspl{hthrd} with narrow cache sharing, and a 100:1 bias, it can actually take multiple seconds for a \at to get dequeued from a remote queue.
-Therefore, a more dynamic matching of subqueues to cache instance is needed.
+In this case, the large number of sub-queues and the bias against sub-queues tied to different cache substructures make it unlikely that every sub-queue is picked.
+To make things worst, the small number of \procs means that few helping attempts are made.
+This combination of low selection and few helping attempts allow a \at to become stranded on a sub-queue for a long time until it gets randomly helped.
+On a system with 2 \procs, 256 \glspl{hthrd} with narrow cache sharing, and a 100:1 bias, it can take multiple seconds for a \at to get dequeued from a remote queue.
+Therefore, a more dynamic match of sub-queues to cache instances is needed.
 
 \subsection{Topological Work Stealing}
 \label{s:TopologicalWorkStealing}
-Therefore, the approach used in the \CFA scheduler is to have per-\proc subqueues, but have an explicit data-structure track which cache substructure each subqueue is tied to.
+Therefore, the approach used in the \CFA scheduler is to have per-\proc sub-queues, but have an explicit data structure to track which cache substructure each sub-queue is tied to.
 This tracking requires some finesse because reading this data structure must lead to fewer cache misses than not having the data structure in the first place.
 A key element however is that, like the timestamps for helping, reading the cache instance mapping only needs to give the correct result \emph{often enough}.
 Therefore the algorithm can be built as follows: before enqueueing or dequeuing a \at, each \proc queries the CPU id and the corresponding cache instance.
-Since subqueues are tied to \procs, each \proc can then update the cache instance mapped to the local subqueue(s).
-To avoid unnecessary cache line invalidation, the map is only written to if the mapping changes.
+Since sub-queues are tied to \procs, each \proc can then update the cache instance mapped to the local sub-queue(s).
+To avoid unnecessary cache line invalidation, the map is only written-to if the mapping changes.
 
 This scheduler is used in the remainder of the thesis for managing CPU execution, but additional scheduling is needed to handle long-term blocking and unblocking, such as I/O.
Index: doc/theses/thierry_delisle_PhD/thesis/text/front.tex
===================================================================
--- doc/theses/thierry_delisle_PhD/thesis/text/front.tex	(revision 264f6c9ac4174099b8d274d5e27a62a3e2ffbde1)
+++ doc/theses/thierry_delisle_PhD/thesis/text/front.tex	(revision 62424af292b77c62439ac8a7107e71e4bc01b55b)
@@ -134,5 +134,5 @@
 
 This thesis analyses multiple scheduler systems, where each system attempts to fulfill the requirements for user-level threading.
-The predominant technique for managing high levels of concurrency is sharding the ready-queue with one queue per \gls{kthrd} and using some form of work stealing/sharing to dynamically rebalance workload shifts.
+The predominant technique for managing high levels of concurrency is sharding the ready queue with one queue per \gls{kthrd} and using some form of work stealing/sharing to dynamically rebalance workload shifts.
 Preventing kernel blocking is accomplished by transforming kernel locks and I/O operations into user-level operations that do not block the kernel thread or spin up new kernel threads to manage the blocking.
 Fairness is handled through preemption and/or ad-hoc solutions, which leads to coarse-grained fairness with some pathological cases.
Index: doc/theses/thierry_delisle_PhD/thesis/text/intro.tex
===================================================================
--- doc/theses/thierry_delisle_PhD/thesis/text/intro.tex	(revision 264f6c9ac4174099b8d274d5e27a62a3e2ffbde1)
+++ doc/theses/thierry_delisle_PhD/thesis/text/intro.tex	(revision 62424af292b77c62439ac8a7107e71e4bc01b55b)
@@ -12,5 +12,5 @@
 
 This thesis analyses multiple scheduler systems, where each system attempts to fulfill the requirements for \gls{uthrding}.
-The predominant technique for managing high levels of concurrency is sharding the ready-queue with one queue per kernel-thread and using some form of work stealing/sharing to dynamically rebalance workload shifts.
+The predominant technique for managing high levels of concurrency is sharding the ready queue with one queue per kernel-thread and using some form of work stealing/sharing to dynamically rebalance workload shifts.
 Preventing kernel blocking is accomplished by transforming kernel locks and I/O operations into user-level operations that do not block the kernel thread or spin up new kernel threads to manage the blocking.
 Fairness is handled through preemption and/or ad-hoc solutions, which leads to coarse-grained fairness with some pathological cases.
Index: doc/theses/thierry_delisle_PhD/thesis/text/runtime.tex
===================================================================
--- doc/theses/thierry_delisle_PhD/thesis/text/runtime.tex	(revision 264f6c9ac4174099b8d274d5e27a62a3e2ffbde1)
+++ doc/theses/thierry_delisle_PhD/thesis/text/runtime.tex	(revision 62424af292b77c62439ac8a7107e71e4bc01b55b)
@@ -4,5 +4,5 @@
 \section{C Threading}
 
-\Celeven introduced threading features, such the @_Thread_local@ storage class, and libraries @stdatomic.h@ and @threads.h@.
+\Celeven introduced threading features, such as the @_Thread_local@ storage class, and libraries @stdatomic.h@ and @threads.h@.
 Interestingly, almost a decade after the \Celeven standard, the most recent versions of gcc, clang, and msvc do not 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.
@@ -13,9 +13,9 @@
 \section{M:N Threading}\label{prev:model}
 
-Threading in \CFA is based on \Gls{uthrding}, where \ats are the representation of a unit of work. As such, \CFA programmers should expect these units to be fairly inexpensive, \ie programmers should be able to create a large number of \ats and switch among \ats liberally without many concerns for performance.
+Threading in \CFA is based on \Gls{uthrding}, where \ats are the representation of a unit of work. As such, \CFA programmers should expect these units to be fairly inexpensive, \ie programmers should be able to create a large number of \ats and switch among \ats liberally without many performance concerns.
 
-The \CFA M:N threading models is implemented using many user-level threads mapped onto fewer \glspl{kthrd}.
+The \CFA M:N threading model is implemented using many user-level threads mapped onto fewer \glspl{kthrd}.
 The user-level threads have the same semantic meaning as a \glspl{kthrd} in the 1:1 model: they represent an independent thread of execution with its own stack.
-The difference is that user-level threads do not have a corresponding object in the kernel; they are handled by the runtime in user space and scheduled onto \glspl{kthrd}, referred to as \glspl{proc} in this document. \Glspl{proc} run a \at until it context switches out, it then chooses a different \at to run.
+The difference is that user-level threads do not have a corresponding object in the kernel; they are handled by the runtime in user space and scheduled onto \glspl{kthrd}, referred to as \glspl{proc} in this document. \Glspl{proc} run a \at until it context-switches out, it then chooses a different \at to run.
 
 \section{Clusters}
@@ -45,9 +45,9 @@
 In theory, this should not be a problem, even if the second \at waits, because the first \at is still ready to run and should be able to get CPU time to send the request.
 With M:N threading, while the first \at is ready, the lone \gls{proc} \emph{cannot} run the first \at if it is blocked in the \glsxtrshort{io} operation of the second \at.
-If this happen, the system is in a synchronization deadlock\footnote{In this example, the deadlock could be resolved if the server sends unprompted messages to the client.
+If this happens, the system is in a synchronization deadlock\footnote{In this example, the deadlock could be resolved if the server sends unprompted messages to the client.
 However, this solution is neither general nor appropriate even in this simple case.}.
 \end{quote}
 
-Therefore, one of the objective of this work is to introduce \emph{User-Level \glsxtrshort{io}}, which like \glslink{uthrding}{User-Level \emph{Threading}}, blocks \ats rather than \glspl{proc} when doing \glsxtrshort{io} operations.
+Therefore, one of the objectives of this work is to introduce \emph{User-Level \glsxtrshort{io}}, which like \glslink{uthrding}{User-Level \emph{Threading}}, blocks \ats rather than \glspl{proc} when doing \glsxtrshort{io} operations.
 This feature entails multiplexing the \glsxtrshort{io} operations of many \ats onto fewer \glspl{proc}.
 The multiplexing requires a single \gls{proc} to execute multiple \glsxtrshort{io} operations in parallel.
@@ -60,5 +60,5 @@
 All functions defined by this volume of POSIX.1-2017 shall be thread-safe, except that the following functions need not be thread-safe. ... (list of 70+ excluded functions)
 \end{quote}
-Only UNIX @man@ pages identify whether or not a library function is thread safe, and hence, may block on a pthreads lock or system call; hence interoperability with UNIX library functions is a challenge for an M:N threading model.
+Only UNIX @man@ pages identify whether or not a library function is thread-safe, and hence, may block on a pthreads lock or system call; hence interoperability with UNIX library functions is a challenge for an M:N threading model.
 
 Languages like Go and Java, which have strict interoperability with C\cite{wiki:jni,go:cgo}, can control operations in C by ``sandboxing'' them, \eg a blocking function may be delegated to a \gls{kthrd}. Sandboxing may help towards guaranteeing that the kind of deadlock mentioned above does not occur.
@@ -72,3 +72,3 @@
 Therefore, it is possible calls to an unknown library function can block a \gls{kthrd} leading to deadlocks in \CFA's M:N threading model, which would not occur in a traditional 1:1 threading model.
 Currently, all M:N thread systems interacting with UNIX without sandboxing suffer from this problem but manage to work very well in the majority of applications.
-Therefore, a complete solution to this problem is outside the scope of this thesis.\footnote{\CFA does provide a pthreads emulation, so any library function using embedded pthreads locks are redirected to \CFA user-level locks. This capability further reduces the chances of blocking a \gls{kthrd}.}
+Therefore, a complete solution to this problem is outside the scope of this thesis.\footnote{\CFA does provide a pthreads emulation, so any library function using embedded pthreads locks is redirected to \CFA user-level locks. This capability further reduces the chances of blocking a \gls{kthrd}.}
