1 | Synchronous Programming with User-Level Threads in C∀ |
---|
2 | |
---|
3 | When computations cannot be satisfied immediately, programmers must use |
---|
4 | one of two paradigms, Synchronous Programming and Asynchronous Programming. |
---|
5 | This presentation discusses the benefits Synchronous Programming over |
---|
6 | Asynchronous Programming and what requirements exist to use this paradigm. |
---|
7 | It also discusses how C∀, a concurrent and backwards-compatible extension |
---|
8 | of the C programming language, has powerful tools available for simple and |
---|
9 | efficient Synchronous Programming. These tools include user-level threads |
---|
10 | and high-level locking mechanisms which simply solve common problems. |
---|
11 | Finally, the presentation shows different techniques to combine these |
---|
12 | features with existing code to either uses blocking operations provided by |
---|
13 | the kernel or is built according to an asynchronous paradigm. |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | |
---|
22 | |
---|
23 | C∀ is a polymorphic, non-object-oriented, concurrent, backwards-compatible |
---|
24 | extension of the C programming language. This paper discusses the design |
---|
25 | philosophy and implementation of its advanced control-flow and concurrent/parallel |
---|
26 | features, along with the supporting runtime written in C∀. These features |
---|
27 | are created from scratch as ISO C has only low-level and/or unimplemented |
---|
28 | concurrency, so C programmers continue to rely on library features like pthreads. |
---|
29 | C∀ introduces modern language-level control-flow mechanisms, like generators, |
---|
30 | coroutines, user-level threading, and monitors for mutual exclusion and |
---|
31 | synchronization. The runtime provides significant programmer simplification |
---|
32 | and safety by eliminating spurious wakeup and monitor barging. The runtime |
---|
33 | also ensures multiple monitors can be safely acquired simultaneously (deadlock free), |
---|
34 | and this feature is fully integrated with all monitor synchronization mechanisms. |
---|
35 | All control-flow features integrate with the C∀ polymorphic type-system and |
---|
36 | exception handling, while respecting the expectations and style of C programmers. |
---|
37 | Experimental results show comparable performance of the new features with similar |
---|
38 | mechanisms in other concurrent programming languages. |
---|
39 | KEYWORDS |
---|
40 | generator, coroutine, concurrency, parallelism, thread, monitor, runtime, C, C∀ (Cforall) |
---|