+\subsection{Functional reactive programming}\label{sec:related_frp}
+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, 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}.
+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 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.
+
+For example, Potato is an \gls{FRP} language for building entire \gls{IOT} systems using powerful devices such as the Raspberry Pi leveraging the Erlang \gls{VM} \citep{troyer_building_2018}.
+It requires client devices to be able to run the Erlang \gls{VM} which makes it unsuitable for low memory environments.
+The emfrp language compiles a \gls{FRP} specification for a microcontroller to \gls{C} code \citep{sawada_emfrp:_2016}.
+The \gls{IO} part, the bodies of some functions, still need to be implemented.
+These \gls{IO} functions can then be used as signals and combined as in any \gls{FRP} language.
+Due to the compilation to \gls{C} it is possible to run emfrp programs on tiny computers.
+However, in contrast to in \gls{MTASK}, the tasks are not interpreted and there is no automated communication with a server.
+Other examples are CFRP \citep{suzuki_cfrp_2017}, XFRP \citep{shibanai_distributed_2018}, Juniper \citep{helbling_juniper:_2016}, Hailstorm \citep{sarkar_hailstorm_2020}, Haski \citep{valliappan_towards_2020}, arduino-copilot \citep{hess_arduino-copilot_2020}.
+
+\subsection{Task-oriented programming}\label{sec:related_top}
+\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.
+\Gls{IOT} applications contain a distributed and multi-user component, but the software on the device 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 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.
+
+\subsection{Security}
+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.
+For example, the communication channels are communication method agnostic and operate through a simple duplex channel interface.
+It should therefore be fairly easy to apply standard security measures to them by replacing communication methods and applying off-the-shelve 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 produce a lot of data.
+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} 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.
+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 a 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 is 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} abstractions are useful to support intermittent computing properly and what solutions are required to make it 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 different machines.
+It is interesting to investigate how this networking technique can be utilised in \gls{MTASK}.
+
+\Glspl{FPGA} are highly customisable integrated chips consisting of programmable gates.
+Promising research has gone into translating purely functional code to \gls{FPGA} configurations \citep{baaij_digital_2015}.
+It would be interesting to see how and whether (parts of) \gls{TOP} programs or the functionality of the \gls{MTASK} \gls{OS} could be translated to \gls{FPGA} specifications.
+
+\subsection{Formal semantics}
+Semantics allow reasoning about the language and programs in order to do (symbolic) simulation, termination checking, task equivalence, or otherwise.
+For \gls{ITASK} there have been two attempts to formally specify the language.
+First \citet{koopman_executable_2011} defined a semantics used for property based testing based on a minimal version of \gls{ITASK}.
+Then \citet{plasmeijer_task-oriented_2012} formalised \gls{ITASK} by providing an executable semantics for the language.
+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.
+
+\subsection{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 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.
+It would be fruitful to investigate which workflows cannot be specified with the limited set of combinators available in \gls{MTASK}.
+\Citet{van_der_aalst_workflow_2003} defines a benchmark set of workflow patterns.
+It is interesting to see which patterns can already be implemented with just \gls{MTASK}, which require a round-trip with the server, and what additional combinators would be needed.
+
+Editors are a crucial part of \gls{TOP}.
+In \gls{MTASK}, sensors can be seen as read-only shared editors that are updated by the system.
+It is interesting to investigate how actual interactive editors would fit in \gls{MTASK}.
+For example, many smartwatches contain touch sensitive screens that could be used to interact with the user in this way.
+Alternatively, sufficiently powerful edge devices can probably run simple web interfaces as well.
+
+\Glspl{SDS} in \gls{ITASK} have a rich set of combinators to transform and combine the \glspl{SDS} into new \gls{SDS}.
+In \gls{MTASK}, \glspl{SDS} are typed global variables that may or may not proxy an \gls{ITASK} \gls{SDS}.
+It could be interesting to port the \gls{SDS} combinators to \gls{MTASK} as well, allowing them to be transformed and combined also.
+
+\subsection{Usability}
+The promise of \glspl{DSL} has often been that a domain expert could program with little technical knowledge of the host programming language.
+Some even propose that a \gls{DSL} is a \gls{UI} for domain experts to computation platforms \citep{management_association_evaluating_2014}.
+In practise this is not always the case due to crippling syntax and convoluted error messages.
+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 the work by \citep{serrano_type_2018}.
+\Citet{de_roos_2020} 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.
+
+\subsection{Language features}
+The serialisation and deserialisation of data types is automated both on the server and the \gls{MTASK} device using generic programming.
+Using the structural information of the data type, the code responsible for the functionality is automatically generated.
+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.
+
+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 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.
+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 is interesting to investigate the possibilities for \gls{DVFS} in \gls{MTASK} and \gls{TOP} in general.
+
+\section{History of mTask}