1.1 --- a/doc-isac/mlehnfeld/master/thesis/appendix_a.tex Wed Jul 23 14:09:51 2014 +0200
1.2 +++ b/doc-isac/mlehnfeld/master/thesis/appendix_a.tex Wed Jul 23 14:32:19 2014 +0200
1.3 @@ -27,20 +27,20 @@
1.4 \>fun fib n = fib' (n - 1) |> snd \textrm{,}}
1.5 \noindent
1.6 shows linear runtime behavior. Annotations (section \ref{sec:annot}) were demonstrated using the Fibonacci function (page \pageref{alg:parannot}):
1.7 -\imlcode{~~\=fu\=n fib 0 = 1\\
1.8 +\imlcode{~~\=fu\=n fib 0 = 0\\
1.9 \>\>| fib 1 = 1\\
1.10 \>\>| fib x = fib (x - 1) + par (fib (x - 2))}
1.11 \noindent
1.12 In practice, the gain from parallelism in this example would not just be marginal, the overhead for managing parallel execution would most likely result in a performance worse than the sequential version. Note that annotations of this kind can only work in a programming language following a lazy evaluation strategy because in an eager language like \textit{Standard ML} the annotated expression would be evaluated before being passed to the hypothetical {\tt par} evaluation.
1.13 Futures have been discussed in detail throughout this thesis (sections \ref{sec:futurespro}, \ref{sec:actors_scala}, \ref{sec:csp}, \ref{sec:isafut}). The example on page \pageref{alg:futures} redefined {\tt fib} with a future:
1.14 \imlcode{\label{alg:fib-futures}
1.15 -~~\=fu\=n \=fi\=b \=0 = 1\\
1.16 +~~\=fu\=n \=fi\=b \=0 = 0\\
1.17 \>\>| fib 1 = 1\\
1.18 \>\>| fib x = let\\
1.19 \>\>\>\>\>fun fib' () = fib (x - 2)\\
1.20 \>\>\>\>\>val fibf = Future.fork fib'\\
1.21 \>\>\>\>in fib (x - 1) + (Future.join fibf) end}
1.22 -This code does work in {\em Isabelle/ML} (section \ref{sec:isabelleml}). The performance concerns we saw with the previous example also apply here: in practice, parallelising the evaluation of the Fibonacci function in this way makes no sense.
1.23 +This code does work in {\em Isabelle/ML} (section \ref{sec:isabelleml}). The performance concerns we saw with the previous example also apply here: in practice, parallelizing the evaluation of the Fibonacci function in this way makes no sense.
1.24
1.25
1.26 \section{{\tt merge\_lists} implementation}