blob: 06070a44f7b32064c634220e193af71bc5303967 (
plain) (
blame)
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
|
\documentclass[10pt,a4paper]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{minted}
\usepackage{enumitem}
\setenumerate[1]{label=\alph*.}
% textcomp package is not available everywhere, and we only need the Copyright symbol
% taken from http://tex.stackexchange.com/a/1677/23992
\DeclareTextCommandDefault{\textregistered}{\textcircled{\check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}}
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhead{}
\fancyfoot[C]{Copyright {\textcopyright} 2015 Camil Staps}
\pagestyle{fancy}
\usepackage{amsmath}
\usepackage{amsfonts}
\parindent0pt
\title{Operating Systems - assignment 3}
\author{Camil Staps\\\small{s4498062}}
\begin{document}
\maketitle
\thispagestyle{fancy}
\section*{5.16}
Suppose two processes $p_1,p_2$ each call \texttt{semWait(s)} when $s=0$. Suppose further that $p_1$ executes until \texttt{semWaitB(delay)}, after which $p_2$ gains control and does the same. Both processes will set \texttt{mutex} to one, and both processes are placed in the delay queue when executing \texttt{semWaitB(delay)}. Unless there are other processes running simultaneously, these processes will never get a signal to stop waiting for \texttt{delay}.
Swapping the lines \texttt{semSignalB(mutex)} and \texttt{semWaitB(delay)} would ensure that this doesn't happen.
\section*{5.18}
The passenger doesn't necessarily get out of the car he gets in to.
For example, passengers $p_1,p_2$ may take cars $c_1,c_2$ respectively. Then suppose $c_2$ finishes driving around. It can happen that $p_1$ then continues walking around, while actually he got in to $c_1$.
\end{document}
|