On Composing Asynchronous Operations

Authors

  • Radu LUPȘA Department of Computer Science, Faculty of Mathematics and Computer Science, Babes-Bolyai University, Cluj-Napoca, Romania. Email: radu.lupsa@ubbcluj.ro.
  • Dana LUPȘA Department of Computer Science, Faculty of Mathematics and Computer Science, Babes-Bolyai University, Cluj-Napoca, Romania. Email: dana.lupsa@ubbcluj.ro.

DOI:

https://doi.org/10.24193/subbi.2023.2.03

Keywords:

asynchronous programming

Abstract

Asynchronous operations are very useful for actions that wait for an external event or work for a long time, to avoid blocking the thread that launches them. Unfortunately, whether they report their termination via callbacks or via completing a future, composing several asynchronous calls is difficult and error prone. The continuations mechanism (provided, for example, in C# Task Parallel Library via ContinueWith()) offers limited support for scheduling a sequence of operations. In this paper we try to improve this mechanism with better support for sequencing operations and exceptions, and with support for conditionals and loops, while covering the specifics of a C++ implementation. The most recent version of our source code is at [14].

References

C++ reference. extensions for concurrency. https://en.cppreference.com/w/cpp/experimental/future/then. Accessed: 2023. [2] Java Platform, Standard Edition 8 API Specification, CompletableFuture.

https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html. Accessed: 2023.

David Pine, e. a. Task parallel library (tpl). https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/task-parallel-library-tpl, 2022. Accessed: 2022.

Duan, J., Yi, X., Wang, J., Wu, C., and Le, F. Netstar: A future/promise frame- work for asynchronous network functions. IEEE Journal on Selected Areas in Communications 37, 3 (2019), 600–612.

Elizarov, R., Belyaev, M., Akhin, M., and Usmanov, I. Kotlin coroutines: Design and implementation. Onward! 2021, Association for Computing Machinery, p. 68–84.

Haller, P., and Miller, H. A reduction semantics for direct-style asynchronous observables. Journal of Logical and Algebraic Methods in Programming 105 (03 2019).

Howes, L., Grynenko, A., and Feldblum, J. Continuations without overcomplicating the future. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0783r0.html, 2017. Accessed: 2022.

Lab, A. S. T. stlab: Api documentation. futures. https://stlab.cc/libraries/concurrency/future/. Accessed: 2023.

Liskov, B., and Shrira, L. Promises: Linguistic support for efficient asynchronous procedure calls in distributed systems. In Proceedings of the ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation (New York, NY, USA, 1988), PLDI ’88, Association for Computing Machinery, p. 260–267.

Manolescu, D. A. Workflow enactment with continuation and future objects. 40–51.

Marshall Cline, e. a. A unified futures proposal for C++. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1054r0.html, 2018. Accessed: 2022.

Meyers, S. Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14, 1st ed. O’Reilly Media, Inc., 2014.

N., G., A., L., H., S., and S., M. A standardized representation of asynchronous operations, tecnical report n3538. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3558.pdf, 2013. Accessed: 2022.

Radu, L. futures-demo https://github.com/rlupsa/futures-demo, 2023.

Ranaldo, N., and Zimeo, E. Analysis of different future objects update strategies in ProActive. In 2007 IEEE International Parallel and Distributed Processing Symposium (2007), pp. 1–7.

Downloads

Published

2023-12-22

How to Cite

LUPȘA, R. ., & LUPȘA, D. . (2023). On Composing Asynchronous Operations. Studia Universitatis Babeș-Bolyai Informatica, 68(2), 41–52. https://doi.org/10.24193/subbi.2023.2.03

Issue

Section

Articles