% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
	nosolutions,
	singlenumbering,
	nopagenumber
]{ormc_handout}

\usepackage{tikz}

\begin{document}

	\maketitle
		{The Sysadmin's Warm-Up}
		{Prepared by Mark on \today}


	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. \\
	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. \\
	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 can store 1 TiB of data
		\item We lose no data when 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 can store 2 TiB of data
		\item We lose no data when any one drive fails
	\end{enumerate}

	\vfill

	\problem{}
	Suppose we have five hard drives. How can we arrange our data so that...
	\begin{enumerate}
		\item We can store 3 TiB of data
		\item We lose no data when any two drives fail
	\end{enumerate}

	\vfill

	\problem{}
	Can you write a general solution to this problem?

	\vfill
\end{document}