helicopter in presentation
[msc-thesis1617.git] / pres.system.tex
1 \subsection{Overview}
2 \begin{frame}
3 \frametitle{Solution}
4 \begin{block}{Downsides of the current mTask view}
5 \begin{itemize}
6 \item It all seems perfect
7 \item \ldots\pause{} but\ldots
8 \pause{}
9 \item No interaction
10 \item Compilation requires reprogramming
11 \end{itemize}
12 \end{block}
13 \pause{}
14 \begin{block}{Solution}
15 \begin{itemize}[<+->]
16 \item New bytecode backend for mTask
17 \item Interpreter on client
18 \item Server in iTasks with integration
19 \item No taskserver generation, onetime programming
20 \item Explicit SDS publishing
21 \end{itemize}
22 \end{block}
23 \end{frame}
24
25 \subsection{Extending mTask}
26 \begin{frame}[fragile]
27 \frametitle{Adding a View}
28 \begin{lstlisting}
29 :: ByteCode a p = BC (RWS () [BC] BCState ())
30 :: BC = BCNop | BCPush BCValue | ...
31 :: BCValue = E.e: BCValue e & mTaskType, TC e
32 :: BCShare = { sdsi :: Int, sdsval :: BCValue, sdsname :: String }
33 :: BCState = { freshl :: Int, freshs :: Int, sdss :: [BCShare] }
34
35 instance ByteCode arith, boolExpr, ...
36 \end{lstlisting}
37 \end{frame}
38
39 \begin{frame}[fragile]
40 \frametitle{Implementation}
41 \begin{itemize}
42 \item Writing instruction
43 \item Carrying state
44 \item Hand-crafted helpers
45 \end{itemize}
46 \begin{lstlisting}
47 op2 :: (ByteCode a p1) (ByteCode a p2) BC -> ByteCode b Expr
48 op2 (BC x) (BC y) bc = BC (x >>| y >>| tell [bc])
49
50 tell2 :: [BC] -> (ByteCode a p)
51 tell2 x = BC (tell x)
52
53 instance arith ByteCode where
54 lit x = tell2 [BCPush (BCValue x)]
55 (+.) x y = op2 x y BCDiv
56 ...
57 \end{lstlisting}
58 \end{frame}
59
60 \begin{frame}[fragile]
61 \frametitle{Control flow}
62 \begin{itemize}
63 \item Use labels
64 \item Label resolving
65 \pause{}
66 \item Thus no reuse
67 \end{itemize}
68 \pause{}
69 \begin{lstlisting}
70 :: BC = ... | BCLab Int | ...
71
72 freshlabel = get >>= \st=:{freshl}->put {st & freshl=freshl+1} >>| pure freshl
73
74 instance If ByteCode Stmt Stmt Stmt where If b t e = BCIfStmt b t e
75 ...
76 BCIfStmt (BC b) (BC t) (BC e) = BC (
77 freshlabel >>= \else->freshlabel >>= \endif->
78 b >>| tell [BCJmpF else] >>|
79 t >>| tell [BCJmp endif, BCLab else] >>|
80 e >>| tell [BCLab endif]
81 )
82 \end{lstlisting}
83 \end{frame}
84
85 \begin{frame}[fragile]
86 \frametitle{Functionality}
87 \begin{block}{SDS scope and naming}
88 \begin{itemize}
89 \item SDS is lost
90 \item State per device
91 \item Tasks are sent and gone
92 \item Save bandwidth
93 \end{itemize}
94 \pause{}
95 \begin{lstlisting}
96 class namedsds v where
97 namedsds :: ((v t Upd) -> In (Named t String) (Main (v c s)))
98 -> (Main (v c s)) | ...
99 :: Named a b = Named infix 1 a b
100
101 instance sdspub ByteCode where
102 pub (BC x) = BC (censor (\[BCSdsFetch s]->[BCSdsPublish s]) x)
103 \end{lstlisting}
104 \end{block}
105 \end{frame}
106
107 \begin{frame}[fragile]
108 \frametitle{Assignment}
109 \begin{lstlisting}
110 instance sds ByteCode where
111 sds f = {main = BC (freshshare
112 >>= \sdsi->pure {BCShare|sdsname="",sdsi=sdsi,sdsval=BCValue 0}
113 >>= \sds->pure (f (tell2 [BCSdsFetch sds]))
114 >>= \(v In bdy)->modify (addSDS sds v)
115 >>| unBC (unMain bdy))
116 }
117
118 instance assign ByteCode where
119 (=.) (BC v) (BC e) = BC (e >>| censor makeStore v)
120
121 makeStore [BCSdsFetch i] = [BCSdsStore i]
122 makeStore [BCDigitalRead i] = [BCDigitalWrite i]
123 makeStore [...] = [...]
124 \end{lstlisting}
125 \end{frame}
126 \begin{frame}[fragile]
127 \frametitle{Task scheduling}
128 \begin{block}{Old}
129 \begin{itemize}
130 \item Task server
131 \item Tasks start other tasks
132 \end{itemize}
133 \end{block}
134 \pause{}
135 \begin{block}{New}
136 \begin{itemize}
137 \item Old system, taskserver, tasks start tasks
138 \item New system, task+strategy
139 \pause{}
140 \begin{itemize}
141 \item \CI{OnShot}
142 \item \CI{OnInterval}
143 \item \CI{OnInterrupt}
144 \end{itemize}
145 \pause{}
146 \item How to handle termination
147 \end{itemize}
148 \pause{}
149 \begin{lstlisting}
150 class retrn v where
151 retrn :: v () Expr
152 \end{lstlisting}
153 \end{block}
154 \end{frame}
155
156 \subsection{Interpretation}
157 \begin{frame}[fragile]
158 \frametitle{mTask implementation}
159 %TODO
160 \end{frame}
161
162 \subsection{Devices}
163 \begin{frame}
164 \frametitle{Devices}
165 \begin{itemize}
166 \item Standard C
167 \item Implement some classes in interface
168 \pause{}
169 \item How to handle termination
170 \end{itemize}
171 \end{frame}
172
173 \subsection{Server}
174 \subsection{Examples}