\documentclass[
	solutions,
	hidewarning,
	singlenumbering,
	nopagenumber
]{../../resources/ormc_handout}
\usepackage{../../resources/macros}



\usepackage{tikz}


\title{The Sysadmin's Warm-Up}
\subtitle{Prepared by \githref{Mark} on \today}


\begin{document}

	\maketitle


	Most of you have seen a hard drive. Many have touched one, and a lucky few have poked around inside one. These devices have two interesting properties:

	\begin{enumerate}
		\item They hold valuable data
		\item They eventually fail
	\end{enumerate}

	Needless to say, this is a problem. \par
	We need to design a system that allows hard drives to fail without data loss.

	\definition{}
	You can think of a hard drive as a long string of bits. \par
	Assume all hard drives can store 1 TiB of data.

	\begin{center}
	\begin{tikzpicture}

		\node[above] at (1/2, 0) {Drive A};
		\draw (0cm, 0cm) -- (0cm, -3cm);
		\draw (1cm, 0cm) -- (1cm, -3cm);
		\foreach \i in {0,...,-6} {
			\draw (0cm,\i cm / 2) -- (1cm ,\i cm / 2);
		}

		\node at (1/2, - 1 / 4) {1};
		\node at (1/2, - 3 / 4) {1};
		\node at (1/2, - 5 / 4) {0};
		\node at (1/2, - 7 / 4) {...};
		\node at (1/2, - 9 / 4) {1};
		\node at (1/2, -11 / 4) {0};


		\node[above] at (5/2, 0) {Drive B};
		\draw (2cm, 0cm) -- (2cm, -3cm);
		\draw (3cm, 0cm) -- (3cm, -3cm);
		\foreach \i in {0,...,-6} {
			\draw (2cm,\i cm / 2) -- (3cm ,\i cm / 2);
		}

		\node at (5/2, - 1 / 4) {0};
		\node at (5/2, - 3 / 4) {1};
		\node at (5/2, - 5 / 4) {0};
		\node at (5/2, - 7 / 4) {...};
		\node at (5/2, - 9 / 4) {0};
		\node at (5/2, -11 / 4) {1};
	\end{tikzpicture}
	\end{center}

	\problem{}
	Suppose we have two hard drives. How can we arrange our data so that...
	\begin{enumerate}
		\item We get 1 TiB of usable storage
		\item We lose no data if any one drive fails
	\end{enumerate}

	\vfill

	\problem{}
	Suppose we have three hard drives. How can we arrange our data so that...
	\begin{enumerate}
		\item We get 2 TiB of usable storage
		\item We lose no data if any one drive fails
	\end{enumerate}

	\vfill
\end{document}