Conference Paper

Cooperative Task Management Without Manual Stack Management.

Conference: Proceedings of the General Track: 2002 USENIX Annual Technical Conference, June 10-15, 2002, Monterey, California, USA
Source: DBLP

ABSTRACT Abstract Cooperative task management can provide program ar - chitects with ease of reasoning about concurrency is - sues This property is often espoused by those who recommend "event - driven" programming over "multi - threaded" programming Those terms conflate several issues In this paper, we clarify the issues, and show how one can get the best of both worlds: reason more simply about concurrency in the way "event - driven" advocates recommend, while preserving the readability and main - tainability of code associated with "multithreaded" pro - gramming We identify the source of confusion about the two pro - gramming styles as a conflation of two concepts: task management and stack management Those two con - cerns define a two - axis space in which "multithreaded" and "event - driven" programming are diagonally oppo - site; there is a third "sweet spot" in the space that com - bines the advantages of both programming styles We point out pitfalls in both alternative forms of stack man - agement, manual and automatic , and we supply tech - niques that mitigate the danger in the automatic case Finally, we exhibit adaptors that enable automatic stack management code and manual stack management code to interoperate in the same code base

1 Bookmark
  • Source
    [Show abstract] [Hide abstract]
    ABSTRACT: We describe the first capability, to our knowledge, to execute nearly unmodified applications and Linux kernel code in the context of a widely-used open source discrete event networking simulator (ns-3). We propose Direct Code Execution (DCE), a framework that dramatically increases the number of available protocol models and realism available for ns-3 simulations. DCE meets the goals recently proposed for fully reproducible networking research and runnable papers, with the added benefits of 1) the ability of completely deterministic reproducibility, 2) the scalability that simulation time dilation offers, 3) capabilities supporting automated code coverage analysis, and 4) improved debuggability via execution within a single address space. In this paper, we describe in detail DCE, report on packet processing benchmark and showcase key features of the framework with different use cases. Next, we reproduce a previously published Multipath TCP (MPTCP) experiment and highlight how code coverage testing can be automated by showing results achieving 55-86% coverage of the MPTCP implementation. Then we demonstrate how network stack debugging can be easily performed and reproduced across a distributed system. Our first benchmarks are promising and we believe this framework can benefit the network community by enabling realistic, reproducible experiments and runnable papers.
    The 9th International Conference on emerging Networking EXperiments and Technologies (CoNEXT); 12/2013
  • Source
    [Show abstract] [Hide abstract]
    ABSTRACT: The potential for unexpected interference between threads makes multithreaded programming notoriously difficult. Programmers use a variety of synchronization idioms such as locks and barriers to restrict where interference may actually occur. Unfortunately, the resulting actual interference points are typically never documented and must be manually reconstructed as the first step in any subse-quent programming task (code review, refactoring, etc). This paper proposes explicitly documenting actual interference points in the program source code, and it presents a type and effect system for verifying the correctness of these interference specifications. Experimental results on a variety of Java benchmarks show that this approach provides a significant improvement over prior sys-tems based on method-level atomicity specifications. In particular, it reduces the number of interference points one must consider from several hundred points per thousand lines of code to roughly 13 per thousand lines of code. Explicit interference points also serve to highlight all known concurrency defects in these benchmarks.
  • Source
    [Show abstract] [Hide abstract]
    ABSTRACT: Coroutines and events are two common abstractions for writing concurrent programs. Because coroutines are often more convenient, but events more portable and efficient, it is natural to want to translate the former into the latter. CPC is such a source-to-source translator for C programs, based on a partial conversion into continuation-passing style (CPS conversion) of functions annotated as cooperative. In this article, we study the application of the CPC translator to QEMU, an open-source machine emulator which also uses annotated coroutine functions for concurrency. We first propose a new type of annotations to identify blocking functions, and we introduce CoroCheck, a tool for the static analysis and inference of cooperation and blocking annotations. Then, we improve the CPC translator, defining CPS conversion as a calling convention for the C language, with support for indirect calls to CPS-converted function through function pointers. Finally, we apply CoroCheck and CPC to QEMU (750 000 lines of C code), fixing hundreds of missing annotations and comparing performance of the translated code with existing implementations of coroutines in QEMU. Our work shows the importance of static annotation checking to prevent actual concurrency bugs, and demonstrates that CPS conversion is a flexible, portable, and efficient compilation technique, even for very large programs written in an imperative language.