more structure
[phd-thesis.git] / top / finale.tex
index 2efb455..687e79e 100644 (file)
@@ -19,7 +19,7 @@
 \end{chapterabstract}
 
 \section{Finale}
-Traditionally, \gls{IOT} has been programmed using layered, or tiered, architectures.
+Traditionally, the \gls{IOT} has been programmed using layered, or tiered, architectures.
 Every layer has its own software and hardware characteristics, resulting in semantic friction.
 \Gls{TOP} is a declarative programming paradigm designed to describe multi-tiered interactive systems from a single source.
 However, it is not straightforward to run \gls{TOP} systems on resource-constrained devices such as edge devices.
@@ -28,17 +28,17 @@ The \gls{MTASK} system bridges this gap by providing a \gls{TOP} programming lan
 It is a full-fledged \gls{TOP} language hosted in a tiny \gls{FP} language.
 Besides the usual \gls{FP} constructs, it contains basic tasks, task combinators, support for sensors and actuators, and interrupts.
 It integrates seamlessly in \gls{ITASK}, a \gls{TOP} system for interactive web applications.
-Hence, all layers of an \gls{IOT} system can be programmed from a single declarative specification.
-In \gls{ITASK}, abstraction are available for the gritty details of interactive web applications such as program distribution, web applications, data storage, and user management.
+In \gls{ITASK}, abstractions are available for the gritty details of interactive web applications such as program distribution, web applications, data storage, and user management.
 The \gls{MTASK} system abstracts away of all technicalities specific to edge devices such as communication, abstractions for sensors and actuators, interrupts and (multi) task scheduling.
+With \gls{ITASK} and \gls{MTASK}, all layers of an \gls{IOT} system can be programmed from a single declarative specification.
 
 Any device equipped with the \gls{MTASK} \gls{RTS} can be used in the system and dynamically receive tasks for execution.
-This domain-specific \gls{OS} only needs to be uploaded once, hence saving precious write cycles on the program memory.
+This domain-specific \gls{OS} only is uploaded once, hence saving precious write cycles on the program memory.
 The \gls{MTASK} devices are connected to the \gls{ITASK} system at run time using a single function that takes care of all the communication and error handling.
 Once connected to a device, tasks written in the \gls{MTASK} \gls{DSL} can be lifted to \gls{ITASK} tasks.
 The tasks are specified and compiled at run time, i.e.\ \gls{CLEAN} can be used as a macro language for constructing \gls{MTASK} tasks, tailor making them for the current work requirements.
 When lifted, other tasks in the system can interact with the task through the usual means.
-Furthermore, \gls{ITASK} \glspl{SDS} can be \emph{lowered} to \gls{MTASK} tasks as well, allowing for bidirectional automatic data sharing between \gls{MTASK} tasks and the \gls{ITASK} system irrespective of task relations.
+Furthermore, \gls{ITASK} \glspl{SDS} can be lowered to \gls{MTASK} tasks as well, allowing for automatic bidirectional data sharing between \gls{MTASK} tasks and the \gls{ITASK} system irrespective of task relations.
 
 \section{Related work}
 The novelties of the \gls{MTASK} system can be compared to existing systems in several categories.
@@ -46,11 +46,11 @@ It is a interpreted (\cref{sec:related_int}) \gls{TOP} (\cref{sec:related_top})
 \Cref{sec_t4t:TiredvsTierless} contains an elaborate related work section regarding tierless systems in general.
 
 \subsection{Interpretation}\label{sec:related_int}
-There are a myriad of interpreted programming languages available for some of the bigger more powerful edge devices.
-For example, for the popular ESP8266 chip there are ports of \gls{MICROPYTHON}, LUA, Basic, JavaScript and Lisp.
+There are a myriad of interpreted programming languages available for more powerful edge devices.
+For example, for the popular ESP8266 chip there are ports of \gls{MICROPYTHON}, Lua, BASIC, JavaScript and Lisp.
 All of these languages, except the Lisp dialect uLisp (see \cref{sec:related_fp}), are imperative and do not support multitasking out of the box.
 They lay pretty hefty constraints on the memory and as a result do not work on smaller microcontrollers.
-Another interpretation solution for the tiniest devices is Firmata, a protocol for remotely controlling the microcontroller and using a server as the interpreter host \citep{steiner_firmata:_2009}.
+Another interpretation solution for the tiniest devices is Firmata, a protocol for remotely controlling the microcontroller using a server as the interpreter host \citep{steiner_firmata:_2009}.
 \citet{grebe_haskino:_2016} wrapped this in a remote monad for integration with \gls{HASKELL} that allowed imperative code to be interpreted on the microprocessors.
 Later this system was extended to support multithreading as well, stepping away from Firmata as the basis and using their own \gls{RTS} \citep{grebe_threading_2019}.
 It differs from our approach because continuation points need to be defined by hand there is no automatic safe data communication.
@@ -60,33 +60,35 @@ Both client and server are written in JavaScript.
 However, there is no integration between the client and the server other than that they are programmed from a single source.
 Mat\`e is an example of an early tierless sensor network framework where devices are provided with a virtual machine using TinyOS for dynamic provisioning \citep{levis_mate_2002}.
 
-\subsection{\texorpdfstring{\Glsxtrlongpl{DSL}}{DSLs} for microcontrollers}\label{sec:related_dsl}
+\subsection{\texorpdfstring{\Glsxtrlongpl{DSL}}{DSLs}}\label{sec:related_dsl}
 Many \glspl{DSL} provide higher-level programming abstractions for microcontrollers, for example providing strong typing or memory safety.
-Examples of this are Copilot \citep{hess_arduino-copilot_2020} and Ivory \citep{elliott_guilt_2015}, imperative \glspl{DSL} embedded in a functional language that compile to \ccpp{}.
+Examples of this are Copilot \citep{hess_arduino-copilot_2020} and Ivory \citep{elliott_guilt_2015}.
+Both imperative \glspl{DSL} embedded in a functional language that compile to \ccpp{}.
 
 \subsection{\texorpdfstring{\Glsxtrlong{FP}}{Functional programming}}\label{sec:related_fp}
-\Citet{haenisch_case_2016} showed that there are major benefits to using functional languages for \gls{IOT} applications.
-They showed that using function languages increased the security and maintainability of the applications.
-Traditional implementations of general purpose functional languages have high memory requirements rendering them unusable for tiny computers.
+\Citet{haenisch_case_2016} showed that there are major benefits to using functional languages on edge devices.
+They show that using function languages increased the security and maintainability of the applications.
+Traditional implementations of general purpose functional languages have high memory requirements rendering them unusable for resource-constrained computers.
 There have been many efforts to create a general purpose functional language that does fit in small memory environments, albeit with some concessions.
 For example, there has been a history of creating tiny Scheme implementations for specific microcontrollers.
 It started with BIT \citep{dube_bit:_2000} that only required \qty{64}{\kibi\byte} of memory, followed by {PICBIT} \citep{feeley_picbit:_2003} and {PICOBIT} \citep{st-amour_picobit:_2009} that lowered the memory requirements even more.
 \Citet{suchocki_microscheme:_2015} created Microscheme, a functional language targeting \gls{ARDUINO} compatible microcontrollers.
-The {*BIT} languages all compile to assembly while Microscheme compiles to \gls{CPP}, heavily supported by \gls{CPP} lambdas available even on \gls{ARDUINO} AVR targets.
-An interpreted Lisp implementation called uLisp also exists that runs on microcontrollers with as small as the \gls{ARDUINO} {UNO} \citep{johnson-davies_lisp_2020}.
+The {*BIT} languages all compile to assembly while Microscheme compiles to \gls{CPP}.
+Their implementation leans heavily on \gls{CPP} lambdas, that are available even on \gls{ARDUINO} AVR targets.
+An interpreted Lisp implementation called uLisp also exists that runs on microcontrollers as small as the \gls{ARDUINO} {UNO} \citep{johnson-davies_lisp_2020}.
 
 \subsection{Multitasking}\label{sec:related_multi}
 Applications for tiny computers are often parallel in nature.
 Tasks like reading sensors, watching input devices, operating actuators and maintaining communication are often loosely dependent on each other and are preferably executed in parallel.
 Microcontrollers often do not benefit from an \gls{OS} due to memory and processing constraints.
 Therefore, writing multitasking applications in an imperative language is possible but the tasks have to be interleaved by hand \citep{feijs_multi-tasking_2013}.
-This results in hard to maintain, error prone and unscalable spaghetti code.
+This results in hard to maintain, error-prone and unscalable spaghetti code.
 
 There are many solutions to overcome this problem in imperative languages.
 If the host language is a functional language (e.g.\ the aforementioned scheme variants) multitasking can be achieved without this burden relatively easy using continuation style multiprocessing \citep{wand_continuation-based_1980}.
 Writing in this style is complicated and converting an existing program in this continuation passing style results in relatively large programs.
 Furthermore, there is no built-in thread-safe communication possible between the tasks.
-A \gls{TOP} or \gls{FRP} based language benefits even more because the programmer is not required to explicitly define continuation points.
+A \gls{TOP} or \gls{FRP} based language is superior to manual threading because the programmer is not required to explicitly define continuation points.
 
 Regular preemptive multithreading is too memory intensive for smaller microcontrollers and therefore not suitable.
 Manual interleaving of imperative code can be automated to certain extents.
@@ -131,16 +133,17 @@ This table extends a comparison table with various solutions to multitasking to
 \end{table}
 
 \subsection{\texorpdfstring{\Glsxtrlong{FRP}}{Functional reactive programming}}\label{sec:related_frp}
-The \gls{TOP} paradigm is often compared to \gls{FRP} and they appear to be similar.
+The \gls{TOP} paradigm is often compared to \gls{FRP} because they appear similar.
 \Gls{FRP} was introduced by \citet{elliott_functional_1997}.
-The paradigm strives to make modelling systems safer, more efficient, composable.
+The paradigm strives to make modelling systems safer, more efficient, and composable.
 The core concepts are behaviours and events.
 A behaviour is a value that varies over time.
 Events are happenings in the real world and can trigger behaviours.
 Events and behaviours may be combined using combinators.
 Tasks in \gls{TOP} are also event driven and can be combined with combinators.
 \Gls{TOP} allows for more complex collaboration patterns than \gls{FRP} \citep{wang_maintaining_2018}.
-In consequence is unable to provide the strong guarantees on memory usage available in a restricted variant of \gls{FRP} such as arrowised \gls{FRP} \citep{nilsson_functional_2002}.
+Consequently, \gls{TOP} is unable to provide strong guarantees on memory usage, something \gls{FRP} is capable of.
+For example, arrowised \gls{FRP} can give guarantees on upper memory bounds \citep{nilsson_functional_2002}.
 
 The way \gls{FRP}, and for that matter \gls{TOP}, systems are programmed stays close to the design when the domain matches suits the paradigm.
 The \gls{IOT} domain seems to suit this style of programming very well in just the device layer but also for entire \gls{IOT} systems.
@@ -157,21 +160,20 @@ However, in contrast to in \gls{MTASK}, the tasks are not interpreted and there
 Other examples are CFRP \citep{suzuki_cfrp_2017}, XFRP \citep{10.1145/3281366.3281370}, Juniper \citep{helbling_juniper:_2016}, Hailstorm \citep{sarkar_hailstorm_2020}, Haski \citep{valliappan_towards_2020}, arduino-copilot \citep{hess_arduino-copilot_2020}.
 
 \subsection{\texorpdfstring{\Glsxtrlong{TOP}}{Task-oriented programming}}\label{sec:related_top}
-\Gls{TOP} as a paradigm with has been proven to be effective for implementing distributed, multi-user applications in many domains.
+\Gls{TOP} as a paradigm has proven to be effective for implementing distributed, multi-user applications in many domains.
 Examples are conference management \citep{plasmeijer_conference_2006}, coastal protection \citep{lijnse_capturing_2011}, incident coordination \citep{lijnse_incidone:_2012}, crisis management \citep{jansen_towards_2010} and telemedicine \citep{van_der_heijden_managing_2011}.
-In general, \gls{TOP} results in a higher maintainability, a high separation of concerns and more effective handling of interruptions of workflow.
+In general, \gls{TOP} results in a higher maintainability, a high separation of concerns, and more effective handling of interruptions of workflow.
 \Gls{IOT} applications contain a distributed and multi-user component, but the software on the device is mostly follows multiple loosely dependent workflows.
 The only other \gls{TOP} language for embedded systems is $\mu$Tasks \citep{piers_task-oriented_2016}.
 It is a non-distributed \gls{TOP} \gls{EDSL} hosted in \gls{HASKELL} designed for embedded systems such as payment terminals.
-They showed that applications tend to be able to cope well with interruptions and be more maintainable.
+They show that applications tend to be able to cope well with interruptions and are more maintainable.
 However, the hardware requirements for running the standard \gls{HASKELL} system are high.
 
 \section{Future work}
-There are many ways of extending the research on the \gls{MTASK} system that also concerns \gls{TOP} for resource constrained devices in general.
-Some obvious routes is to add features, support more platforms, 
+There are many ways of extending the research on the \gls{MTASK} system that also concerns \gls{TOP} for resource-constrained devices in general.
 
 \subsection{Security}
-\Gls{IOT} has reached the news many times regarding security and it is a big concern \citep{alhirabi_security_2021}.
+The \gls{IOT} has reached the news concerningly many times regarding the lack of security \citep{alhirabi_security_2021}.
 The fact that the devices are embedded in the fabric, are hard to reach and thus to update, and can only run limited cryptographic algorithms due to their constrained resources makes security difficult.
 The security of \gls{MTASK} and the used protocols are deliberately overlooked at the moment
 The \gls{MTASK} language and \gls{RTS} are modular.
@@ -182,29 +184,29 @@ Nonetheless, this deserves much more attention.
 The future and related work for the security of \gls{MTASK} and tierless systems is more thoroughly presented in \cref{ssec_t4t:security}.
 
 \subsection{Advanced edge devices techniques}
-Edge devices may produce a lot of data and it is not always effective to send this data to the server for processing.
-Leaving the produced data and computations on the edge device is called \emph{edge computing} \citep{shi_edge_2016}.
-The \gls{MTASK} exhibits many properties of edge computing because it is possible to run entire workflows on the device.
+Edge devices produce a lot of data and it is not always effective to send this data to the server for processing.
+Leaving the produced data and computations on the edge device is called edge computing \citep{shi_edge_2016}.
+The \gls{MTASK} system exhibits many properties of edge computing because it is possible to run entire workflows on the device.
 However, it is interesting to see how far this can be extended.
 The \gls{MTASK} language is a high-level \gls{DSL}, so it is obvious to introduce abstractions for edge computations.
 For example, add \gls{TOP} support for machine learning on the edge device using TinyML \citep{sanchez-iborra_tinyml-enabled_2020}.
 \Citet{van_der_veen_mutable_2020} did preliminary work for embedding bounded datastructures such as arrays to the language.
 This could be continued and extended with support for sum types.
 
-Another recent advance in \gls{IOT} programming is battery-less or even battery-free computing.
-Instead of equipping the edge device with a battery, a capacitor is used in conjunction with some energy harvesting systems such as a solar panel.
-With the use of intermittent computing, resuming the computation after a, possibly unexpected, power loss, operation can still be achieved \citep{hester_batteries_2019}.
+Another recent advance in \gls{IOT} edge device programming is battery-less or even battery-free computing.
+Instead of equipping the edge device with a battery, a capacitor is used in conjunction with energy harvesting systems such as a solar panel.
 After a reset, the program state is resumed from a checkpoint that was stored in some non-volatile memory.
-Many intermittent computing solutions rely on annotations from the programmer to divide the program into atomic blocks, sometimes called \emph{tasks} as well.
-These blocks are marked as such because in the case of an reset of the system, the work must be done again.
+This technique is called intermittent computing \citep{hester_batteries_2019}.
+Many intermittent computing solutions rely on annotations from the programmer to divide the program into atomic blocks, sometimes called tasks as well.
+These blocks are marked as such, because in the case of an reset of the system, the work must be done again.
 Examples of such blocks are \gls{I2C} transmissions or calculations that rely on recent sensor data.
 In \gls{MTASK}, all work expressed by tasks is already split up in atomic pieces of work, i.e.\ the work is a side effect of rewriting.
 Furthermore, creating checkpoints should be fairly straightforward as \gls{MTASK} tasks do not rely on any global state---all information required to execute a task is stored in the task tree.
-It is interesting to see what \gls{TOP} abstraction could be useful for intermittent computing and what solutions are required to make this work.
+It is interesting to see what \gls{TOP} abstraction are useful for intermittent computing and what solutions are required to make this work.
 
 Mesh networks allow for communication not only to-and-fro the device and server but also between devices.
 The \gls{ITASK} system already contains primitives for distributed operation.
-For example, it is possible to run tasks or share data with \glspl{SDS} on a different machine.
+For example, it is possible to run tasks or share data with \glspl{SDS} on different machines.
 It is interesting to investigate how this networking technique can be utilised in \gls{MTASK}.
 
 Finally, \glspl{FPGA} have been becoming cheaper and faster recently, allowing for purely functional code to be translated to \glspl{FPGA} code efficiently \citep{baaij_digital_2015}.
@@ -222,7 +224,7 @@ Future research into extending the formal semantics of \gls{MTASK} is useful to
 
 \subsection{\texorpdfstring{\Glsxtrlong{TOP}}{Task-oriented programming}}
 In order to keep the resource constraints low, the \gls{MTASK} language contains only a minimal set of simple task combinators.
-From these simple combinators, complex collaboration patterns can be described.
+From these simple combinators, complex collaboration patterns can be expressed.
 The \gls{ITASK} language is designed exactly the opposite.
 From just a few super combinators, all other combinators are derived.
 However, this approach requires a very powerful host language in which task combinators can be defined in terms of the host language.
@@ -247,7 +249,7 @@ In practise this is not always the case due to crippling syntax and convoluted e
 Recent approaches in interactive editors for programming language source code such as dynamic editors \citep{koopman_dynamic_2021} or typed tree editors such as Hazelnut \citep{omar_hazelnut_2017} could prove useful for supporting the \gls{DSL} programmer in using \gls{MTASK}.
 If the editor produces correct \gls{MTASK} code by construction, much of the problems could be avoided.
 In the same respect, as \gls{MTASK} is a tagless-final \gls{EDSL} and uses \gls{HOAS}, the error messages are complex and larded with host language features.
-Much research has gone into simplifying these error messages by translating them to the \gls{DSL} domain, see for example \citep{serrano_type_2018}.
+Much research has gone into simplifying these error messages by translating them to the \gls{DSL} domain, see for example the work by \citep{serrano_type_2018}.
 De Roos briefly investigated these methods in their research internship.
 A future directions could be to extend these findings and apply more \gls{EDSL} error message techniques on \gls{MTASK} as well.
 
@@ -260,8 +262,8 @@ It would be interesting to investigate whether this can be automated or centrali
 
 More elaborate features in the type systems of modern functional programming languages allow for more type safety.
 The \gls{MTASK} language relies a lot on these features such as (multi-parameter) type classes and existential data types with class constraints.
-However, it should be possible to make abstractions over more stuff to make it safer.
-For example, the pin mode could be made a type parameter of the \gls{GPIO} pins, or interrupt handling could be made safer by incorporating the capabilities of the devices.
+However, it should be possible to make abstractions over an increasing number of features to make it safer still.
+For example, the pin mode could be made a type parameter of the \gls{GPIO} pins, or interrupt handling could be made safer by incorporating the capabilities of the devices in order to reduce run-time errors.
 
 \subsection{Scheduling}
 The scheduling in \gls{MTASK} works quite well but it is not real time.
@@ -280,7 +282,7 @@ This section provides an exhaustive overview of the work on \gls{MTASK} and its
 A first throw at a class-based shallowly \gls{EDSL} for microcontrollers was made by \citet{plasmeijer_shallow_2016}.
 The language was called \gls{ARDSL} and offered a type safe interface to \gls{ARDUINO} \gls{CPP} dialect.
 A \gls{CPP} code generation backend was available together with an \gls{ITASK} simulation backend.
-There was no support for tasks nor even functions.
+There was no support for tasks nor functions.
 Some time later in the 2015 \gls{CEFP} summer school, an extended version was created that allowed the creation of imperative tasks, local \glspl{SDS} and the usage of functions \citep{koopman_type-safe_2019}.
 The name then changed from \gls{ARDSL} to \gls{MTASK}.
 
@@ -302,16 +304,16 @@ One reason for this is that a lot of design patterns that are difficult using st
 In 2019, the \gls{CEFP}\slash\gls{3COWS} summer school in Budapest, Hungary hosted a course on developing \gls{IOT} applications with \gls{MTASK} as well \citep{lubbers_writing_2023}.
 
 \subsection{\texorpdfstring{\Glsxtrlong{TOP}}{Task-oriented programming}}
-In 2022, the SusTrainable summer school in Rijeka, Croatia hosted a course on developing greener \gls{IOT} applications using \gls{MTASK} as well \citep{lubbers_green_2022}.
+In 2022, the SusTrainable summer school in Rijeka, Croatia hosted a course on developing greener \gls{IOT} applications using \gls{MTASK} \citep{lubbers_green_2022}.
 Several students worked on extending \gls{MTASK} with many useful features:
-\Citet{van_der_veen_mutable_2020} did preliminary work on a green computing analysis, built a simulator, and explored the possibilities for adding bounded datatypes; de Roos explored beautifying error messages; \citet{de_boer_secure_2020} investigated the possibilities for secure communication channels; \citeauthor{crooijmans_reducing_2021} \citeyearpar{crooijmans_reducing_2021,crooijmans_reducing_2022} added abstractions for low-power operation to \gls{MTASK} such as hardware interrupts and power efficient scheduling; and \citet{antonova_mtask_2022} defined a preliminary formal semantics for a subset of \gls{MTASK}.
-In 2023, the SusTrainable summer school in Coimbra, Portugal will host a course on \gls{MTASK} as well.
+\citet{van_der_veen_mutable_2020} did preliminary work on a green computing analysis, built a simulator, and explored the possibilities for adding bounded datatypes; de Roos explored beautifying error messages; \citet{de_boer_secure_2020} investigated the possibilities for secure communication channels; \citeauthor{crooijmans_reducing_2021} \citeyearpar{crooijmans_reducing_2021,crooijmans_reducing_2022} added abstractions for low-power operation to \gls{MTASK} such as hardware interrupts and power efficient scheduling; and \citet{antonova_mtask_2022} defined a preliminary formal semantics for a subset of \gls{MTASK}.
+In 2023, the SusTrainable summer school in Coimbra, Portugal will host a course on \gls{MTASK}.
 
 \subsection{\texorpdfstring{\gls{MTASK}}{mTask} in practise}
 Funded by the Radboud-Glasgow Collaboration Fund, collaborative work was executed with Phil Trinder, Jeremy Singer, and Adrian Ravi Kishore Ramsingh.
 An existing smart campus application was developed using \gls{MTASK} and quantitatively and qualitatively compared to the original application that was developed using a traditional \gls{IOT} stack \citep{lubbers_tiered_2020}.
 This research was later extended to include a four-way comparison: \gls{PYTHON}, \gls{MICROPYTHON}, \gls{ITASK}, and \gls{MTASK} \citep{lubbers_could_2022}.
-Currently, power efficiency behaviour of traditional versus \gls{TOP} \gls{IOT} stacks is being compared as well adding a \gls{FREERTOS}, and an elixer/potato implementation to the mix as well.
+Currently, power efficiency behaviour of traditional versus \gls{TOP} \gls{IOT} stacks is being compared as well adding a \gls{FREERTOS}, and an Elixir implementation to the mix as well.
 
 \input{subfilepostamble}
 \end{document}