diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-12-09 16:54:21 +0100 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-12-09 16:54:21 +0100 |
| commit | da8c58f78b90736b028f265153a6d050f5b049f7 (patch) | |
| tree | 090682e6ebc5217032b03c7b453ea6110c8da8c1 | |
| parent | e8c39f8f4cd6037046fd360a8c0024718ec3b293 (diff) | |
| download | uni-da8c58f78b90736b028f265153a6d050f5b049f7.tar uni-da8c58f78b90736b028f265153a6d050f5b049f7.tar.gz uni-da8c58f78b90736b028f265153a6d050f5b049f7.tar.bz2 uni-da8c58f78b90736b028f265153a6d050f5b049f7.tar.xz uni-da8c58f78b90736b028f265153a6d050f5b049f7.zip | |
OSS - 08
| -rw-r--r-- | ws2015/oss/blaetter/08/abgabe.md | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/ws2015/oss/blaetter/08/abgabe.md b/ws2015/oss/blaetter/08/abgabe.md new file mode 100644 index 0000000..f216bb5 --- /dev/null +++ b/ws2015/oss/blaetter/08/abgabe.md | |||
| @@ -0,0 +1,150 @@ | |||
| 1 | --- | ||
| 2 | header-includes: | ||
| 3 | - \usepackage{tikz} | ||
| 4 | - \usepackage[ngerman]{babel} | ||
| 5 | --- | ||
| 6 | # Preemptives Scheduling | ||
| 7 | |||
| 8 | a) | ||
| 9 | |||
| 10 | \begin{figure}[!h] | ||
| 11 | \centering | ||
| 12 | \begin{tikzpicture} | ||
| 13 | \draw[thick, <->] (0, 6) -- (0, 0) -- (9.5, 0); | ||
| 14 | \foreach \x in {1, 2, 3, 4, 5} | ||
| 15 | \draw[thick] (-1pt, \x) -- (1pt, \x) node [anchor=east] {$P_{\x}$}; | ||
| 16 | \foreach \x in {0, ..., 18} | ||
| 17 | \draw[thick] ({\x / 2}, -1pt) -- ({\x / 2}, 1pt) node [anchor=north] {$\x$}; | ||
| 18 | |||
| 19 | \draw[xstep=0.5, ystep=1, gray, very thin] (0, 5) grid (9, 0); | ||
| 20 | |||
| 21 | \draw[|-|] (0, 1) -- (1, 1); | ||
| 22 | |||
| 23 | \draw[|-|] (1, 2) -- (3, 2); | ||
| 24 | |||
| 25 | \draw[|-|, dashed] (1, 3) -- (5.5, 3); | ||
| 26 | \draw[|-|] (5.5, 3) -- (9, 3); | ||
| 27 | |||
| 28 | \draw[|-|, dashed] (2, 4) -- (4, 4); | ||
| 29 | \draw[|-|] (4, 4) -- (5.5, 4); | ||
| 30 | |||
| 31 | \draw[|-|, dashed] (2.5, 5) -- (3, 5); | ||
| 32 | \draw[|-|] (3, 5) -- (4, 5); | ||
| 33 | \end{tikzpicture} | ||
| 34 | \caption{SRPT} | ||
| 35 | \label{fig:srpt} | ||
| 36 | \end{figure} | ||
| 37 | |||
| 38 | b) | ||
| 39 | |||
| 40 | \begin{figure}[!h] | ||
| 41 | \centering | ||
| 42 | \begin{tikzpicture} | ||
| 43 | \draw[thick, <->] (0, 6) -- (0, 0) -- (9.5, 0); | ||
| 44 | \foreach \x in {1, 2, 3, 4, 5} | ||
| 45 | \draw[thick] (-1pt, \x) -- (1pt, \x) node [anchor=east] {$P_{\x}$}; | ||
| 46 | \foreach \x in {0, ..., 18} | ||
| 47 | \draw[thick] ({\x / 2}, -1pt) -- ({\x / 2}, 1pt) node [anchor=north] {$\x$}; | ||
| 48 | |||
| 49 | \draw[xstep=0.5, ystep=1, gray, very thin] (0, 5) grid (9, 0); | ||
| 50 | |||
| 51 | \draw[|-|] (0, 1) -- (1, 1); | ||
| 52 | |||
| 53 | \draw[|-|, dashed] (1, 2) -- (6, 2); | ||
| 54 | \draw[|-|] (1, 2) -- (2, 2); | ||
| 55 | \draw[|-|] (5, 2) -- (6, 2); | ||
| 56 | |||
| 57 | \draw[|-|, dashed] (1, 3) -- (9, 3); | ||
| 58 | \draw[|-|] (2, 3) -- (3, 3); | ||
| 59 | \draw[|-|] (6, 3) -- (7, 3); | ||
| 60 | \draw[|-|] (7.5, 3) -- (9, 3); | ||
| 61 | |||
| 62 | \draw[|-|, dashed] (2, 4) -- (7.5, 4); | ||
| 63 | \draw[|-|] (3, 4) -- (4, 4); | ||
| 64 | \draw[|-|] (7, 4) -- (7.5, 4); | ||
| 65 | |||
| 66 | \draw[|-|, dashed] (2.5, 5) -- (4, 5); | ||
| 67 | \draw[|-|] (4, 5) -- (5, 5); | ||
| 68 | \end{tikzpicture} | ||
| 69 | \caption{RR} | ||
| 70 | \label{fig:rr} | ||
| 71 | \end{figure} | ||
| 72 | |||
| 73 | c) Es seien $W(P_n)$, $V(P_n)$, $W^\prime(P_n)$, und $V^\prime(P_n)$ die Wartezeit und die Verweilzeit des Prozesses $P_n$ für SRPT und RR. | ||
| 74 | |||
| 75 | \begin{align*} | ||
| 76 | \frac{\sum_{i = 1}^n W(P_n)}{5} &= \frac{0 + 0 + 9 + 4 + 1}{5} = \frac{14}{5} = 2.8 \\ | ||
| 77 | \frac{\sum_{i = 1}^n V(P_n)}{5} &= \frac{2 + 4 + 16 + 7 + 3}{5} = \frac{32}{5} = 6.4 | ||
| 78 | \\ | ||
| 79 | \frac{\sum_{i = 1}^n W^\prime(P_n)}{5} &= \frac{0 + 6 + 9 + 8 + 3}{5} = \frac{26}{5} = 5.2 \\ | ||
| 80 | \frac{\sum_{i = 1}^n V^\prime(P_n)}{5} &= \frac{2 + 10 + 16 + 11 + 5}{5} = \frac{44}{5} = 8.8 | ||
| 81 | \end{align*} | ||
| 82 | |||
| 83 | d) Ist die maximale Bedienzeit der Prozesse kleiner als die Zeitscheibe wird RR identisch zu FCFS. | ||
| 84 | |||
| 85 | # Prozessfortschrittsdiagramm | ||
| 86 | |||
| 87 | a) Wir bezeichnen mit $G_n$ das Erfassen des Betriebsmittels $n$ und mit $F_n$ das Freigeben des BM $n$. | ||
| 88 | |||
| 89 | \begin{figure}[!h] | ||
| 90 | \centering | ||
| 91 | \begin{tikzpicture} | ||
| 92 | \draw[thick, <->] (-0.25, 6.25) node [anchor=south] {$A$} -- (-0.25, -0.25) -- (5.25, -0.25) node [anchor=west] {$B$}; | ||
| 93 | \draw[step=0.5, gray, very thin] (-0.25,6) grid (5, -0.25); | ||
| 94 | |||
| 95 | \draw[thick] (0, -0.20) -- (0, -0.30) node[anchor=north] {$0$}; | ||
| 96 | \draw[thick] (-0.20, 0) -- (-0.30, 0) node[anchor=east] {$0$}; | ||
| 97 | |||
| 98 | \draw[thick] (2.5, -0.20) -- (2.5, -0.30) node[anchor=north] {$G_1$}; | ||
| 99 | \draw[thick] (4, -0.20) -- (4, -0.30) node[anchor=north] {$F_1$}; | ||
| 100 | |||
| 101 | \draw[thick] (2, -0.20) -- (2, -0.30) node[anchor=north] {$G_2$}; | ||
| 102 | \draw[thick] (3.5, -0.20) -- (3.5, -0.30) node[anchor=north] {$F_2$}; | ||
| 103 | |||
| 104 | \draw[thick] (0.5, -0.20) -- (0.5, -0.30) node[anchor=north] {$G_3$}; | ||
| 105 | \draw[thick] (1.5, -0.20) -- (1.5, -0.30) node[anchor=north] {$F_3$}; | ||
| 106 | |||
| 107 | \draw[thick] (-0.20, 1) -- (-0.30, 1) node[anchor=east] {$G_1$}; | ||
| 108 | \draw[thick] (-0.20, 3) -- (-0.30, 3) node[anchor=east] {$F_1$}; | ||
| 109 | |||
| 110 | \draw[thick] (-0.20, 2) -- (-0.30, 2) node[anchor=east] {$G_2$}; | ||
| 111 | \draw[thick] (-0.20, 3.5) -- (-0.30, 3.5) node[anchor=east] {$F_2$}; | ||
| 112 | |||
| 113 | \draw[thick] (-0.20, 0.5) -- (-0.30, 0.5) node[anchor=east] {$G_3$}; | ||
| 114 | \draw[thick] (-0.20, 1.5) -- (-0.30, 1.5) node[anchor=east] {$F_3$}; | ||
| 115 | |||
| 116 | \draw[thick] (2.5, 1) rectangle (4, 3); | ||
| 117 | \draw[thick] (2, 2) rectangle (3.5, 3.5); | ||
| 118 | \draw[thick] (0.5, 0.5) rectangle (1.5, 1.5); | ||
| 119 | |||
| 120 | \draw[thick, dashed] (2, 2) rectangle (2.5, 1); | ||
| 121 | |||
| 122 | \draw[->] (0, 0) -- (5, 0) -- (5, 3) node[anchor=west] {$p_1$} -- (5, 5.9); | ||
| 123 | \draw[->] (0, 0) -- (0, 6) -- (2.5, 6) node[anchor=south] {$p_2$} -- (4.9, 6); | ||
| 124 | |||
| 125 | \draw[dashed, ->] (0,0) -- (0.25, 0.25) -- (1.75, 0.25) -- (1.75, 3) node[anchor=east] {$p^\prime$} -- (1.75, 5.75) -- (4.75, 5.75) -- (4.9, 5.9); | ||
| 126 | \end{tikzpicture} | ||
| 127 | \caption{Prozessfortschrittsdiagramm} | ||
| 128 | \begin{minipage}{\textwidth} | ||
| 129 | \centering | ||
| 130 | \footnotesize | ||
| 131 | Wir bezeichnen mit \begin{tikzpicture}[baseline] \draw[thick] (0,0) rectangle (20pt, 6pt); \end{tikzpicture} unmögliche und mit \begin{tikzpicture}[baseline] \draw[thick, dashed] (0,0) rectangle (20pt, 6pt); \end{tikzpicture} unsichere Bereiche. | ||
| 132 | \end{minipage} | ||
| 133 | \label{fig:pfd} | ||
| 134 | \end{figure} | ||
| 135 | |||
| 136 | Es kann, wird der in Abbildung \ref{fig:pfd} mit einem gestrichelten Rechteck markierte Bereich *betreten* ein Deadlock auftreten. | ||
| 137 | |||
| 138 | b) Bei nicht-preemptiven Scheduling (Pfade $p_1$ und $p_2$ in Abbildung \ref{fig:pfd}) kann es nicht zu einem Deadlock kommen, da, sobald $B$ zur Ausführung kommt (O.b.d.a. wird $A$ zuerst ausgeführt), alle locks bereits released sind. | ||
| 139 | |||
| 140 | c) Bei preemptiven Scheduling können alle in Abbildung \ref{fig:pfd} eingezeichneten Pfade ($p_1$, $p_2$, und $p^\prime$) genommen werden. | ||
| 141 | |||
| 142 | Die Zahl der möglichen Pfade ist die Zahl der Zusammenhangskomponenten von $\{ (a, b) \ | \ a < 0 \land b < 0 \} \cap U \cap U^\prime$ wobei $U$ die Vereinigung aller Unmöglichen Bereiche und $U^\prime$ die Vereinigung aller Unsicheren Bereiche bezeichnet | ||
| 143 | |||
| 144 | # Scheduling | ||
| 145 | |||
| 146 | (a) Preemptive Scheduling | ||
| 147 | (b) Einhaltung von Fristen | ||
| 148 | (c) Ankunftszeit | ||
| 149 | (d) $\text{Verweildauer} = \text{Wartezeit} + \text{Bedienzeit}$ | ||
| 150 | (e) Shortest Remaining Processing Time (SRPT) | ||
