Changeset 6224eeb
- Timestamp:
- Apr 27, 2026, 8:05:23 PM (28 hours ago)
- Branches:
- master
- Children:
- c910d308
- Parents:
- b3e77cc
- Location:
- doc/theses/mike_brooks_MMath
- Files:
-
- 7 edited
-
array.tex (modified) (2 diffs)
-
background.tex (modified) (1 diff)
-
conclusion.tex (modified) (2 diffs)
-
intro.tex (modified) (6 diffs)
-
list.tex (modified) (2 diffs)
-
uw-ethesis-frontpgs.tex (modified) (3 diffs)
-
uw-ethesis.tex (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/mike_brooks_MMath/array.tex
rb3e77cc r6224eeb 919 919 However, function @print1d_cstyle@ is asserting too much knowledge about its parameter @r@ for printing either a row slice or a column slice. 920 920 Specifically, declaring the parameter @r@ with type @array@ means that @r@ is contiguous, which is unnecessarily restrictive. 921 That is, @r@ need only be of a co ntainertype that offers a subscript operator (of type @ptrdiff_t@ $\rightarrow$ @float@) with managed length @N@.921 That is, @r@ need only be of a collection type that offers a subscript operator (of type @ptrdiff_t@ $\rightarrow$ @float@) with managed length @N@. 922 922 The new-array library provides the trait @ar@, so-defined. 923 923 With it, the original declaration can be generalized with the same body. … … 1721 1721 1722 1722 \CC~23's @std::mdspan@ adds multidimensional indexing and reshaping capabilities analogous to those built into \CFA's @array@. 1723 Like @span@, it works over multiple underlying co ntainertypes.1723 Like @span@, it works over multiple underlying collection types. 1724 1724 But neither @span@ nor @mdspan@ augments the available allocation options. 1725 1725 -
doc/theses/mike_brooks_MMath/background.tex
rb3e77cc r6224eeb 225 225 \end{cquote} 226 226 % I believe it is possible to refute any code examples purporting to show pointer arithmetic is faster than subscripting. 227 % This belie vestems from the performance work I did on \CFA arrays, where it is possible to generate equivalent \CFA subscripting and performance to C subscripting.227 % This belief stems from the performance work I did on \CFA arrays, where it is possible to generate equivalent \CFA subscripting and performance to C subscripting. 228 228 229 229 Unfortunately, C semantics want a programmer to \emph{believe} an array variable is a \emph{pointer to its first element}. -
doc/theses/mike_brooks_MMath/conclusion.tex
rb3e77cc r6224eeb 1 1 \chapter{Conclusion} 2 2 3 This thesis performed a detailed examination of the three most important high-level co ntainers in many programming languages: array, linked-list, and string.4 The goal of the work is to make co ntainers easier to use, performant and safer.5 Since some subset of these three co ntainers are used in almost every program in every programming language, this is a laudable goal.3 This thesis performed a detailed examination of the three most important high-level collections in many programming languages: array, linked-list, and string. 4 The goal of the work is to make collections easier to use, performant and safer. 5 Since some subset of these three collections are used in almost every program in every programming language, this is a laudable goal. 6 6 Accomplishing this goal in C is difficult because these features are poorly designed. 7 7 In contrast, \CFA's advanced type system and language features plus my critical design choices made it possible to provide better support with significant safety. 8 8 The result is application code that is easier to write, understand, maintain, and significantly safer from hacker attach-vectors. 9 Finally, the performance sections for each co ntainer demonstrated that safety does not have to reduce performance, \ie rolling-your-own containeris now an excuse not a reason.9 Finally, the performance sections for each collection demonstrated that safety does not have to reduce performance, \ie rolling-your-own collection is now an excuse not a reason. 10 10 11 11 … … 42 42 \section{Future Work} 43 43 44 All three forms of co ntainers presented in this work are in their nascence, both in design and implementation.44 All three forms of collections presented in this work are in their nascence, both in design and implementation. 45 45 This work provides the foundation for future \CFA students to add more functionality along with robust and performant implementations. 46 46 Completing the syntax change from @array@ to C-style for dimensions and subscripts is an important first step to fit with C-programmer expectation resulting in faster adoption. -
doc/theses/mike_brooks_MMath/intro.tex
rb3e77cc r6224eeb 1 1 \chapter{Introduction} 2 2 3 All modern programming languages provide at least these three high-level co ntainers (collections): array, linked-list, and string.3 All modern programming languages provide at least these three high-level collections (containers): array, linked-list, and string. 4 4 Often, the array is part of the programming language, while linked lists are built from (recursive) pointer types, and strings from arrays and/or linked lists. 5 5 For all three types, languages and/or their libraries supply varying degrees of high-level mechanisms for manipulating these objects at the bulk and component levels, such as copying, slicing, extracting, iterating among, adding and removing elements. … … 39 39 Therefore, hardening the three primary collections goes a long way to making the majority of C programs safer, eliminating major hacker attack vectors. 40 40 41 My work looks at extending these foundational co ntainertypes in the programming language \CFA, which is a new dialect of the C programming language.41 My work looks at extending these foundational collection types in the programming language \CFA, which is a new dialect of the C programming language. 42 42 A primary goal of \CFA~\cite{Cforall} is 99\% backward compatibility with C, while maintaining a look and feel that matches with C programmer experience and intuition. 43 43 This goal requires ``thinking inside the box'' to engineer new features that ``work and play'' with C and its massive legacy code-base. 44 44 An equally important goal is balancing good performance with safety. 45 45 46 The thesis describes improvements I made to the \CFA language design, both syntax and semantics, to support the co ntainerfeatures, and the source code created within the \CFA compiler, libraries, and runtime system to implement these features.46 The thesis describes improvements I made to the \CFA language design, both syntax and semantics, to support the collection features, and the source code created within the \CFA compiler, libraries, and runtime system to implement these features. 47 47 This work leverages preexisting work within the compiler's type and runtime systems generated by prior graduate students working on the \CFA project. 48 48 … … 50 50 \section{Array} 51 51 52 An array provides a homogeneous co ntainerwith $O(1)$ access to elements using subscripting.52 An array provides a homogeneous collection with $O(1)$ access to elements using subscripting. 53 53 Higher-level operations like array slicing (single or multidimensional) may have significantly higher cost, but provide a better programmer experience. 54 54 The array size can be static, dynamic but fixed after creation, or dynamic and variable after creation. … … 64 64 \section{Linked List} 65 65 66 A linked-list provides a homogeneous co ntaineroften with $O(n)$ access to elements using successor and predecessor operations that involve pointer chasing.66 A linked-list provides a homogeneous collection often with $O(n)$ access to elements using successor and predecessor operations that involve pointer chasing. 67 67 It is the most foundational case of the linked data structures, which include trees and hash tables. 68 68 Among the linked structures, the list's defining characteristic is maintaining a user-explicit total order (chain shape). … … 83 83 hash search table consisting of a key (string) with associated data (@<search.h>@) 84 84 \end{itemize} 85 Because these co ntainerlibraries can be restrictive or awkward to use, C programmers often build bespoke linked data-structures, which further increases the potential for memory errors.85 Because these collection libraries can be restrictive or awkward to use, C programmers often build bespoke linked data-structures, which further increases the potential for memory errors. 86 86 87 87 … … 117 117 \begin{enumerate}[leftmargin=*] 118 118 \item 119 The three primary co ntainertypes in C are difficult to understand, teach, and get right because they are too low level.120 Providing higher-level, feature-rich versions of these co ntainers in \CFA is a major component of the primary goal.119 The three primary collection types in C are difficult to understand, teach, and get right because they are too low level. 120 Providing higher-level, feature-rich versions of these collections in \CFA is a major component of the primary goal. 121 121 The result is a simplified programming experience, which increases productivity and maintainability. 122 122 \item 123 The new co ntainertypes must be as correct and safe to use as those in other modern programming languages, to elide the concerns of industry, government, and military~\cite{ONCD}.123 The new collection types must be as correct and safe to use as those in other modern programming languages, to elide the concerns of industry, government, and military~\cite{ONCD}. 124 124 Prior approaches focus on out-of-bound array accesses using a model-based approach (ASCET) in embedded systems (\eg cars)~\cite{Blache19}, and general and null-terminated string arrays using a \CC template syntax (Checked C)~\cite{Elliott18,Ruef19}. 125 125 Both White House~\cite{WhiteHouse24} and DARPA~\cite{DARPA24} recently released a recommendation to \emph{move away} from C and \CC, because of cybersecurity threats exploiting vulnerabilities in these languages. -
doc/theses/mike_brooks_MMath/list.tex
rb3e77cc r6224eeb 199 199 Within the @with@, the code acts as if there is only one list axis, without explicit casting. 200 200 201 Unlike the \CC template co ntainer-types, the \CFA library works completely within the type system;201 Unlike the \CC template collection types, the \CFA library works completely within the type system; 202 202 both @dlink@ and @dlist@ are ordinary types, not language macros. 203 203 There is no textual expansion other than header-included static-inline function for performance. … … 544 544 Hence, to be \emph{exception safe}, all internal list operations must complete before the copy/move so the list is consistent should the return fail. 545 545 This coding style can result in contrived code, but is usually possible; 546 however, it requires the co ntainerdesigner to anticipate the potential throw.547 (Note, this anticipation issue is pervasive in exception systems, not just with co ntainers.)548 The solution moves the coding complexity from the co ntainerdesigner to the programer~\cite[ch~10, part 3]{Sutter99}.549 First, obtain the node, which might fail, but the co ntaineris unmodified.550 Second, remove the node, which modifies the co ntainerwithout the possibly of an exception.546 however, it requires the collection designer to anticipate the potential throw. 547 (Note, this anticipation issue is pervasive in exception systems, not just with collections.) 548 The solution moves the coding complexity from the collection designer to the programer~\cite[ch~10, part 3]{Sutter99}. 549 First, obtain the node, which might fail, but the collection is unmodified. 550 Second, remove the node, which modifies the collection without the possibly of an exception. 551 551 This movement of responsibility increases the cognitive effort for programmers. 552 552 Unfortunately, this \emph{single-responsibility principle}, \ie preferring separate operations, is often repeated as a necessary requirement rather an an optional one. -
doc/theses/mike_brooks_MMath/uw-ethesis-frontpgs.tex
rb3e77cc r6224eeb 13 13 \vspace*{1.0cm} 14 14 15 % TODO: punch up the title, thinking getting interest in the department-wide posting of my presentation 16 % Modern collections for C 17 {\Huge\bf \CFA Container Library} 15 {\Huge\bf \CFA Collection Library} 18 16 19 17 \vspace*{1.0cm} … … 131 129 \CFA strives to fix issues in C, chief among them safety. 132 130 This thesis presents a significant step forward in \CFA's goal to remove unsafe pointer operations. 133 It describes improvements to the \CFA language design to support advanced co ntainerfeatures.131 It describes improvements to the \CFA language design to support advanced collection features. 134 132 These features are implemented across the \CFA compiler and runtime libraries. 135 133 The results maintain another \CFA goal of offering strong backwards compatibility with C. 136 134 To achieve these goals, this work leverages preexisting \CFA contributions by prior students, particularly novel applications of the compiler's type system. 137 135 138 All modern programming languages provide these three high-level co ntainers (collections): array, linked-list, and string.136 All modern programming languages provide these three high-level collections (containers): array, linked-list, and string. 139 137 Often, the array is part of the programming language, while linked lists are built from (recursive) pointer types, and strings from arrays and/or linked lists. 140 138 For all three types, languages and/or their libraries supply varying degrees of high-level mechanisms for manipulating these objects at the bulk and component levels, such as copying, slicing, extracting, and iterating among elements. … … 149 147 With the array, this case is made by showing complete erasure down to a naked C array, modulo runtime bound checks, which are removable more often than with Java-style length management. 150 148 With the linked list and string, empirical measures are compared with C and \CC comparable libraries. 151 These co ntainers offer programmers workable alternatives to hand-rolling specialized libraries, which is a huge safety benefit, eliminating many system vulnerabilities.149 These collections offer programmers workable alternatives to hand-rolling specialized libraries, which is a huge safety benefit, eliminating many system vulnerabilities. 152 150 The results establish \CFA's position as a safety-forward programming alternative. 153 151 -
doc/theses/mike_brooks_MMath/uw-ethesis.tex
rb3e77cc r6224eeb 183 183 pdffitwindow=false, % window fit to page when opened 184 184 pdfstartview={FitH}, % fits the width of the page to the window 185 pdftitle={\CFA Co ntainerLibrary}, % title: CHANGE THIS TEXT!185 pdftitle={\CFA Collection Library}, % title: CHANGE THIS TEXT! 186 186 pdfauthor={Mike Brooks}, % author: CHANGE THIS TEXT! and uncomment this line 187 187 pdfsubject={Cforall}, % subject: CHANGE THIS TEXT! and uncomment this line 188 pdfkeywords={Cforall} {container library} { C language}, % optional list of keywords188 pdfkeywords={Cforall} {container library} {collection library} {array} {linked list} {string} {C language}, % optional list of keywords 189 189 pdfnewwindow=true, % links in new window 190 190 colorlinks=true, % false: boxed links; true: colored links
Note:
See TracChangeset
for help on using the changeset viewer.