1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
---
header-includes:
- \usepackage{tikz}
---
# Nicht-preemptives Scheduling
a)
\begin{tikzpicture}
\draw[thick, <->] (0, 6) -- (0, 0) -- (9.5, 0);
\foreach \x in {1, 2, 3, 4, 5}
\draw[thick] (-1pt, \x) -- (1pt, \x) node [anchor=east] {$P_{\x}$};
\foreach \x in {0, ..., 18}
\draw[thick] ({\x / 2}, -1pt) -- ({\x / 2}, 1pt) node [anchor=north] {$\x$};
\draw[xstep=0.5, ystep=1, gray, very thin] (0, 5) grid (9, 0);
\draw[|-|] (0, 1) -- (1, 1);
\draw[|-|] (1, 2) -- (3, 2);
\draw[|-|, dashed] (1, 3) -- (3, 3);
\draw[|-|] (3, 3) -- (6.5, 3);
\draw[|-|, dashed] (2, 4) -- (6.5, 4);
\draw[|-|] (6.5, 4) -- (8, 4);
\draw[|-|, dashed] (2.5, 5) -- (8, 5);
\draw[|-|] (8, 5) -- (9, 5);
\end{tikzpicture}
b)
\begin{tikzpicture}
\draw[thick, <->] (0, 6) -- (0, 0) -- (9.5, 0);
\foreach \x in {1, 2, 3, 4, 5}
\draw[thick] (-1pt, \x) -- (1pt, \x) node [anchor=east] {$P_{\x}$};
\foreach \x in {0, ..., 18}
\draw[thick] ({\x / 2}, -1pt) -- ({\x / 2}, 1pt) node [anchor=north] {$\x$};
\draw[xstep=0.5, ystep=1, gray, very thin] (0, 5) grid (9, 0);
\draw[|-|] (0, 1) -- (1, 1);
\draw[|-|] (1, 2) -- (3, 2);
\draw[|-|, dashed] (1, 3) -- (5.5, 3);
\draw[|-|] (5.5, 3) -- (9, 3);
\draw[|-|, dashed] (2, 4) -- (4, 4);
\draw[|-|] (4, 4) -- (5.5, 4);
\draw[|-|, dashed] (2.5, 5) -- (3, 5);
\draw[|-|] (3, 5) -- (4, 5);
\end{tikzpicture}
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 FCFS und SJF.
\begin{align*}
\frac{\sum_{i = 1}^n W(P_n)}{5} &= \frac{0 + 0 + 4 + 9 + 11}{5} = \frac{24}{5} = 4.8 \\
\frac{\sum_{i = 1}^n V(P_n)}{5} &= \frac{2 + 4 + 11 + 12 + 14}{5} = \frac{43}{5} = 8.6
\\
\frac{\sum_{i = 1}^n W^\prime(P_n)}{5} &= \frac{0 + 0 + 9 + 4 + 1}{5} = \frac{14}{5} = 2.8 \\
\frac{\sum_{i = 1}^n V^\prime(P_n)}{5} &= \frac{2 + 4 + 16 + 7 + 3}{5} = \frac{35}{5} = 7
\end{align*}
d) Prozesse, die, laut Scheduler, lange Bedienzeiten haben verweilen sehr lange, da sie lange warten.
# Prozesse und Threads
a) running
b) *ein Prozess, kein Thread* wird als equivalent gesehen zu *kein Prozess*
c) Threads teilen sich innerhalb eines Prozesses einen Adressraum, Daten sind nicht *sicher*.
d) suspended
e) Zuordnung mehrer Treads eines Prozesses auf verschiedene Prozessoren
|