Advanced control‐flow and concurrency in C∀. (1st December 2020) - Delisle, Thierry; Buhr, Peter A.
Summary: C ∀ is a polymorphic, nonobject‐oriented, concurrent, backwards compatible extension of the C programming language. This paper discusses the design philosophy and implementation of its advanced control‐flow and concurrent/parallel features, along with the supporting runtime written in C ∀. These features are created from scratch as ISO C has only low‐level and/or unimplemented concurrency, so C programmers continue to rely on library approaches like pthreads. C ∀ introduces modern language‐level control‐flow mechanisms, like generators, coroutines, user‐level threading, and monitors for mutual exclusion and synchronization. The runtime provides significant programmer simplification and safety by eliminating spurious wakeup and monitor barging. The runtime also ensures multiple monitors can be safely acquired in a deadlock‐free way, and this feature is fully integrated with all monitor synchronization mechanisms. All control‐flow features integrate with the C ∀ polymorphic type‐system and exception handling, while respecting the expectations and style of C programmers. Experimental results show comparable performance of the new features with similar mechanisms in other concurrent programming languages.