finalise finale
[phd-thesis.git] / top / finale.tex
index d528b71..9caa86e 100644 (file)
 \end{chapterabstract}
 
 \section{Finale}
-The \gls{MTASK} system is a proof-of-concept system, though fully functioning, for integrating \gls{IOT} edge devices in \gls{TOP}.
-In conjunction with \gls{ITASK}, it is possible to program all layers of the \gls{IOT} from a single declarative specification.
-The \gls{ITASK} system is used to program the top layers of an \gls{IOT} system, providing the server and the web \gls{UI}.
-Then, \gls{MTASK} can be used to integrate edge devices.
-Tasks for edge devices are written in the \gls{MTASK} \gls{DSL} and can be integrated in \gls{ITASK} using only a few functions.
-\todo{extend}
-
-Deep embedding.
+Traditionally, \gls{IOT} have been programmed using layered architectures.
+Every layer has its own software and hardware characteristics, resulting in semantic friction.
+\Gls{TOP} is a declarative programming paradigm designed for specifying multi-tiered interactive systems.
+However, it is not straightforward to run \gls{TOP} systems on resource-constrained devices such as edge devices.
+
+The \gls{MTASK} system bridges this gap by providing a \gls{TOP} programming language for edge devices.
+It is a full-fledged \gls{TOP} language hosted in a tiny functional programming language containing basic tasks, task combinators, support for sensors and actuators, and interrupts.
+It is integrated 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.
+\Gls{ITASK} abstracts away from the gritty details of interactive web applications such as program distribution, web applications, data storage, and user management.
+The engine of \gls{MTASK} abstracts away of all technicalities such as communication, abstractions for sensors and actuators, interrupts and (multi) task scheduling.
+
+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.
+When 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 work that needs to be done.
+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.
+The \gls{MTASK} device is equipped with a domain-specific \gls{OS} that only needs to be programmed once after which the device can continuously receive new tasks.
+\todo[inline]{Uitbreiden}
 
 \section{Future work}
 \todo[inline]{De grens tussen future en related work is soms vaag maar ik heb het zo goed als mogelijk proberen te scheiden. Mis ik hier nog iets?}
 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 would be to add features, support more platforms, 
 
-\todo{security}
+\subsection{Security}
+\Gls{IOT} has reached the news many times regarding security and it is a big concern \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 it difficult.
+The security of \gls{MTASK} and the used protocols are deliberately overlooked at the moment
+Though, because \gls{MTASK} is modular, for example, the communication channels are communication method agnostic, it should be fairly easy to apply standard security measures to them by replacing communication methods and applying standard authentication and encryption to the protocol.
+\Citet{de_boer_secure_2020} did preliminary research on securing the communication channels, which proved to be possible without many changes in the protocol.
+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.
@@ -53,9 +71,6 @@ Examples of such blocks are \gls{I2C} transmissions or calculations that rely on
 In \gls{MTASK}, all work expressed by tasks is already split up in atomic pieces of work.
 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 would be interesting to see what \gls{TOP} abstraction could be useful for intermittent computing and what solutions are required to make this work.
-An alternative to reducing the energy consumption by going to sleep is stepping down the processor frequency.
-So called \gls{DVFS} is a scheduling technique that slows down the processor in order to reach the goals as late as possible, reducing the power consumption.
-It would be interesting to investigate the possibilities for \gls{DVFS} in \gls{MTASK}.
 
 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.
@@ -74,9 +89,8 @@ Both semantics are not suitable for formal reasoning due to the complexity.
 Later, \citet{steenvoorden_tophat_2019} created \gls{TOPHAT}, a \gls{TOP} language with a complete formal specification with similar features to \gls{MTASK} \citep{steenvoorden_tophat_2019}.
 \Citet{antonova_mtask_2022} compared parts of \gls{MTASK} to the semantics of \gls{TOPHAT} semantics and created a preliminary semantics for a subset of \gls{MTASK}.
 Future research into extending the formal semantics of \gls{MTASK} is useful to give more guarantees on \gls{MTASK} programs.
-Maybe this opens the door to real-time operation as well.
 
-\subsection{\texorpdfstring{\Gls{TOP}}{Task-oriented programming}}
+\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.
 The \gls{ITASK} language is designed exactly the opposite.
@@ -111,6 +125,14 @@ Peripherals are not yet fully integrated in such a way.
 When a peripheral is added, the programmer has to define the correct byte code, implement the instructions in the interpreter, add task tree nodes, and implement them in the rewrite system.
 It would be interesting to investigate whether this can be automated or centralised in a way.
 
+\subsection{Scheduling}
+The scheduling in \gls{MTASK} works quite well but it is not real time.
+There is a variant of \gls{FRP} called \gls{PFRP} that allows for real-time operation \citep{belwal_variable_2013}.
+Furthermore, an alternative to reducing the energy consumption by going to sleep is stepping down the processor frequency.
+So called \gls{DVFS} is a scheduling technique that slows down the processor in order to reach the goals as late as possible, reducing the power consumption.
+\Citet{belwal_variable_2013} use \gls{PFRP} with \gls{DVFS} to reduce the energy consumption.
+It would be interesting to investigate the possibilities for \gls{DVFS} in \gls{MTASK} and \gls{TOP} in general.
+
 \section{Related work}
 The novelties of the \gls{MTASK} system can be compared to existing systems in several categories.
 It is a interpreted (\cref{sec:related_int}) \gls{TOP} (\cref{sec:related_top}) \gls{DSL} (\cref{sec:related_dsl}) that may seem similar at first glance to \gls{FRP} (\cref{sec:related_frp}), it is implemented in a functional language (\cref{sec:related_fp}) and due to the execution semantics, multitasking is automatically supported (\cref{sec:related_multi}).
@@ -132,8 +154,7 @@ Mat\`e is an example of an early tierless sensor network framework where devices
 
 \subsection{\texorpdfstring{\Glsxtrlongpl{DSL}}{DSLs} for microcontrollers}\label{sec:related_dsl}
 Many \glspl{DSL} provide higher-level programming abstractions for microcontrollers, for example providing strong typing or memory safety.
-For example Copilot \citep{hess_arduino-copilot_2020} and Ivory \citep{elliott_guilt_2015} are imperative \glspl{DSL} embedded in a functional language that compile to \ccpp{}.
-\todo{uit\-brei\-den?}
+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{}.
 
 \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.
@@ -171,7 +192,8 @@ The table compares the solutions in the relevant categories with \gls{MTASK}.
                        The characteristics are: sequential execution, local variable support, parallel composition, deterministic execution, bounded execution and safe shared memory (adapted from \citet[p.\ 12]{santanna_safe_2013}).
                }\label{tbl:multithreadingcompare}
 %              \begin{tabular}{lc>{\columncolor[gray]{0.95}}cc>{\columncolor[gray]{0.95}}cc>{\columncolor[gray]{0.95}}cc}
-               \small
+               \begingroup
+               \setlength\tabcolsep{4.5pt}
                \begin{tabular}{lccccccc}
                        \toprule
                        \multicolumn{2}{c}{Language} & \multicolumn{3}{c}{Complexity} & \multicolumn{3}{c}{Safety}\\
@@ -190,6 +212,7 @@ The table compares the solutions in the relevant categories with \gls{MTASK}.
                        \gls{MTASK}  & 2022 & \CIRCLE{} & \CIRCLE{} & \CIRCLE{} & \CIRCLE{} & \LEFTcircle{}\tnote{1} & \LEFTcircle{}\tnote{2}\\
                        \bottomrule
                \end{tabular}
+               \endgroup
                \begin{tablenotes}
                        \item [1] Only for tasks, not for expressions.
                        \item [2] Using \glspl{SDS}.
@@ -252,7 +275,7 @@ This was later improved upon by creating a simplified interface where \glspl{SDS
 It was shown by \citet{amazonas_cabral_de_andrade_developing_2018} that it was possible to build real-life \gls{IOT} systems with this integration.
 Moreover, a course on the \gls{MTASK} simulator was provided at the 2018 \gls{CEFP}\slash\gls{3COWS} winter school in Ko\v{s}ice, Slovakia \citep{koopman_simulation_2018}.
 
-\subsection{Transition to \texorpdfstring{\gls{TOP}}{TOP}}
+\subsection{Transition to \texorpdfstring{\glsxtrlong{TOP}}{Task-oriented programming}}
 The \gls{MTASK} language as it is now was introduced in 2018 \citep{koopman_task-based_2018}.
 This paper updated the language to support functions, simple tasks, and \glspl{SDS} but still compiled to \gls{ARDUINO} \gls{CPP} code.
 Later the byte code compiler and \gls{ITASK} integration was added to the language \citep{lubbers_interpreting_2019}.
@@ -260,7 +283,7 @@ Moreover, it was shown that it is very intuitive to write microcontroller applic
 One reason for this is that a lot of design patterns that are difficult using standard means are for free in \gls{TOP} (e.g.\ multithreading).
 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_2019}.
 
-\subsection{\texorpdfstring{\Glsxtrshort{TOP}}{TOP}}
+\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}.
 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; \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}.