- Timestamp:
- Aug 31, 2022, 4:09:49 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- f403c46
- Parents:
- 9d67a6d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/thierry_delisle_PhD/thesis/text/conclusion.tex
r9d67a6d r7e5da64 1 1 \chapter{Conclusion}\label{conclusion} 2 2 3 Building the \CFA runtime has been a n extremelychallenging project.3 Building the \CFA runtime has been a challenging project. 4 4 The work was divided between high-level concurrency design and a user-level threading runtime (Masters thesis), and low-level support of the user-level runtime using OS kernel-threading and its (multiple) I/O subsystems (Ph.D. thesis). 5 5 Because I am the main developer for both components of this project, there is strong continuity across the design and implementation. … … 7 7 8 8 I believed my Masters work would provide the background to make the Ph.D work reasonably straightforward. 9 What I discovered is that interacting with kernel locking, threading, and I/O in the UNIX (Linux) operating system is extremely difficult. 10 There are multiple concurrency aspects in UNIX that are poorly designed, not only for user-level threading but also for kernel-level threading. 11 Basically, UNIX-based OSs are not very concurrency friendly. 9 However, in doing so I discovered two expected challenges. 10 First, while modern symmetric multiprocessing CPU have a significant penalties for communicating across cores, state-of-the-art work-stealing schedulers are very effective a avoid the need for communication in many common workloads. 11 This leaves very little space for adding fairness guarantees without notable performance penalties. 12 Second, the kernel locking, threading, and I/O in the Linux operating system offers very little flexibility of use. 13 There are multiple concurrency aspects in Linux that require carefully following a strict procedure in order to achieve acceptable performance. 12 14 To be fair, many of these concurrency aspects were designed 30-40 years ago, when there were few multi-processor computers and concurrency knowledge was just developing. 13 It is unfortunate ly solittle has changed in the intervening years.15 It is unfortunate that little has changed in the intervening years. 14 16 15 17 Also, my decision to use @io_uring@ was both a positive and negative. 16 The positive is that @io_uring@ supports the panoply of I/O mechanisms in UNIX;17 hence, the \CFA runtime uses one I/O mechanism to provide non-blocking I/O, rather than using @select@ to handle TTY I/O, @epoll@ to handle network I/O, and some unknownto handle disk I/O.18 It is unclear to me how I would have merged all these different I/O mechanisms into a coherent scheduling implementation.18 The positive is that @io_uring@ supports the panoply of I/O mechanisms in Linux; 19 hence, the \CFA runtime uses one I/O mechanism to provide non-blocking I/O, rather than using @select@ to handle TTY I/O, @epoll@ to handle network I/O, and managing a thread pool to handle disk I/O. 20 Merging all these different I/O mechanisms into a coherent scheduling implementation would require a much more work than what is present in this thesis, as well as detailed knowledge of the I/O mechanisms in Linux. 19 21 The negative is that @io_uring@ is new and developing. 20 22 As a result, there is limited documentation, few places to find usage examples, and multiple errors that required workarounds. 21 23 Given what I now know about @io_uring@, I would say it is insufficiently coupled with the Linux kernel to properly handle non-blocking I/O. 22 Specifically, spinning up internal kernel threads to handle blocking scenarios is what developers already do outside of the kernel. 24 It does not seem to reach deep into the Kernel's handling of \io, and as such it must contend with the same realities that users of epoll must contend with. 25 Specifically, in cases where @O_NONBLOCK@ behaves as desired, operations must still be retried. 26 To preserve the illusion of asynchronicity, this requires delegating operations to kernel threads. 27 This is also true of cases where @O_NONBLOCK@ does not prevent blocking. 28 Spinning up internal kernel threads to handle blocking scenarios is what developers already do outside of the kernel, and managing these threads adds significant burden to the system. 23 29 Nonblocking I/O should not be handled in this way. 24 25 % While \gls{uthrding} is an old idea, going back to the first multi-processor computers, it was largely set aside in the 1990s because of the complexity in making it work well between applications and the operating system.26 % Unfortunately,, a large amount of that complexity still exists, making \gls{uthrding} a difficult task for library and programming-language implementers.27 % For example, the introduction of thread-local storage and its usage in many C libraries causes the serially reusable problem~\cite{SeriallyReusable} for all \gls{uthrding} implementers.28 % Specifically, if a \gls{kthrd} is preempted, it always restarts with the same thread-local storage;29 % when a user thread is preempted, it can be restarted on another \gls{kthrd}, accessing the new thread-local storage, or worse, the previous thread-local storage.30 % The latter case causes failures when an operation using the thread-local storage is assumed to be atomic at the kernel-threading level.31 % If library implementers always used the pthreads interface to access threads, locks, and thread-local storage, language runtimes can interpose a \gls{uthrding} version of pthreads, switching the kind of threads, locks, and storage, and hence, make it safe.32 % However, C libraries are currently filled with direct declarations of thread-local storage and low-level atomic instructions.33 % In essence, every library developer is inventing their own threading mechanisms to solve their unique problem, independent from any standardize approaches.34 % This state of affairs explains why concurrency is such a mess.35 %36 % To address the concurrency mess, new programming languages integrate threading into the language rather than using the operating-system supplied interface.37 % The reason is that many sequential code-optimizations invalid correctly written concurrent programs.38 % While providing safe concurrent-code generation is essential, the underlying language runtime is still free to implement threading using kernel or user/kernel threading, \eg Java versus Go.39 % In either case, the language/runtime manages all the details to simplify concurrency and increase safety.40 30 41 31 \section{Goals} … … 85 75 \section{Future Work} 86 76 While the \CFA runtime achieves a better compromise, in term of performance and fairness, than other schedulers, I believe further improvements can be made to reduce or eliminate the few cases where performance does deteriorate. 87 Fundamentally, achieving performance and starvation freedom will always be opposing goals even outside of scheduling algorithms.77 Fundamentally, achieving performance and starvation freedom will always be goals with opposing needs even outside of scheduling algorithms. 88 78 89 79 \subsection{Idle Sleep} … … 101 91 The correctness of that hand-shake is critical when the last \proc goes to sleep but could be relaxed when several \procs are awake. 102 92 \item 103 Furthermore, organizing the sleeping \procs as a LI DO stack makes sense to keep cold \procs as cold as possible, but it might be more appropriate to attempt to keep cold CPU sockets instead.93 Furthermore, organizing the sleeping \procs as a LIFO stack makes sense to keep cold \procs as cold as possible, but it might be more appropriate to attempt to keep cold CPU sockets instead. 104 94 \end{itemize} 105 95 However, using these techniques would require significant investigation.
Note: See TracChangeset
for help on using the changeset viewer.