Changes in / [f3f009f:4894239]


Ignore:
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/colby_parsons_MMAth/text/conclusion.tex

    rf3f009f r4894239  
    55% ======================================================================
    66
    7 The goal of this thesis was to expand the concurrent support that \CFA offers to fill in gaps and support language users' ability to write safe and efficient concurrent programs.
    8 The presented features achieves this goal, and provides users with the means to write scalable programs in \CFA through multiple avenues.
    9 Additionally, the tools presented include safety and productivity features from deadlock detection, to detection of common programming errors, easy concurrent shutdown, and toggleable performance statistics.
    10 Programmers often have preferences between computing paradigms and concurrency is no exception.
    11 If users prefer the message passing paradigm of concurrency, \CFA now provides message passing utilities in the form of an actor system and channels.
     7This thesis presented a suite of safe and efficient concurrency tools that provide users with the means to write scalable programs in \CFA through multiple avenues.
     8If users prefer the message passing paradigm of concurrency, \CFA now provides message passing tools in the form of a performant actor system and channels.
    129For shared memory concurrency, the mutex statement provides a safe and easy-to-use interface for mutual exclusion.
    1310The @waituntil@ statement aids in writing concurrent programs in both the message passing and shared memory paradigms of concurrency.
    1411Furthermore, no other language provides a synchronous multiplexing tool polymorphic over resources like \CFA's @waituntil@.
    15 This work successfully provides users with familiar concurrent language support, but with additional value added over similar utilities in other popular languages.
     12
     13These features are commonly used in conjunction to solve concurrent problems.
     14The @waituntil@ statement, the @mutex@ statement, and channels will all likely see use in a program where a thread operates as an administrator or server which accepts and distributes work among channels based on some shared state.
     15The @mutex@ statement sees use across almost all concurrent code in \CFA, since it is used with the stream operator @sout@ to provide thread-safe output.
     16While not yet implemented, the polymorphic support of the @waituntil@ statement could see use in conjunction with the actor system to enable user threads outside the actor system to wait for work to be done, or for actors to finish.
     17A user of \CFA does not have to solely subscribe to the message passing or shared memory concurrent paradigm.
     18As such, channels in \CFA are often used to pass pointers to shared memory that may still need mutual exclusion, requiring the @mutex@ statement to also be used.
    1619
    1720On overview of the contributions in this thesis include the following:
     
    2225\item A @waituntil@ statement which tackles the hard problem of allowing a thread to safely synch\-ronously wait for some set of concurrent resources.
    2326\end{enumerate}
    24 
    25 The features presented are commonly used in conjunction to solve concurrent problems.
    26 The @waituntil@ statement, the @mutex@ statement, and channels will all likely see use in a program where a thread operates as an administrator or server which accepts and distributes work among channels based on some shared state.
    27 The @mutex@ statement sees use across almost all concurrent code in \CFA, since it is used with the stream operator @sout@ to provide thread-safe output.
    28 While not yet implemented, the polymorphic support of the @waituntil@ statement could see use in conjunction with the actor system to enable user threads outside the actor system to wait for work to be done, or for actors to finish.
    29 A user of \CFA does not have to solely subscribe to the message passing or shared memory concurrent paradigm.
    30 As such, channels in \CFA are often used to pass pointers to shared memory that may still need mutual exclusion, requiring the @mutex@ statement to also be used.
    3127
    3228From the novel copy-queue data structure in the actor system and the plethora of user-supporting safety features, all these utilities build upon existing concurrent tooling with value added.
  • doc/theses/colby_parsons_MMAth/text/intro.tex

    rf3f009f r4894239  
    1616All of these features exist in other programming languages in some shape or form, however this thesis extends the original ideas by improving performance, productivity, and safety.
    1717
    18 \section{The Need For Concurrent Features}
    19 Asking a programmer to write a complex concurrent program without any concurrent language features is asking them to undertake a very difficult task.
    20 They would only be able to rely on the atomicity that their hardware provides and would have to build up from there.
    21 This would be like asking a programmer to write a complex sequential program only in assembly.
    22 Both are doable, but would often be easier and less error prone with higher level tooling.
    23 
    24 Concurrent programming has many pitfalls that are unique and do not show up in sequential code:
    25 \begin{enumerate}
    26 \item Deadlock, where threads cyclically wait on resources, blocking them indefinitely.
    27 \item Livelock, where threads constantly attempt a concurrent operation unsuccessfully, resulting in no progress being made.
    28 \item Race conditions, where thread orderings can result in differing behaviours and correctness of a program execution.
    29 \item Starvation, where threads may be deprived of access to some shared resource due to unfairness and never make progress.
    30 \end{enumerate}
    31 Even with the guiding hand of concurrent tools these pitfalls can still catch unwary programmers, but good language support can prevent, detect, and mitigate these problems.
    32 
    33 \section{A Brief Overview}
    3418
    3519The first chapter of this thesis aims to familiarize the reader with the language \CFA.
     
    4731The @waituntil@ statement presented provides greater flexibility and expressibility than similar features in other languages.
    4832All in all, the features presented aim to fill in gaps in the current \CFA concurrent language support, and enable users to write a wider range of complex concurrent programs with ease.
    49 
    50 \section{Contributions}
    51 This work presents the following contributions:
    52 \begin{enumerate}
    53 \item The @mutex@ statement which:
    54 \begin{itemize}[itemsep=0pt]
    55 \item
    56 provides deadlock-free multiple lock acquisition,
    57 \item
    58 clearly denotes lock acquisition and release,
    59 \item
    60 and has good performance irrespective of lock ordering.
    61 \end{itemize}
    62 \item Channels which:
    63 \begin{itemize}[itemsep=0pt]
    64     \item
    65     achieves comparable performance to Go, the gold standard for concurrent channels,
    66     \item
    67     has deadlock detection,
    68     \item
    69     introduces easy-to-use exception-based @close@ semantics,
    70     \item
    71     and provides toggle-able statistics for performance tuning.
    72 \end{itemize}
    73 \item An in-memory actor system that:
    74 \begin{itemize}[itemsep=0pt]
    75     \item
    76     achieves the lowest latency message send of all tested systems,
    77     \item
    78     is the first inverted actor system to introduce queue stealing,
    79     \item
    80     attains zero-victim-cost stealing through a carefully constructed stealing mechanism,
    81     \item
    82     gains performance through static-typed message sends, eliminating the need for dynamic dispatch,
    83     \item
    84     introduces the copy queue, an array based queue specialized for the actor use case to minimize calls to the memory allocator,
    85     \item
    86     has robust detection of six tricky, but common actor programming errors,
    87     \item
    88     achieves very good performance on a diverse benchmark suite compared to other actor systems,
    89     \item
    90     and provides toggle-able statistics for performance tuning.
    91 \end{itemize}
    92 
    93 \item A @waituntil@ statement which:
    94 \begin{itemize}[itemsep=0pt]
    95     \item
    96     is the only known polymorphic synchronous multiplexing language feature,
    97     \item
    98     provides greater expressibility of waiting conditions than other languages,
    99     \item
    100     and achieves comparable performance to similar features in two other languages,
    101 \end{itemize}
    102 \end{enumerate}
  • src/ControlStruct/MultiLevelExit.cpp

    rf3f009f r4894239  
    1010// Created On       : Mon Nov  1 13:48:00 2021
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Sep  6 12:00:00 2023
    13 // Update Count     : 35
     12// Last Modified On : Mon Mar 28  9:42:00 2022
     13// Update Count     : 34
    1414//
    1515
     
    1818#include "AST/Pass.hpp"
    1919#include "AST/Stmt.hpp"
     20#include "Common/CodeLocationTools.hpp"
    2021#include "LabelGeneratorNew.hpp"
    2122
     
    2526
    2627namespace ControlStruct {
    27 
    28 namespace {
    29 
    3028class Entry {
    3129  public:
     
    3735                bool used = false;
    3836                Target( const Label & label ) : label( label ) {}
    39                 Target() : label( CodeLocation(), "" ) {}
     37                Target() : label( CodeLocation() ) {}
    4038        };
    4139        Target firstTarget;
     
    526524        // if continue is used insert a continue label into the back of the body of the loop
    527525        if ( entry.isContUsed() ) {
     526                CompoundStmt * new_body = new CompoundStmt( body->location );
     527                // {}
     528                new_body->kids.push_back( body );
    528529                // {
    529530                //  body
    530                 //  ContinueLabel: ;
    531531                // }
    532                 return new CompoundStmt( body->location, {
    533                         body,
    534                         labelledNullStmt( body->location, entry.useContExit() ),
    535                 } );
     532                new_body->kids.push_back(
     533                        labelledNullStmt( body->location, entry.useContExit() ) );
     534                // {
     535                //  body
     536                //  ContinueLabel: {}
     537                // }
     538                return new_body;
    536539        }
    537540
     
    617620}
    618621
    619 } // namespace
    620 
    621622const CompoundStmt * multiLevelExitUpdate(
    622                 const CompoundStmt * stmt, const LabelToStmt & labelTable ) {
     623        const CompoundStmt * stmt,
     624        const LabelToStmt & labelTable ) {
    623625        // Must start in the body, so FunctionDecls can be a stopping point.
    624626        Pass<MultiLevelExitCore> visitor( labelTable );
    625         return stmt->accept( visitor );
    626 }
    627 
     627        const CompoundStmt * ret = stmt->accept( visitor );
     628        // There are some unset code locations slipping in, possibly by Labels.
     629        const Node * node = localFillCodeLocations( ret->location, ret );
     630        return strict_dynamic_cast<const CompoundStmt *>( node );
     631}
    628632} // namespace ControlStruct
    629633
Note: See TracChangeset for help on using the changeset viewer.