From 81d05d6012218b29b13b00e2d9ab47ac419291f2 Mon Sep 17 00:00:00 2001
From: Camil Staps
Date: Thu, 8 Oct 2015 21:46:12 +0200
Subject: Assignment 6

---
 assignment6/assignment6.tex | 60 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 assignment6/assignment6.tex

(limited to 'assignment6/assignment6.tex')

diff --git a/assignment6/assignment6.tex b/assignment6/assignment6.tex
new file mode 100644
index 0000000..245ff90
--- /dev/null
+++ b/assignment6/assignment6.tex
@@ -0,0 +1,60 @@
+\documentclass[10pt,a4paper]{article}
+
+\usepackage[margin=2cm]{geometry}
+\usepackage{pdfpages}
+
+% 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}
+\usepackage{mathtools}
+
+\usepackage{enumitem}
+\setenumerate[1]{label=\alph*.}
+\setenumerate[2]{label=(\roman*)}
+
+\parindent0pt
+
+\title{Operating Systems - assignment 6}
+\author{Camil Staps\\\small{s4498062}}
+
+\begin{document}
+
+\maketitle
+\thispagestyle{fancy}
+
+\section*{8.1}
+\begin{enumerate}
+    \item Given a virtual address $a$ with page and offset $a=(p,o)$ we find entry $p$ in the page table. This gives a page frame number $f$. We then take the physical address $f\cdot 1024 + o$.
+    \item \begin{enumerate}
+            \item Entry $1$ gives frame $7$. This gives us $7\cdot1024 + 052 = 7220$.
+            \item Entry $2$ does not correspond to a frame, so this address is invalid.
+            \item Entry $5$ gives frame $0$. This gives us $0\cdot1024 + 499 = 499$.
+        \end{enumerate}
+\end{enumerate}
+
+\section*{8.2}
+\begin{enumerate}
+    \item The \texttt{j} variable doesn't generate page faults because for all $n$ all $A[n,i]$ are in the same page (and the same for $B$ and $C$). The \texttt{i} variable generates page faults every four iterations, and then for every array. This gives us a total of $\frac34$ page faults per addition executed.
+    \item Yes, the indices should be swapped (e.g. $C[j,i]$ instead of $C[i,j]$).
+    \item Every four iterations of $j$, that is, $16$ per array or $48$ in total. That gives a frequency of $48/64^2 = \frac3{256} \approx 0.0117$. 
+\end{enumerate}
+
+\section*{8.4}
+See the next page.
+
+I don't count the first three references. The optimal algorithm has $6$ page faults over $17$ references, which is approximately $35\%$. The FIFO algorithm has $10$ page faults on the same number of references, approximately $59\%$. The LRU algorithm has $7$ page faults, approximately $41\%$.
+
+\includepdf{exercise-8-4.pdf}
+
+\end{document}
+
-- 
cgit v1.2.3

