From 6341ffed114bcc1cc2febaf936515f85e6cc30a2 Mon Sep 17 00:00:00 2001 From: bhuvy Date: Wed, 31 Jul 2019 12:34:10 -0500 Subject: [PATCH] Adding list of figures and tables with table captions and centering --- filesystems/filesystems.tex | 16 ++++++++++++++++ ipc/ipc.tex | 10 ++++++++++ main.tex | 14 ++++---------- scheduling/scheduling.tex | 10 ++++++++++ signals/signals.tex | 3 +++ synchronization/synchronization.tex | 18 ++++++++++++++++++ title.tex | 19 +++++++++++++++++-- 7 files changed, 78 insertions(+), 12 deletions(-) diff --git a/filesystems/filesystems.tex b/filesystems/filesystems.tex index 8d3c712..20acec0 100644 --- a/filesystems/filesystems.tex +++ b/filesystems/filesystems.tex @@ -28,23 +28,29 @@ The *iB family is short for power of two storage. That means the following: \begin{center} +\begin{table}[h] +\caption{Kibibyte Values} \begin{tabular}{ | c | c | } Prefix & Byte Value \\ \hline KiB & 1024B \\ MiB & 1024 * 1024 B \\ GiB & 1024\^3 B \end{tabular} +\end{table} \end{center} The standard notational prefixes mean the following: \begin{center} +\begin{table}[h] +\caption{Kilobyte Values} \begin{tabular}{ | c | c | } Prefix & Byte Value \\ \hline KB & 1000B \\ MB & 1000 * 1000 B \\ GB & 1000\^3 B \end{tabular} +\end{table} \end{center} We will do this in the book and in the Networking chapter for the sake of consistency and to not confuse anyone. @@ -602,11 +608,16 @@ Here are the bit conventions: \item \keyword{x} means that the set of people can execute \end{enumerate} +\begin{center} +\begin{table}[h] +\caption{Permissions Table} \begin{tabular}{|c|c|c|c|} Octal Code & User & Group & Others \\ \hline 755 & \keyword{rwx} & \keyword{r-x} & \keyword{r-x} \\ 644 & \keyword{rw-} & \keyword{r--} & \keyword{r--} \end{tabular} +\end{table} +\end{center} It is worth noting that the \keyword{rwx} bits have a slightly different meaning for directories. Write access to a directory that will allow a program to create or delete new files or directories inside. @@ -783,12 +794,17 @@ POSIX systems, such as Linux and Mac OS X (which is based on BSD) include severa Files inside these virtual filesystems may be generated dynamically or stored in ram. Linux provides 3 main virtual filesystems. +\begin{center} +\begin{table}[h] +\caption{Virtual Filesystem list} \begin{tabular}{ | c | c | } Device & Use Case \\ \hline \keyword{/dev} & A list of physical and virtual devices (for example network card, cdrom, random number generator \\ \keyword{/proc} & A list of resources used by each process and (by tradition) set of system information \\ \keyword{/sys} & An organized list of internal kernel entities \end{tabular} +\end{table} +\end{center} If we want a continuous stream of 0s, we can run \keyword{cat /dev/zero}. diff --git a/ipc/ipc.tex b/ipc/ipc.tex index 188e57d..4918be8 100644 --- a/ipc/ipc.tex +++ b/ipc/ipc.tex @@ -887,6 +887,9 @@ This may never print hello because of a race condition. Since a program opened the pipe in the first process under both permissions, open won't wait for a reader because the program told the operating system that it is a reader! Sometimes it looks like it works because the execution of the code looks something like this. +\begin{center} +\begin{table}[h] +\caption{Fine Pipe Access Pattern} \begin{tabular}{|c|c|c|} & Process 1 & Process 2 \\ \hline Time 1 & open(O\_RDWR) \& write() & \\ @@ -894,15 +897,22 @@ Sometimes it looks like it works because the execution of the code looks somethi Time 3 & close() \& exit() & \\ Time 4 & print() \& exit() & \\ \end{tabular} +\end{table} +\end{center} But here is an invalid series of operations that cause a race condition. +\begin{center} +\begin{table}[h] +\caption{Pipe Race Condition} \begin{tabular}{|c|c|c|} & Process 1 & Process 2 \\ \hline Time 1 & open(O\_RDWR) \& write() & \\ Time 2 & close() \& exit() & \\ Time 3 & & open(O\_RDONLY) (Blocks Indefinitely) \\ \end{tabular} +\end{table} +\end{center} \section{Files} diff --git a/main.tex b/main.tex index 28c55bf..d790f27 100644 --- a/main.tex +++ b/main.tex @@ -75,25 +75,19 @@ \csname iffalse\endcsname \fi -\ifepub -\include{github_redefinitions} -\usepackage{filecontents} -\begin{filecontents}{title.tex} -%% These are not the droids you are looking for -\end{filecontents} -\fi - \begin{document} \raggedbottom %% The title so that it isn't included in the chapters +%% Introduction, background, then the book starts +\setcounter{chapter}{0} +\frontmatter \include{title} \fancyhf{} -%% Introduction, background, then the book starts -\setcounter{chapter}{-2} +\mainmatter \input{order.tex} %% Add glossaries back in when a number of terms have been defined diff --git a/scheduling/scheduling.tex b/scheduling/scheduling.tex index d5889c2..08b3c24 100644 --- a/scheduling/scheduling.tex +++ b/scheduling/scheduling.tex @@ -368,6 +368,9 @@ We will be evaluating this in the context of a random process timing, meaning th Just a refresher, here are the terms. +\begin{center} +\begin{table}[h] +\caption{Scheduling Variables} \begin{tabular}{|c|c|} Concept & Meaning \\ \hline Start time & The time the scheduler first started work \\ @@ -375,15 +378,22 @@ Just a refresher, here are the terms. Arrival time & When the job first arrived at the scheduler \\ Run time & How long does the process take to run if there is no preemption \end{tabular} +\end{table} +\end{center} And here are the measures we are trying to optimize. +\begin{center} +\begin{table}[h] +\caption{Scheduling Measures of Efficiency} \begin{tabular}{|c|c|} Measure & Formula \\ \hline Response Time & Start time minus Arrival time\\ Turnaround time & End time minus Arrival time\\ Wait time & End time minus Arrival time minus Run time \\ \end{tabular} +\end{table} +\end{center} Different use cases will be discussed after. Let the maximum amount of time that a process run be equal to $S$. diff --git a/signals/signals.tex b/signals/signals.tex index a33b373..af92c47 100644 --- a/signals/signals.tex +++ b/signals/signals.tex @@ -65,6 +65,8 @@ Here are some common signals that you will see thrown around. \\ \begin{center} +\begin{table}[h] +\caption{POSIX Signals} \begin{tabular}{|c|c|c|} Name & Portable Number & Default Action & Usual Use \\ \hline SIGINT & 2 & Terminate (Can be caught) & Stop a process nicely \\ @@ -74,6 +76,7 @@ SIGSTOP & N/A & Stop Process (Cannot be caught) & Suspends a process \\ SIGCONT & N/A & Continues a process & Starts after a stop \\ SIGKILL & 9 & Terminate Process (Cannot be caught) & You want the process gone \end{tabular} +\end{table} \end{center} \\ diff --git a/synchronization/synchronization.tex b/synchronization/synchronization.tex index 13d33c7..887722b 100644 --- a/synchronization/synchronization.tex +++ b/synchronization/synchronization.tex @@ -52,6 +52,8 @@ A few of the possible different orderings are below. Permissible Pattern \\ \begin{center} +\begin{table}[h] +\caption{Good Thread Access Pattern} \begin{tabular}{ l | r } Thread 1 & Thread 2 \\ \hline Load Addr, Add 1 (i=1 locally) & ... \\ @@ -59,29 +61,36 @@ Permissible Pattern ... & Load Addr, Add 1 (i=2 locally) \\ ... & Store (i=2 globally) \\ \end{tabular} +\end{table} \end{center} \\ Partial Overlap \\ \begin{center} +\begin{table}[h] +\caption{Bad Thread Access Pattern} \begin{tabular}{ l | r } Thread 1 & Thread 2 \\ \hline Load Addr, Add 1 (i=1 locally) & ... \\ Store (i=1 globally) & Load Addr, Add 1 (i=1 locally) \\ ... & Store (i=1 globally) \\ \end{tabular} +\end{table} \end{center} \\ Full Overlap \\ \begin{center} +\begin{table}[h] +\caption{Horrible Thread Access Pattern} \begin{tabular}{ l | r } Thread 1 & Thread 2 \\ \hline Load Addr, Add 1 (i=1 locally) & Load Addr, Add 1 (i=1 locally) \\ Store (i=1 globally) & Store (i=1 globally) \\ \end{tabular} +\end{table} \end{center} \\ We would like the first pattern of the code being mutually exclusive. @@ -595,6 +604,8 @@ pthread_cond_signal(cv); \\ \begin{center} +\begin{table}[h] +\caption{Signaling without Mutex} \begin{tabular}{|c|c|} Thread 1 & Thread 2 \\ \hline while(answer < 42) & \\ @@ -602,6 +613,7 @@ pthread_cond_signal(cv); & pthread\_cond\_signal(cv) \\ pthread\_cond\_wait(cv) \end{tabular} +\end{table} \end{center} \\ The problem here is that a programmer expects the signal to wake up the waiting thread. @@ -1149,12 +1161,15 @@ Suppose two threads wish to enter the critical section at the same time. \\ \begin{center} +\begin{table}[h] +\caption{Candidate Solution \#2 Analysis} \begin{tabular}{|l|c|c|} Time & Thread 1 & Thread 2 \\ \hline 1 & Raise Flag & \\ 2 & & Raise Flag \\ 3 & Wait & Wait \\ \end{tabular} +\end{table} \end{center} \\ @@ -1209,6 +1224,8 @@ The second thread can immediately continue into the Critical Section! \\ \begin{center} +\begin{table}[h] +\caption{Candidate Solution \#4} \begin{tabular}{|l|l|l|l|} Time & Turn & Thread \# 1 & Thread \# 2 \\ \hline 1 & 2 & Raise my flag & \\ @@ -1216,6 +1233,7 @@ Time & Turn & Thread \# 1 & Thread \# 2 \\ \hline 3 & 2 & // Do Critical Section Stuff & If your flag is raised, wait until my turn (TRUE!) \\ 4 & 2 & // Do Critical Section Stuff & Do Critical Section Stuff - OOPS \\ \end{tabular} +\end{table} \end{center} \\ diff --git a/title.tex b/title.tex index 4772ea1..17b4972 100644 --- a/title.tex +++ b/title.tex @@ -44,11 +44,26 @@ \restoregeometry % restores the geometry \nopagecolor% Use this to restore the color pages to white +\newpage + \ifepub % No droids \else -\setcounter{secnumdepth}{1} -\setcounter{tocdepth}{1} +\setcounter{secnumdepth}{2} +\setcounter{tocdepth}{2} + +\newpage \tableofcontents + +\newpage + +\listoffigures + +\newpage + +\listoftables + +\newpage + \fi