diff options
-rwxr-xr-x | gup/pdf.gup | 2 | ||||
-rw-r--r-- | shell.nix | 8 | ||||
-rw-r--r-- | ws2015/EiP/blaetter/03/H3-1.md | 39 | ||||
-rw-r--r-- | ws2015/EiP/blaetter/03/H3-2.md | 84 | ||||
-rw-r--r-- | ws2015/EiP/blaetter/03/H3-3.md | 33 | ||||
-rw-r--r-- | ws2015/EiP/blaetter/03/manifest | 3 | ||||
-rw-r--r-- | ws2015/betriebssysteme/blaetter/04/abgabe.md | 38 | ||||
-rw-r--r-- | ws2015/datenbanksysteme/blaetter/04/abgabe.md | 15 |
8 files changed, 218 insertions, 4 deletions
diff --git a/gup/pdf.gup b/gup/pdf.gup index 9b6749e..5a4588b 100755 --- a/gup/pdf.gup +++ b/gup/pdf.gup | |||
@@ -3,4 +3,4 @@ | |||
3 | gup -u ${2%.pdf}.md | 3 | gup -u ${2%.pdf}.md |
4 | 4 | ||
5 | pandoc -t latex -o $2 -V "geometry=margin=2cm" -V "fontfamily=libertine" ${2%.pdf}.md >&2 | 5 | pandoc -t latex -o $2 -V "geometry=margin=2cm" -V "fontfamily=libertine" ${2%.pdf}.md >&2 |
6 | touch $2 | 6 | [[ -e $2 ]] && touch $2 |
@@ -3,8 +3,7 @@ | |||
3 | 3 | ||
4 | pkgs.stdenv.mkDerivation rec { | 4 | pkgs.stdenv.mkDerivation rec { |
5 | name = "uni-env"; | 5 | name = "uni-env"; |
6 | buildInputs = [ pkgs.haskellPackages.pandoc | 6 | buildInputs = [ pkgs.gup |
7 | pkgs.gup | ||
8 | pkgs.jdk | 7 | pkgs.jdk |
9 | pkgs.zip | 8 | pkgs.zip |
10 | pkgs.strace | 9 | pkgs.strace |
@@ -12,8 +11,11 @@ pkgs.stdenv.mkDerivation rec { | |||
12 | (pkgs.callPackage ./mars.nix {}) | 11 | (pkgs.callPackage ./mars.nix {}) |
13 | pkgs.sqlite | 12 | pkgs.sqlite |
14 | (pkgs.haskellPackages.ghcWithPackages (p: | 13 | (pkgs.haskellPackages.ghcWithPackages (p: |
15 | with p; [ yesod yesod-bin | 14 | with p; [ yesod yesod-bin pandoc |
16 | ])) | 15 | ])) |
16 | (pkgs.texlive.combine { | ||
17 | inherit (pkgs.texlive) scheme-small libertine tipa cm-super context bussproofs mweights fontaxes; | ||
18 | }) | ||
17 | ]; | 19 | ]; |
18 | shellHook = '' | 20 | shellHook = '' |
19 | export PROMPT_INFO="${name}" | 21 | export PROMPT_INFO="${name}" |
diff --git a/ws2015/EiP/blaetter/03/H3-1.md b/ws2015/EiP/blaetter/03/H3-1.md new file mode 100644 index 0000000..bb3d2ca --- /dev/null +++ b/ws2015/EiP/blaetter/03/H3-1.md | |||
@@ -0,0 +1,39 @@ | |||
1 | --- | ||
2 | header-includes: | ||
3 | - \usepackage{bussproofs} | ||
4 | - \renewcommand{\implies}{\rightarrow} | ||
5 | - \EnableBpAbbreviations | ||
6 | --- | ||
7 | # Hoare-Tripel II | ||
8 | |||
9 | d) | ||
10 | |||
11 | \begin{prooftree} | ||
12 | \AXC{$\forall \phi \ldotp \phi \implies \phi$} | ||
13 | \UIC{$(0 < n + 1 \land n < m) \implies (0 < n + 1 \land n < m)$} | ||
14 | \RightLabel{Umformung} | ||
15 | \UIC{$(0 < n + 1 \land n < m) \implies (0 < n + 1 \land n \leq m - 1)$} | ||
16 | \RightLabel{Umformung} | ||
17 | \UIC{$(0 < n + 1 \land n < m) \implies (0 < n + 1 \land n + 1 \leq m)$} | ||
18 | \RightLabel{Zuweisung} | ||
19 | \UIC{$ \{ 0 < n + 1 \land n < m \} $ \texttt{n = n + 1} $ \{ 0 < n \land n \leq m \} $} | ||
20 | \end{prooftree} | ||
21 | |||
22 | e) Nimm als Gegenbeispiel: | ||
23 | |||
24 | ~~~ | ||
25 | a = -1 | ||
26 | b = 0 | ||
27 | ~~~ | ||
28 | |||
29 | f) Seit $\phi$ die Nachfolgerfunktion auf $\mathbb{N}$. | ||
30 | |||
31 | \begin{prooftree} | ||
32 | \AXC{$\forall n \in \mathbb{N} \ldotp \phi(n) > n$} | ||
33 | \UIC{$1 > 0$} | ||
34 | \UIC{$((x + 1) + y > x + y)$} | ||
35 | \UIC{$(z = x + y) \implies ((x + 1) + y > z)$} | ||
36 | \UIC{$ \{ z = x + y \} $ \texttt{ x = x + 1} $ \{ x + y > z \} $} | ||
37 | \UIC{$ \{ z = x + y \land z \equiv 0 \mod 2 \} $ \texttt{x = x + 1} $ \{ x + y > z \} $ \quad $ \{ z = x + y \land z \equiv 1 \mod 2 \} $ \texttt{x = x + 1} $ \{ x + y > z \} $} | ||
38 | \UIC{$ \{ z = x + y \} $ \texttt{if (z \% 2 == 0) x = x + 1; else y = y + 1;} $ \{ x + y > z \} $} | ||
39 | \end{prooftree} | ||
diff --git a/ws2015/EiP/blaetter/03/H3-2.md b/ws2015/EiP/blaetter/03/H3-2.md new file mode 100644 index 0000000..62d8fc2 --- /dev/null +++ b/ws2015/EiP/blaetter/03/H3-2.md | |||
@@ -0,0 +1,84 @@ | |||
1 | --- | ||
2 | header-includes: | ||
3 | - \usepackage{bussproofs} | ||
4 | - \renewcommand{\implies}{\rightarrow} | ||
5 | - \EnableBpAbbreviations | ||
6 | --- | ||
7 | # Hoare-Logik: While-Schleife II | ||
8 | |||
9 | | Schleifendurchlauf | \texttt{n} | \texttt{a} | \texttt{b} | \texttt{c} | | ||
10 | |--------------------+------------+------------+------------+------------| | ||
11 | | 0 | 5 | 0 | 0 | 1 | | ||
12 | | 1 | 5 | 1 | 1 | 7 | | ||
13 | | 2 | 5 | 8 | 2 | 19 | | ||
14 | | 3 | 5 | 27 | 3 | 37 | | ||
15 | | 4 | 5 | 64 | 4 | 61 | | ||
16 | | 5 | 5 | 125 | 5 | 91 | | ||
17 | |||
18 | Wir bezeichnen mit $P'$: | ||
19 | |||
20 | ~~~ | ||
21 | a = a + c | ||
22 | b = b + 1 | ||
23 | c = c + 6*b | ||
24 | ~~~ | ||
25 | |||
26 | Wir bezeichnen mit $J$: | ||
27 | |||
28 | ~~~ | ||
29 | a = 0 | ||
30 | b = 0 | ||
31 | c = 1 | ||
32 | ~~~ | ||
33 | |||
34 | und setzen $J'$ derart, dass $\{\} J \{J'\}$ gültig ist. | ||
35 | |||
36 | Wir bezeichnen zudem mit $\bar P$: | ||
37 | |||
38 | ~~~ | ||
39 | while (b != n) { | ||
40 | a = a + c | ||
41 | b = b + 1 | ||
42 | c = c + 6*b | ||
43 | } | ||
44 | ~~~ | ||
45 | |||
46 | Es sei zudem $I = (c = (b + 1)^3 - b^3)$. | ||
47 | |||
48 | \begin{prooftree} | ||
49 | \AXC{$ 1 = (0 + 1)^3 - 0 $} | ||
50 | \UIC{$ (a, b, c) = (0, 0, 1) \implies c = ( b + 1 )^3 - b^3$} | ||
51 | \UIC{$J' \implies I$} | ||
52 | \end{prooftree} | ||
53 | |||
54 | \begin{prooftree} | ||
55 | \AXC{$0 = 0$} | ||
56 | \RightLabel{Algebraische Umformung} | ||
57 | \UIC{$(b + 1)^3 - b^3 + 6 \cdot (b + 1) = (b + 2)^3 - (b + 1)^3$} | ||
58 | \UIC{$c = ( b + 1 )^3 - b^3 \implies c + 6 \cdot (b + 1) = (b + 2)^3 - (b + 1)^3$} | ||
59 | \UIC{$\{c = ( b + 1 )^3 - b^3 \land b \neq n \}$ $P'$ $\{ c = (b + 1)^3 - b^3 \}$} | ||
60 | \UIC{$\{ I \land b \}$ $P'$ $ \{ I \} $} | ||
61 | \end{prooftree} | ||
62 | |||
63 | \begin{prooftree} | ||
64 | \AXC{$J' \implies I$} | ||
65 | \AXC{$\{I \land b\}$ $P'$ $\{ I \}$} | ||
66 | \AXC{$I \land b = n \implies a = n^3$} | ||
67 | \TIC{$ \{ n > 0 \land J' \} $ $ \bar P $ $ \{ a = n^3 \} $} | ||
68 | \end{prooftree} | ||
69 | |||
70 | Es bleibt zu zeigen, dass $a(n) = n^3$. | ||
71 | Es gilt wegen $P'$ und $J$: | ||
72 | \begin{align*} | ||
73 | c(0) &= 1 \\ | ||
74 | c(k) &= c(k - 1) + 6 \cdot k \\ | ||
75 | &= 1 + \sum_{i = 0}^{k} 6i \\ | ||
76 | a(0) &= 0 \\ | ||
77 | a(k) &= a(k - 1) + c(k - 1) \\ | ||
78 | &= a(k - 1) + 1 + \sum_{i = 0}^{k - 1} 6i \\ | ||
79 | &= \sum_{j = 0}^{k} \left ( 1 + \sum_{i = 0}^{j - 1} 6i \right ) \\ | ||
80 | &= k + \sum_{j = 0}^{k} \sum_{i = 0}^{j - 1} 6i \\ | ||
81 | &= k + \sum_{j = 0}^{k} \left ( 3j (j - 1) \right ) \\ | ||
82 | &= k + \left ( k^3 - k \right ) \\ | ||
83 | &= k^3 | ||
84 | \end{align*} | ||
diff --git a/ws2015/EiP/blaetter/03/H3-3.md b/ws2015/EiP/blaetter/03/H3-3.md new file mode 100644 index 0000000..ca9fbd8 --- /dev/null +++ b/ws2015/EiP/blaetter/03/H3-3.md | |||
@@ -0,0 +1,33 @@ | |||
1 | # Code Verständnis | ||
2 | |||
3 | | Zeile | Zuweisung | | ||
4 | |-------+-----------| | ||
5 | | 010 | x = 42 | | ||
6 | | 030 | y = 36 | | ||
7 | | 070 | z = 1 | | ||
8 | | 080 | z = 2 | | ||
9 | | 090 | z = 3 | | ||
10 | | 100 | y = 39 | | ||
11 | | 120 | z = 6 | | ||
12 | | 070 | z = 1 | | ||
13 | | 080 | z = 2 | | ||
14 | | 090 | z = 3 | | ||
15 | | 100 | y = 42 | | ||
16 | | 120 | z = 6 | | ||
17 | | 230 | x = 53 | | ||
18 | | 240 | z = 0 | | ||
19 | | 250 | x = 57 | | ||
20 | | 260 | y = 36 | | ||
21 | | 270 | z = 1 | | ||
22 | | 240 | z = 1 | | ||
23 | | 250 | x = 61 | | ||
24 | | 260 | y = 37 | | ||
25 | | 270 | z = 2 | | ||
26 | | 240 | z = 2 | | ||
27 | | 250 | x = 65 | | ||
28 | | 260 | y = 39 | | ||
29 | | 270 | z = 3 | | ||
30 | | 240 | z = 3 | | ||
31 | | 250 | x = 69 | | ||
32 | | 260 | y = 42 | | ||
33 | | 270 | z = 4 | | ||
diff --git a/ws2015/EiP/blaetter/03/manifest b/ws2015/EiP/blaetter/03/manifest new file mode 100644 index 0000000..ff79ea4 --- /dev/null +++ b/ws2015/EiP/blaetter/03/manifest | |||
@@ -0,0 +1,3 @@ | |||
1 | H3-1.pdf | ||
2 | H3-2.pdf | ||
3 | H3-3.pdf \ No newline at end of file | ||
diff --git a/ws2015/betriebssysteme/blaetter/04/abgabe.md b/ws2015/betriebssysteme/blaetter/04/abgabe.md new file mode 100644 index 0000000..94578c5 --- /dev/null +++ b/ws2015/betriebssysteme/blaetter/04/abgabe.md | |||
@@ -0,0 +1,38 @@ | |||
1 | # 5-Zustands-Prozessmodell | ||
2 | |||
3 | a) | ||
4 | i) Übergang von *blocked* zu *running* wird nur via *ready* realisiert, da der Scheduler bereits periodisch Prozesse aus *ready* aufweckt. | ||
5 | Zusätzlich auch noch den jeweiligen Prozess aufzuwecken wäre schlicht unnötig. | ||
6 | ii) Fordert ein Prozess E/A-Resourcen an, so wird er nach *blocked* verschoben bis die jeweilige E/A-Operation per Unterbrechung bekannt macht, dass der Vorgang abgeschlossen ist. | ||
7 | iii) Ein Prozess, der nicht läuft, kann keine E/A-Resource anfordern. | ||
8 | b) | ||
9 | (i) *new* → *ready* | ||
10 | ~ Ein Nutzer hat seine Shell angewiesen `Hello World!` auszugeben, diese forkt um später `/bin/echo` aufzurufen. | ||
11 | |||
12 | *ready* → *running* | ||
13 | ~ Der Shell-Prozess ruft `wait` auf den soeben gespawnten Prozess auf und wird daher *blocked*. | ||
14 | Der Scheduler entscheidet nun zum Kindprozess zu wechseln. | ||
15 | |||
16 | *running* → *ready* | ||
17 | ~ `/bin/echo` hat nicht innerhalb der switching-Frequenz des Schedulers terminiert. | ||
18 | Der Scheduler verschiebt `/bin/echo` in *ready* und wechselt zu einem anderen Prozess. | ||
19 | |||
20 | *running* → *blocked* | ||
21 | ~ `/bin/echo` ist dynamisch gelinkt und möchte eine library von der Festplatte lesen. | ||
22 | Es setzt einen Syscall ab und wartet auf das Ergebnis. | ||
23 | |||
24 | *blocked* → *ready* | ||
25 | ~ Die Festplatte fängt an einen Stream von bytes zu schicken. | ||
26 | Der Scheduler fängt die Unterbrechung ab und verschiebt `/bin/echo` nach *ready* | ||
27 | |||
28 | *running* → *exit* | ||
29 | ~ `/bin/echo` terminiert. | ||
30 | (ii) *new*. Prozesse werden im reinen batch-betrieb nicht dynamisch erzeugt. | ||
31 | |||
32 | # Prozesse | ||
33 | |||
34 | a) Kontext | ||
35 | b) Uniprogramming | ||
36 | c) 13.3 min | ||
37 | d) `fork` | ||
38 | e) Scheduler | ||
diff --git a/ws2015/datenbanksysteme/blaetter/04/abgabe.md b/ws2015/datenbanksysteme/blaetter/04/abgabe.md new file mode 100644 index 0000000..708a249 --- /dev/null +++ b/ws2015/datenbanksysteme/blaetter/04/abgabe.md | |||
@@ -0,0 +1,15 @@ | |||
1 | --- | ||
2 | header-includes: | ||
3 | - \usepackage{amsmath} | ||
4 | - \usepackage{amssymb} | ||
5 | --- | ||
6 | |||
7 | # Natural Join | ||
8 | |||
9 | Zu $\land$. | ||
10 | |||
11 | # Anfragen in relationaler Algebra | ||
12 | |||
13 | a) $\pi_{\texttt{P.pname}}(\sigma_{\texttt{P.ort} = \text{Berlin}}(\texttt{P}))$ | ||
14 | b) $\pi_{\texttt{T.tnr}} \left ( \sigma_{\texttt{L.lname} = \text{Meier}} \left ( \texttt{L} \bowtie \texttt{LTP} \texttt{T} \right ) \right )$ | ||
15 | c) $\pi_{\texttt{T.tname}}(\sigma_{\texttt{P.ort} = \text{Berlin}}(\texttt{P} \bowtie \texttt{LTP} \bowtie \texttt{T}))$ | ||