skip to main content
10.1145/3427763.3428314acmotherconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Asynchronous monad for reactive IoT programming

Published: 15 November 2020 Publication History

Abstract

Many industrial IoT applications process sensor data over distributed networks to monitor devices in real-time. Since the sensor telemetries are transmitted over networks as events, imperative and event-driven programs are often used to handle IoT data. However, the inverted control flow and shared global states of these imperative programs make them difficult to interface with synchronized computation on IoT data. This problem is further complicated for high-frequency data such as electric signals, which may require dynamic adjustment to data sampling rate to operate under the constraints of network and system.
In this paper, we propose a push-pull reactive programming model for IoT application to address this challenge. This model uses push-streams for asynchronous computation such as data capturing and user controls and uses pull streams for synchronized computation such as data analysis. This model is simpler than push-based models by avoiding the complexity of glitch prevention through re-sampling in pull-streams. It is also more flexible than pull-based models by allowing dynamic adjustment of the sampling rate to maintain real-time speed of the IoT computation. The push-stream has a monadic interface, which converts to a pull stream through buffering. A pull stream converts to a push-stream when driven by a clock. The dynamic switching of our streams is based on a monadic abstraction called AsyncM that uses continuation passing style and a form of cancellation token for asynchronous control. Our model is simple and can use threads or event callbacks for concurrency.

References

[1]
Manuel Bärenz and Ivan Perez. 2018. Rhine: FRP with Type-Level Clocks. SIGPLAN Not. 53, 7 (Sept. 2018 ), 145-157. htps://doi.org/10. 1145/3299711.3242757
[2]
Gérard Berry. 1999. The Constructive Semantics of Pure Esterel. ( 1999 ).
[3]
Gérard Berry and Manuel Serrano. 2020. HipHop. js:(A) Synchronous reactive web programming. In PLDI. 533-545.
[4]
Guerric Chupin and Henrik Nilsson. 2019. Functional Reactive Programming, restated. In Proceedings of the 21st International Symposium on Principles and Practice of Programming Languages 2019. 1-14.
[5]
Gregory H Cooper and Shriram Krishnamurthi. 2006. Embedding dynamic dataflow in a call-by-value language. In European Symposium on Programming. Springer, 294-308.
[6]
Antony Courtney, Henrik Nilsson, and John Peterson. 2003. The yampa arcade. In Proceedings of the 2003 ACM SIGPLAN workshop on Haskell. 7-18.
[7]
Evan Czaplicki and Stephen Chong. 2013. Asynchronous Functional Reactive Programming for GUIs. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM Press, New York, NY, USA, 411-422.
[8]
Conal Elliott. 2009. Push-pull functional reactive programming. In Haskell Symposium. htp://conal.net/papers/push-pull-frp
[9]
Conal Elliott and Paul Hudak. 1997. Functional reactive animation. In Proceedings of the second ACM SIGPLAN international conference on Functional programming. 263-273.
[10]
Wolfgang Jeltsch. 2009. Signals, Not Generators!. In Trends in Functional Programming.
[11]
Neelakantan R. Krishnaswami. 2013. Higher-Order Functional Reactive Programming without Spacetime Leaks. SIGPLAN Not. 48, 9 (Sept. 2013 ), 221-232. htps://doi.org/10.1145/2544174.2500588
[12]
Paul LeGuernic, Thierry Gautier, Michel Le Borgne, and Claude Le Maire. 1991. Programming real-time applications with SIGNAL. Proc. IEEE 79, 9 ( 1991 ), 1321-1336.
[13]
Hai Liu and Paul Hudak. 2007. Plugging a space leak with an arrow. Electronic Notes in Theoretical Computer Science 193 ( 2007 ), 29-45.
[14]
Ingo Maier and Martin Odersky. 2012. Deprecating the observer pattern with Scala. react. Technical Report.
[15]
Leo A Meyerovich, Arjun Guha, Jacob Baskin, Gregory H Cooper, Michael Greenberg, Aleks Bromfield, and Shriram Krishnamurthi. 2009. Flapjax: a programming language for Ajax applications. In Proceedings of the 24th ACM SIGPLAN conference on Object oriented programming systems languages and applications. 1-20.
[16]
Microsoft. 2020. Reactive Extensions. htp://reactivex.io/. Accessed: 2020-07-02.
[17]
Florian Myter, Christophe Scholliers, and Wolfgang De Meuter. 2019. Distributed reactive programming for reactive distributed systems. arXiv ( 2019 ), arXiv-1902.
[18]
Gergely Patai. 2011. Eficient and Compositional Higher-Order Streams. In Functional and Constraint Logic Programming, Julio Mariño (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 137-154.
[19]
Ivan Perez, Manuel Bärenz, and Henrik Nilsson. 2016. Functional reactive programming, refactored. ACM SIGPLAN Notices 51, 12 ( 2016 ), 33-44.
[20]
Daniel Pilaud, N Halbwachs, and JA Plaice. 1987. LUSTRE: A declarative language for programming synchronous systems. In Proceedings of the 14th Annual ACM Symposium on Principles of Programming Languages (14th POPL 1987 ). ACM, New York, NY, Vol. 178. 188.
[21]
Atze van der Ploeg and Koen Claessen. 2015. Practical Principled FRP: Forget the Past, Change the Future, FRPNow! SIGPLAN Not. 50, 9 (Aug. 2015 ), 302-314. htps://doi.org/10.1145/2858949.2784752
[22]
Kazuhiro Shibanai and Takuo Watanabe. 2018. Distributed functional reactive programming on actor-based runtime. In Proceedings of the 8th ACM SIGPLAN International Workshop on Programming Based on Actors, Agents, and Decentralized Control. 13-22.
[23]
Atze van der Ploeg. 2013. Monadic Functional Reactive Programming. In Proceedings of the 2013 ACM SIGPLAN Symposium on Haskell (Haskell '13). Association for Computing Machinery, New York, NY, USA, 117-128. htps://doi.org/10.1145/2503778.2503783
[24]
William W Wadge and Edward A Ashcroft. 1985. LUCID, the dataflow programming language. Vol. 198. Academic Press London.

Cited By

View all
  • (2023)A Software Architecture Based on Coarse-Grained Self-Adjusting ComputationsProceedings of the 1st ACM SIGPLAN International Workshop on Functional Software Architecture10.1145/3609025.3609481(1-10)Online publication date: 30-Aug-2023
  • (2022)A Graph-Based Formal Semantics of Reactive Programming from First PrinciplesProceedings of the 24th ACM International Workshop on Formal Techniques for Java-like Programs10.1145/3611096.3611101(18-25)Online publication date: 7-Jun-2022
  • (2022)Semantics of RxJSProceedings of the 9th ACM SIGPLAN International Workshop on Reactive and Event-Based Languages and Systems10.1145/3563837.3568340(37-49)Online publication date: 29-Nov-2022
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
REBLS 2020: Proceedings of the 7th ACM SIGPLAN International Workshop on Reactive and Event-Based Languages and Systems
November 2020
50 pages
ISBN:9781450381888
DOI:10.1145/3427763
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 15 November 2020

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. FRP
  2. IoT
  3. asynchronous programming

Qualifiers

  • Research-article

Conference

SPLASH '20

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)14
  • Downloads (Last 6 weeks)0
Reflects downloads up to 15 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2023)A Software Architecture Based on Coarse-Grained Self-Adjusting ComputationsProceedings of the 1st ACM SIGPLAN International Workshop on Functional Software Architecture10.1145/3609025.3609481(1-10)Online publication date: 30-Aug-2023
  • (2022)A Graph-Based Formal Semantics of Reactive Programming from First PrinciplesProceedings of the 24th ACM International Workshop on Formal Techniques for Java-like Programs10.1145/3611096.3611101(18-25)Online publication date: 7-Jun-2022
  • (2022)Semantics of RxJSProceedings of the 9th ACM SIGPLAN International Workshop on Reactive and Event-Based Languages and Systems10.1145/3563837.3568340(37-49)Online publication date: 29-Nov-2022
  • (2021)A concurrency model for JavaScript with cooperative cancellationProceedings of the 14th ACM SIGPLAN International Conference on Software Language Engineering10.1145/3486608.3486911(55-67)Online publication date: 17-Oct-2021

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media