-There are two ways of looking at this model when also incorporating edge devices for \gls{IOT} systems.
-Firstly, edge devices can be seen as simple resources, thus accessed through the resource access layer.
-Secondly, edge devices are miniature \gls{LSOC} systems in itself as well.
-In \gls{TOSD} the same can be applied.
-The individual components in the miniature systems, the tasks, the \glspl{SDS}, are connected to the other systems.
-
-\subsection{\texorpdfstring{\Gls{ITASK}}{ITask}}
-The concept of \gls{TOP} originated from the \gls{ITASK} framework, a declarative interactive systems language and \gls{TOP} engine for defining multi-user distributed web applications implemented as an \gls{EDSL} in the lazy pure \gls{FP} language \gls{CLEAN} \citep{plasmeijer_itasks:_2007,plasmeijer_task-oriented_2012}.
-From the structural properties of the data types, the entire user interface is automatically generated.
-
-As an example, \cref{lst:enter_person,fig:enter_person} show the \gls{ITASK} code and the corresponding \gls{UI} for a simple task for entering a person.
-From the data type definitions (\cref{lst:dt_fro,lst:dt_to}), using generic programming (\cref{lst:dt_derive}), the \glspl{UI} for the data types are automatically generated.
-Using task combinators (see \cleaninline{>>!} at \cref{lst:task_comb}), the tasks can be combined in sequence.
-Only when the user entered a complete value in the web editor, then the continue button enables and the result can be viewed.
-Special combinators (e.g.\ \cleaninline{@>>} at \cref{lst:task_ui}) are available to tweak the \gls{UI} afterwards.
-
-\begin{figure}[ht]
- \includegraphics[width=.325\linewidth]{person0g}
- \includegraphics[width=.325\linewidth]{person1g}
- \includegraphics[width=.325\linewidth]{person2g}
- \caption{The \gls{UI} for entering a person in \gls{ITASK}.}%
- \label{fig:enter_person}
+\Cref{fig:tosd} differs from the presented \gls{IOT} architecture shown in \cref{fig:iot-layers} because they represent different concepts.
+The \gls{IOT} architecture is an execution architecture whereas \gls{TOSD} is a software development model.
+E.g.\ from a software development perspective, a task is a task, whether it is executed on a microcontroller, a server, or a client.
+Only when a task is executed, the location of the execution becomes important, but this is taken care of by the system.
+Some concepts from the \gls{TOSD} model can be mapped upon the \gls{IOT} architecture in two ways.
+Firstly, edge devices can be seen as simple resources, thus accessed through \glspl{SDS}.
+The second view is that edge devices contain miniature \gls{TOP} systems in itself.
+The individual components in the miniature systems, the tasks, the \glspl{SDS}, are, in the eventual execution, connected to the main system.
+
+\subsection{The iTask system}
+The concept of \gls{TOP} originated from the \gls{ITASK} framework, a declarative language and \gls{TOP} engine for defining interactive multi-user distributed web applications.
+The \gls{ITASK} system is implemented as an \gls{EDSL} in the programming language \gls{CLEAN}\footnote{\Cref{chp:clean_for_haskell_programmers} contains a guide for \gls{CLEAN} tailored to \gls{HASKELL} programmers.} \citep{plasmeijer_itasks:_2007,plasmeijer_task-oriented_2012}.
+It has been under development for over fifteen years and has proven itself through use in industry for some time now as well \citep{top_software_viia_2023}.
+From the structural properties of the data types and the current status of the work to be done, the entire \gls{UI} is automatically generated.
+Browsers are powering \gls{ITASK}'s presentation layer.
+The framework is built on top of standard web techniques such as JavaScript, HTML, and {CSS}.
+The browser runs the actual \gls{ITASK} code using an interpreter that operates on \gls{CLEAN}'s intermediate language \gls{ABC} \citep{staps_lazy_2019}.
+
+Tasks in \gls{ITASK} have either \emph{no value}, an \emph{unstable} or a \emph{stable} task value.
+For example, an editor for filling in a form initially has no value.
+Once the user entered a complete value, its value becomes an unstable value, it can still be changed or even reverted to no value by emptying the editor again.
+Only when for example a continue button is pressed, a task value becomes stable, fixing its value.
+The allowed task value transitions are shown in \cref{fig:taskvalue}.
+
+\begin{figure}
+ \centering
+ \includestandalone{taskvalue}
+ \caption{Transition diagram for task values in \gls{ITASK}.}%
+ \label{fig:taskvalue}
+\end{figure}
+
+As an example, \cref{lst:todo,fig:todo} show the code and \gls{UI} for an interactive to-do list application.
+The user modifies a shared to-do list through an editor directly or using some predefined actions.
+Furthermore, in parallel, the length of the list is shown to demonstrate \glspl{SDS}.
+Using \gls{ITASK}, complex collaborations of users and tasks can be described on a high level.
+
+From the data type definitions (\cref{lst:todo_dt}), using generic programming (\cref{lst:todo_derive}), the \glspl{UI} for the data types are automatically generated.
+Then, using the parallel task combinator (\cleaninline{-\|\|}) the task for updating the to-dos (\cref{lst:todo_update}) and the task for viewing the length are combined (\cref{lst:todo_length}).
+This particular parallel combinator uses the result of the left-hand side task.
+Both tasks operate on the to-do \gls{SDS} (\cref{lst:todo_sds}).
+The task for updating the to-do list is an editor (\cref{lst:todo_editor}) combined using a step combinator (\crefrange{lst:todo_contfro}{lst:todo_contto}).
+The actions either change the value, sorting or clearing it, or terminate the task by returning the current value of the \gls{SDS}.
+Special combinators (e.g.\ \cleaninline{@>>} at \cref{lst:todo_ui}) are used to tweak the \gls{UI} to display informative labels.
+
+\cleaninputlisting[float=,firstline=6,lastline=22,tabsize=3,numbers=left,caption={The code for a shared to-do list in \gls{ITASK}.},label={lst:todo}]{lst/sharedlist.icl}
+
+\begin{figure}
+ \centering
+ \includegraphics[width=\linewidth]{todo0g}
+ \caption{The \gls{UI} for the shared to-do list in \gls{ITASK}.}%
+ \label{fig:todo}
+\end{figure}
+
+\subsection{The mTask system}
+The work for \gls{IOT} edge devices can often be succinctly described by \gls{TOP} programs.
+Software on microcontrollers is usually composed of smaller basic tasks, are interactive, and share data with other components or the server.
+The \gls{ITASK} system seems an obvious candidate for bringing \gls{TOP} to \gls{IOT} edge devices.
+However, an \gls{ITASK} application contains many features that are not needed on \emph{edge devices} such as higher-order tasks, support for a distributed architecture, or a multi-user web server.
+Furthermore, \gls{IOT} edge devices are in general not powerful enough to run or interpret \gls{CLEAN}\slash\gls{ABC} code, they just lack the processor speed and memory.
+To bridge this gap, \gls{MTASK} is developed, a domain-specific \gls{TOP} system for \gls{IOT} edge devices that is integrated in \gls{ITASK} \citep{koopman_task-based_2018}.
+The \gls{ITASK} language abstracts away from details such as user interfaces, data storage, client-side platforms, and persistent workflows.
+On the other hand, \gls{MTASK} offers abstractions for edge layer-specific details such as the heterogeneity of architectures, platforms, and frameworks; peripheral access; task scheduling; and lowering energy consumption.
+
+The \gls{MTASK} system is seamlessly integrated with \gls{ITASK}.
+Tasks in \gls{MTASK} are integrated in such a way that they function as regular \gls{ITASK} tasks.
+Furthermore, \glspl{SDS} on the device can proxy \gls{ITASK} \glspl{SDS}.
+Using \gls{MTASK}, the programmer can define all layers of an \gls{IOT} system as a single declarative specification.
+The \gls{MTASK} language is written in \gls{CLEAN} as a multi-view \gls{EDSL} and hence there are multiple interpretations possible.
+The byte code compiler is the most relevant for this thesis.
+From an \gls{MTASK} task constructed at run time, a compact binary representation of the work that needs to be done is compiled.
+This byte code is then sent to a device that running the \gls{MTASK} \gls{RTS}.
+This feather-light domain-specific \gls{OS} is written in portable \gls{C} with a minimal device specific interface and it executes the tasks using interpretation and rewriting.
+
+To illustrate \imtask{}, an example application is shown.
+The application is an interactive application for blinking \pgls{LED} on the microcontroller at a certain frequency that can be set and updated at run time.
+\Cref{lst:intro_blink,fig:intro_blink} show the \gls{ITASK} part of the code and a screenshot.
+Using \cleaninline{enterInformation}, the connection specification of the \gls{TCP} device is queried through a web editor (\cref{lst:intro_enterDevice,fig:intro_blink_dev}).
+\Cref{lst:intro_withshared} defines \pgls{SDS} to communicate the blinking interval between the server and the edge device.
+The \gls{MTASK} device is connected using \cleaninline{withDevice} at \cref{lst:intro_withdevice}.
+Once connected, the \cleaninline{intBlink} task is sent to the device (\cref{lst:intro_liftmtask}) and, in parallel, a web editor is shown that updates the value of the interval \gls{SDS} (\cref{lst:intro_editor,fig:intro_blink_int}).
+To allow terminating of the task, the \gls{ITASK} task ends with a sequential operation that returns a constant value when the button is pressed, making the task stable.
+
+\cleaninputlisting[float={!ht},firstline=10,lastline=18,numbers=left,caption={The \gls{ITASK} code for the interactive blinking application.},label={lst:intro_blink}]{lst/blink.icl}
+
+\begin{figure}
+ \centering
+ \begin{subfigure}{.5\textwidth}
+ \centering
+ \includegraphics[width=.9\linewidth]{blink1g}
+ \caption{Device selection.}\label{fig:intro_blink_dev}
+ \end{subfigure}%
+ \begin{subfigure}{.5\textwidth}
+ \centering
+ \includegraphics[width=.9\linewidth]{blink2g}
+ \caption{Changing the interval.}\label{fig:intro_blink_int}
+ \end{subfigure}
+ \caption{The \gls{UI} for the interactive blink application in \gls{MTASK}.}%
+ \label{fig:intro_blink}