From: Mart Lubbers Date: Fri, 16 Jun 2017 14:16:29 +0000 (+0200) Subject: shares X-Git-Tag: hand-in~83 X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=2a4d91380ae0d2a7dfac58b8d5194d57d61af3ae;p=msc-thesis1617.git shares --- diff --git a/img/manage.png b/img/manage.png new file mode 100644 index 0000000..e73071f Binary files /dev/null and b/img/manage.png differ diff --git a/results.arch.tex b/results.arch.tex index af7b57d..f9b6725 100644 --- a/results.arch.tex +++ b/results.arch.tex @@ -111,7 +111,7 @@ is given in Listing~\ref{lst:mtaskdevice}. The definitions of the message format are explained in the following section. \begin{lstlisting}[caption={Device type},label={lst:mtaskdevice}] -deviceStore :: Shared [MTaskDevice] +deviceStoreNP :: Shared [MTaskDevice] :: Channels :== ([MTaskMSGRecv], [MTaskMSGSend], Bool) :: BCState = ... // Compiler state, explained in later sections diff --git a/results.itasks.tex b/results.itasks.tex index 29762cc..7a87936 100644 --- a/results.itasks.tex +++ b/results.itasks.tex @@ -1,7 +1,67 @@ +The glue in the system is written in \gls{iTasks}. Functions for managing +devices, \glspl{Task} and \glspl{SDS} are created. An interface is made that +allows an interactive management console for the \gls{mTask} system. This +interface provides functionality to list shares, add tasks, remove tasks, +administrate devices and view the state of the system. + \section{Integration} +When the system starts up the devices residing in the \gls{SDS} must be cleaned +up. It might be the case that they contain tasks, shares or errors. A user or +programmer can then choose to reconnect some devices using the +\CI{connectDevice} function. + +\begin{lstlisting}[caption={Starting up the devices},% + label={lst:startupdevs}] +startupDevices :: Task [MTaskDevice] +startupDevices = upd (map reset) deviceStoreNP + where reset d = {d & deviceTask=Nothing, deviceTasks=[], deviceError=Nothing} +\end{lstlisting} + +An image of the management interface is shown in Figure~\ref{lst:manage}. +The system management is done by a single \gls{Task} called \CI{mTaskManager}. +To manage the system, a couple of different functionalities are needed and +are launched. The left sidebar of the interface shows the list of example +\glspl{Task} that are present in the system. When clicking a task, a dialog +opens in which you can select the device to send the task to. The dialog might +contain user specified variables. All example \glspl{mTask} are of the type +\CI{Task (Main (ByteCode () Stmt))} and can thus ask for user input first. + +The bottom panel shows the device information. In this panel, the devices can +be created and modified. Moreover, this panel allows the user to reconnect with +a device after a restart of the server application. + +\begin{figure}[H] + \centering + \includegraphics[width=\linewidth]{manage} + \caption{The device management interface}\label{lst:management} +\end{figure} \section{Shares} -\todo{Semantiek van shares, hoe ze in iTasks zijn, hoe typering} +The architecture of the system stores the \glspl{SDS} in the \gls{SDS} that +stores the list of devices. This means that if a \gls{SDS} updates, everyone +watching it will be notified. This would result in to a lot of notifications +that are not ment to be for the listener. Moreover, when a client updates the +\gls{SDS} this is processed by the connection handler and results in an update +of the real \gls{SDS}. When an \gls{iTasks}-\gls{Task} writes to a \gls{SDS} +this is not passed on to the device. -\section{Lifting} -\todo{Lift mTask taken naar echte taken, hoe werkt dat?} +To solve the problem, parametric lenses are used on the device storage. +Listing~\ref{lst:actualdev} shows the actual types for the device storage. +Programmers wanting to access the entire \gls{SDS} use the \CI{deviceStoreNP}. +Programmers wanting to access a single \gls{SDS} on a device can use the +\CI{getRealShare} function which is a wrapper around the \CI{deviceStore} which +applies a parametric lens. + +\begin{lstlisting}[label={lst:actualdev},% + caption={Real types for the device \gls{SDS}}] +deviceStoreNP :: Shared [MTaskDevice] +deviceStore :: RWShared (Maybe (MTaskDevice, Int)) [MTaskDevice] [MTaskDevice] + +realDeviceStore :: Shared [MTaskDevice] + +getRealShare :: MTaskDevice MTaskShare -> Shared BCValue +\end{lstlisting} + +\subsection{Parametric Lens} +Therefore the main device store +\todo{Semantiek van shares, hoe ze in iTasks zijn, hoe typering} diff --git a/results.mtask.tex b/results.mtask.tex index 9c16fc5..1b46df1 100644 --- a/results.mtask.tex +++ b/results.mtask.tex @@ -94,8 +94,8 @@ accordingly. , sdsval :: BCValue } :: BCState = - { freshl :: [Int] - , freshs :: [Int] + { freshl :: Int + , freshs :: Int , sdss :: [BCShare] } @@ -209,7 +209,7 @@ since the labels are resolved to real addresses later on anyways. \begin{lstlisting}[label={lst:controlflow},% caption={Bytecode view for \texttt{arith}}] -freshlabel = get >>= \st=:{freshl=[fr:frs]}->put {st & freshl=frs} >>| pure fr +freshlabel = get >>= \st=:{freshl}->put {st & freshl=freshl+1} >>| pure freshl instance If ByteCode Stmt Stmt Stmt where If b t e = BCIfStmt b t e instance If ByteCode e Stmt Stmt where If b t e = BCIfStmt b t e @@ -238,7 +238,7 @@ implementation is shown in Listing~\ref{lst:shareview}. \begin{lstlisting}[label={lst:shareview},% caption={Bytecode view for \texttt{arith}}] -freshshare = get >>= \st=:{freshl=[fr:frs]}->put {st & freshl=frs} >>| pure fr +freshshare = get >>= \st=:{freshs}->put {st & freshs=freshs+1} >>| pure freshs instance sds ByteCode where sds f = {main = BC (freshshare