.
authorMart Lubbers <mart@martlubbers.net>
Tue, 22 Nov 2022 15:03:43 +0000 (16:03 +0100)
committerMart Lubbers <mart@martlubbers.net>
Tue, 22 Nov 2022 15:03:43 +0000 (16:03 +0100)
intro/intro.tex
thesis.tex
top/green.tex
top/imp.tex [new file with mode: 0644]
top/int.tex [moved from top/top.tex with 69% similarity]

index 3eb6a34..6e672ce 100644 (file)
@@ -295,10 +295,14 @@ intBlink iInterval =
 \end{lstClean}
 
 \subsection{Other \texorpdfstring{\glsxtrshort{TOP}}{TOP} languages}
-While \gls{ITASK} conceived \gls{TOP}, it is not the only \gls{TOP} language and engine.
-Some \gls{TOP} languages and systems arose from Master's and Bachelor's thesis projects (e.g.\ \textmu{}Task \citep{piers_task-oriented_2016} and LTasks \citep{van_gemert_task_2022}) or were created to solve a practical problem (e.g.\ Toppyt \citep{lijnse_toppyt_2022} and hTask \citep{lubbers_htask_2022}).
-Furthermore, \gls{TOPHAT} is a fully formally specified \gls{TOP} language designed to capture the essence of \gls{TOP} formally \citep{steenvoorden_tophat_2019}.
+While \gls{ITASK} conceived \gls{TOP}, it is not the only \gls{TOP} system.
+Some \gls{TOP} systems arose from Master's and Bachelor's thesis projects.
+For example, \textmu{}Task \citep{piers_task-oriented_2016}, a \gls{TOP} language for modelling non-interruptible embedded systems in \gls{HASKELL}, and LTasks \citep{van_gemert_task_2022}, a \gls{TOP} language written in the dynamically typed programming language {LUA}.
+Some \gls{TOP} languages were created to solve a practical problem.Toppyt \citep{lijnse_toppyt_2022} is a general purpose \gls{TOP} language written in \gls{PYTHON} used to host frameworks for modelling C2 systems, and hTask \citep{lubbers_htask_2022}, a vessel for experimenting with asynchronous \glspl{SDS}.
+Finally there are \gls{TOP} languages with strong academic foundations.
+\Gls{TOPHAT} is a fully formally specified \gls{TOP} language designed to capture the essence of \gls{TOP} formally \citep{steenvoorden_tophat_2019}.
 It is also possible to translate \gls{TOPHAT} code to \gls{ITASK} to piggyback on the \gls{TOP} engine it offers \citep[\citesection{G.3}]{steenvoorden_tophat_2022}.
+\todo[inline]{uitbreiden met voorbeelden wat je er mee kunt}
 
 \section{Contributions}\label{sec:contributions}
 This section provides a thorough overview of the relation to publications and the scientific contributions of the episodes and chapters.
@@ -311,23 +315,21 @@ This episode is a paper based episodes on these techniques.
 While supervising \citeauthor{amazonas_cabral_de_andrade_developing_2018}'s \citeyear{amazonas_cabral_de_andrade_developing_2018} Master's thesis, focussing on an early version of \gls{MTASK}, a seed was planted for a novel deep embedding technique for \glspl{DSL} where the resulting language is extendible both in constructs and in interpretation using type classes and existential data types.
 Slowly the ideas organically grew to form the technique shown in the paper.
 The related work section is updated with the research found only after publication.
-\Cref{sec:classy_reprise} was added after publication and contains a (yet) unpublished extension of the embedding technique for reducing the required boilerplate.
+\Cref{sec:classy_reprise} was added after publication and contains a (yet) unpublished extension of the embedding technique for reducing the required boilerplate at the cost of requiring some advanced type system extensions.
 
 \Cref{chp:first-class_datatypes} is based on the paper \emph{First-Class Data Types in Shallow Embedded Domain-Specific Languages} \citep{lubbers_first-class_2022}.
-It shows how to inherit data types from the host language in \glspl{EDSL} using metaprogramming.
-It does so by providing a proof-of-concept implementation using \gls{HASKELL}'s metaprogramming system: \glsxtrlong{TH}.
+It shows how to inherit data types from the host language in \glspl{EDSL} using metaprogramming by providing a proof-of-concept implementation using \gls{HASKELL}'s metaprogramming system: \glsxtrlong{TH}.
 Besides showing the result, the paper also serves as a gentle introduction to using \glsxtrlong{TH} and contains a thorough literature study on research that uses \glsxtrlong{TH}.
 %The research in this paper and writing the paper was performed by me, though there were weekly meetings with Pieter Koopman and Rinus Plasmeijer in which we discussed and refined the ideas.
 
 \subsection{\nameref{prt:top}}
-This is a monograph compiled from the following papers and revised lecture notes on \gls{MTASK}, the \gls{TOP} system used to orchestrate the \gls{IOT}.
-It provides a gentle introduction to the \gls{MTASK} system elaborates on \gls{TOP} for the \gls{IOT}.
+This is a monograph compiled from the following papers and revised lecture notes on \gls{MTASK}.
+It provides a gentle introduction to all aspects of the \gls{MTASK} system and \gls{TOP} for the \gls{IOT}.
 
 \begin{itemize}
        \item \emph{A Task-Based \glsxtrshort{DSL} for Microcomputers} \citep{koopman_task-based_2018}.
-
-               This is the initial \gls{TOP}/\gls{MTASK} paper.
-               It provides an overview of the initial \gls{TOP} \gls{MTASK} language and shows first versions of a pretty printer, an \gls{ITASK} simulation and a \gls{C} code generation view.
+               This is the initial \gls{TOP}\slash{}\gls{MTASK} paper.
+               It provides an overview of the initial \gls{TOP} \gls{MTASK} language and shows first versions of some of the interpretations.
        \item \emph{Task Oriented Programming for the \glsxtrlong{IOT}} \citep{lubbers_task_2018}.
                
                This paper was an extension of my Master's thesis \citep{lubbers_task_2017}.
@@ -339,35 +341,35 @@ It provides a gentle introduction to the \gls{MTASK} system elaborates on \gls{T
                This work acknowledges the support of the ERASMUS+ project ``Focusing Education on Composability, Comprehensibility and Correctness of Working Software'', no. 2017--1--SK01--KA203--035402
                }
 
-               This paper was a short paper on the multitasking capabilities of \gls{MTASK} in contrast to traditional multitasking methods for \gls{ARDUINO}.
+               This paper is a short paper on the multitasking capabilities of \gls{MTASK} comparing it to traditional multitasking methods for \gls{ARDUINO}.
 %              \paragraph{Contribution}
 %              The research in this paper and writing the paper was performed by me, though there were weekly meetings with Pieter Koopman and Rinus Plasmeijer.
        \item \emph{Simulation of a Task-Based Embedded Domain Specific Language for the Internet of Things} \citep{koopman_simulation_2018}.\footnotemark[\value{footnote}]
 
-               These revised lecture notes are from a course on the \gls{MTASK} simulator was provided at the 2018 \gls{CEFP}/\gls{3COWS} winter school in Ko\v{s}ice, Slovakia.
+               These revised lecture notes are from 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.
 %              \paragraph{Contribution}
 %              Pieter Koopman wrote and taught it, I helped with the software and research.
        \item \emph{Writing Internet of Things Applications with Task Oriented Programming} \citep{lubbers_writing_2019}.\footnotemark[\value{footnote}]
 
-               These revised lecture notes are from a course on programming in \gls{MTASK} provided at the 2019 \gls{CEFP}/\gls{3COWS} summer school in Budapest, Hungary.
+               These revised lecture notes are from a course on programming in \gls{IOT} systems using \gls{MTASK} provided at the 2019 \gls{CEFP}\slash{}\gls{3COWS} summer school in Budapest, Hungary.
 %              \paragraph{Contribution}
 %              Pieter Koopman prepared and taught half of the lecture and supervised the practical session.
 %              I taught the other half of the lecture, wrote the lecture notes, made the assignments and supervised the practical session.
        \item \emph{Interpreting Task Oriented Programs on Tiny Computers} \citep{lubbers_interpreting_2019}.
 
-               This paper shows an implementation for \gls{MTASK} for microcontrollers in the form of a compilation scheme and informal semantics description.
+               This paper shows an implementation for \gls{MTASK} for microcontrollers.
 %              \paragraph{Contribution}
 %              The research in this paper and writing the paper was performed by me, though there were weekly meetings with Pieter Koopman and Rinus Plasmeijer.
        \item \emph{Reducing the Power Consumption of IoT with Task-Oriented Programming} \citep{crooijmans_reducing_2022}.
 
-               This paper shows how to create a scheduler so that devices running \gls{MTASK} tasks can go to sleep more automatically.
+               This paper shows how to create a scheduler so that devices running \gls{MTASK} tasks can go to sleep more automatically and how interrupts are incorporated in the language.
 %              \paragraph{Contribution}
 %              The research was carried out by \citet{crooijmans_reducing_2021} during his Master's thesis.
 %              I did the daily supervision and helped with the research, Pieter Koopman was the formal supervisor and wrote most of the paper.
        \item \emph{Green Computing for the Internet of Things} \citep{lubbers_green_2022}.\footnote{
                This work acknowledges the support of the Erasmus+ project ``SusTrainable---Promoting Sustainability as a Fundamental Driver in Software Development Training and Education'', no. 2020--1--PT01--KA203--078646}
 
-               These revised lecture notes are from a course on sustainable \gls{IOT} programming in \gls{MTASK} provided at the 2022 SusTrainable summer school in Rijeka, Croatia.
+               These revised lecture notes are from a course on sustainable \gls{IOT} programming with \gls{MTASK} provided at the 2022 SusTrainable summer school in Rijeka, Croatia.
 
 %              \paragraph{Contribution}
 %              These revised lecture notes are from a course on sustainable programming using \gls{MTASK} provided at the 2022 SusTrainable summer school in Rijeka, Croatia.
@@ -378,18 +380,18 @@ It provides a gentle introduction to the \gls{MTASK} system elaborates on \gls{T
 \paragraph{Contribution:}
 The original imperative predecessors the \gls{MTASK} language and their initial interpretations were developed by Pieter Koopman and Rinus Plasmeijer.
 I continued with the language; developed the byte code interpreter, the precursor to the \gls{C} code generation interpretation; the integration with \gls{ITASK}; and the \gls{RTS}.
-The paper of which I am first author are written by me.
+The paper of which I am first author are solely written by me.
 
 \subsection{\nameref{prt:tvt}}
 \Cref{prt:tvt} is based on a journal paper that quantitatively and qualitatively compares traditional \gls{IOT} architectures with \gls{IOT} systems using \gls{TOP} and contains a single chapter.
 This chapter is based on the journal paper: \emph{Could Tierless Programming Reduce IoT Development Grief?} \citep{lubbers_could_2022}.\footnote{This work is an extension of the conference article: \emph{Tiered versus Tierless IoT Stacks: Comparing Smart Campus Software Architectures} \citep{lubbers_tiered_2020}.\footnotemark{}}
-\footnotetext{This paper was partly funded by the Radboud-Glasgow Collaboration Fund.}
+\footnotetext{This paper was partly funded by the 2019 Radboud-Glasgow Collaboration Fund.}
 
 It compares programming traditional tiered architectures to tierless architectures by showing a qualitative and a quantitative four-way comparison of a smart-campus application.
 
 \paragraph{Contribution:}
 Writing the paper was performed by all authors.
-I created the server application, the \gls{CLEAN}/\gls{ITASK}/\gls{MTASK} implementation (\glsxtrshort{CWS}) and the \gls{CLEAN}/\gls{ITASK} implementation (\glsxtrshort{CRS})
+I created the server application, the \gls{CLEAN}\slash{}\gls{ITASK}\slash{}\gls{MTASK} implementation (\glsxtrshort{CWS}) and the \gls{CLEAN}\slash{}\gls{ITASK} implementation (\glsxtrshort{CRS})
 Adrian Ramsingh created the \gls{MICROPYTHON} implementation (\glsxtrshort{PWS}), the original \gls{PYTHON} implementation (\glsxtrshort{PRS}) and the server application were created by \citet{hentschel_supersensors:_2016}.
 
 \input{subfilepostamble}
index 95a4c46..86dc50e 100644 (file)
 
 \part[Oratorio --- Task-Oriented Programming]{Oratorio\\[2ex]\smaller{}Task-Oriented Programming for the Internet of Things}%
 \label{prt:top}
-\subfile{top/top} % MTask tutorial and implementation
+%\chapter{\texorpdfstring{\Glsxtrshort{TOP} for the \glsxtrshort{IOT}}{TOP for the IoT}}%
+\subfile{top/4iot}
+
+%\chapter{The \texorpdfstring{\gls{MTASK}}{mTask} \texorpdfstring{\glsxtrshort{DSL}}{DSL}}%
+\subfile{top/lang}
+
+%\chapter{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}%
+\subfile{top/int}
+
+%\chapter{Implementation}%
+\subfile{top/imp}
+
+% Green computing
+\subfile{top/green}
 
 \part[Variations --- Tiered vs.\ Tierless Programming]{Transformation\\[2ex]\smaller{}Tiered vs.\ Tierless Programming}%
 \label{prt:tvt}
index 98f23cb..79843f2 100644 (file)
@@ -398,17 +398,18 @@ Executed tasks are temporarily stored in the \cleaninline{stepped} set instead o
 A task that produces a stable value is completed and is not queued again.
 
 \begin{algorithm}
-\DontPrintSemicolon
+%\DontPrintSemicolon
 \SetKwProg{Repeatt}{repeat}{}{end}
 \KwData{queue = []\;}
 \Begin{
        \Repeatt{}{
-               queue += communicateWithServer\;
+               time = currentTime()\;
+               queue += communicateWithServer()\;
                stepped = []\tcp*{tasks stepped in this round}
-               \While{notEmpty(queue) $\wedge$ earliestDeadline(top(queue)) $\leq$ currentTime}{
+               \While{$\neg$empty(queue) $\wedge$ earliestDeadline(top(queue)) $\leq$ time}{
                        (task, queue) = pop(queue)\;
                        task2 = step(task)\tcp*{computes new execution interval}
-                       \If{$\neg$ isStable(task2)\tcp*{not finished after step}}{
+                       \If(\tcp*[f]{not finished after step}){$\neg$ isStable(task2)}{
                                stepped += task2\;
                        }
                }
diff --git a/top/imp.tex b/top/imp.tex
new file mode 100644 (file)
index 0000000..0955b46
--- /dev/null
@@ -0,0 +1,20 @@
+\documentclass[../thesis.tex]{subfiles}
+
+\input{subfilepreamble}
+
+\begin{document}
+\input{subfileprefix}
+
+\chapter{Implementation}%
+\label{chp:implementation}
+\begin{chapterabstract}
+       This chapter shows the implementation of the \gls{MTASK} system.
+       It is threefold: first it shows the implementation of the byte code compiler for \gls{MTASK}'s \gls{TOP} language, then is details of the implementation of \gls{MTASK}'s \gls{TOP} engine that executes the \gls{MTASK} tasks on the microcontroller, and finally it shows how the integration of \gls{MTASK} tasks and \glspl{SDS} is implemented both on the server and on the device.
+\end{chapterabstract}
+IFL19 paper, bytecode instructieset~\cref{chp:bytecode_instruction_set}
+
+\section{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}
+IFL18 paper stukken
+
+\input{subfilepostamble}
+\end{document}
similarity index 69%
rename from top/top.tex
rename to top/int.tex
index 6c759fb..a1742fc 100644 (file)
@@ -5,12 +5,6 @@
 \begin{document}
 \input{subfileprefix}
 
-%\chapter{\texorpdfstring{\Glsxtrshort{TOP} for the \glsxtrshort{IOT}}{TOP for the IoT}}%
-\subfile{4iot}
-
-%\chapter{The \texorpdfstring{\gls{MTASK}}{mTask} \texorpdfstring{\glsxtrshort{DSL}}{DSL}}%
-\subfile{lang}
-
 \chapter{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}%
 \label{chp:integration_with_itask}
 \begin{chapterabstract}
@@ -49,7 +43,7 @@ The channels contain three fields, a queue of messages that are received, a queu
 Every communication method that implements the \cleaninline{channelSync} class can provide the communication with an \gls{MTASK} device.
 As of now, serial port communication, direct \gls{TCP} communication and \gls{MQTT} over \gls{TCP} are supported as communication providers.
 The \cleaninline{withDevice} function transforms a communication provider and a task that does something with this device to an \gls{ITASK} task.
-This task sets up the communication, exchanges specifications, handles errors and cleans up after closing.
+Internally, the task sets up the communication, exchanges specifications, executes the inner task while handling errors, and finally cleans up after closing.
 \Cref{lst:mtask_device} shows the types and interface to connecting devices.
 
 \begin{lstClean}[label={lst:mtask_device},caption={Device communication interface in \gls{MTASK}.}]
@@ -58,15 +52,24 @@ This task sets up the communication, exchanges specifications, handles errors an
 
 class channelSync a :: a (Shared sds Channels) -> Task () | RWShared sds
 
-withDevice :: (a (MTDevice -> Task b) -> Task b) | iTask b & channelSync, iTask a
+withDevice :: a (MTDevice -> Task b) -> Task b | iTask b & channelSync, iTask a
 \end{lstClean}
 
 \section{Lifting tasks}\label{sec:liftmtask}
-Once the connection with the device is established, \ldots
-\begin{lstClean}
-liftmTask :: (Main (BCInterpret (TaskValue u))) MTDevice -> Task u | iTask u
+Once the connection with the device is established, \gls{MTASK} tasks can be lifted to \gls{MTASK} tasks using the \cleaninline{liftmTask} family of functions (see \cref{lst:liftmtask}).
+Given an \gls{MTASK} task in the \cleaninline{BCInterpret} view and a device obtained from \cleaninline{withDevice}, an \gls{ITASK} task is returned.
+This \gls{ITASK} task tethers the \gls{MTASK} task that is executed on the microcontroller.
+Hence, when for example observing the task value, the actual task value from the microcontroller is observed.
+
+\begin{lstClean}[label={lst:liftmtask},caption={The interface for lifting \gls{MTASK} tasks to \gls{ITASK} tasks.}]
+liftmTask :: (Main (MTask BCInterpret u)) MTDevice -> Task u | iTask u
 \end{lstClean}
 
+Under the hood, \cleaninline{liftmTask} compiler the \gls{MTASK} task to byte code, gathers the initial values for the lifted \glspl{SDS} and sends the data to the device.
+Once acknowledged, the \gls{MTASK} task value and the \glspl{SDS} are monitored.
+If the \gls{ITASK} server updates the value of a lifted \gls{SDS}, the appropriate message is sent to the \gls{MTASK} to notify it of the change.
+Furthermore, the \gls{MTASK} device may update the \gls{SDS}, and in that case the message is picked up by the \cleaninline{liftmTask} task and the \gls{SDS} on the \gls{ITASK} server updated accordingly.
+
 \section{Lifting \texorpdfstring{\glsxtrlongpl{SDS}}{shared data sources}}\label{sec:liftsds}
 \begin{lstClean}[label={lst:mtask_itasksds},caption={Lifted \gls{ITASK} \glspl{SDS} in \gls{MTASK}.}]
 class liftsds v where
@@ -74,19 +77,8 @@ class liftsds v where
                -> Main (MTask v u) | RWShared sds
 \end{lstClean}
 
-\chapter{Implementation}%
-\label{chp:implementation}
-\begin{chapterabstract}
-       This chapter shows the implementation of the \gls{MTASK} system.
-       It is threefold: first it shows the implementation of the byte code compiler for \gls{MTASK}'s \gls{TOP} language, then is details of the implementation of \gls{MTASK}'s \gls{TOP} engine that executes the \gls{MTASK} tasks on the microcontroller, and finally it shows how the integration of \gls{MTASK} tasks and \glspl{SDS} is implemented both on the server and on the device.
-\end{chapterabstract}
-IFL19 paper, bytecode instructieset~\cref{chp:bytecode_instruction_set}
-
-\section{Integration with \texorpdfstring{\gls{ITASK}}{iTask}}
-IFL18 paper stukken
+\section{Conclusion}
 
-% Green computing
-\subfile{green}
 
 \input{subfilepostamble}
 \end{document}