Skip to content

Commit

Permalink
Adding list of figures and tables with table captions and centering
Browse files Browse the repository at this point in the history
  • Loading branch information
bhuvy2 committed Jul 31, 2019
1 parent 8dccb0b commit 6341ffe
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 12 deletions.
16 changes: 16 additions & 0 deletions filesystems/filesystems.tex
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,29 @@ \chapter{Filesystems}
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.
Expand Down Expand Up @@ -602,11 +608,16 @@ \section{Permissions and bits}
\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.
Expand Down Expand Up @@ -783,12 +794,17 @@ \section{Virtual filesystems and other filesystems}
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}.

Expand Down
10 changes: 10 additions & 0 deletions ipc/ipc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -887,22 +887,32 @@ \subsection{Race condition with named pipes}
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() & \\
Time 2 & & open(O\_RDONLY) \& read() \\
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}

Expand Down
14 changes: 4 additions & 10 deletions main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions scheduling/scheduling.tex
Original file line number Diff line number Diff line change
Expand Up @@ -368,22 +368,32 @@ \section{Extra: Scheduling Conceptually}

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 \\
End time & When the scheduler finished the process \\
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$.
Expand Down
3 changes: 3 additions & 0 deletions signals/signals.tex
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ \section{The Deep Dive of Signals}

\\
\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 \\
Expand All @@ -74,6 +76,7 @@ \section{The Deep Dive of Signals}
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}
\\

Expand Down
18 changes: 18 additions & 0 deletions synchronization/synchronization.tex
Original file line number Diff line number Diff line change
Expand Up @@ -52,36 +52,45 @@ \chapter{Synchronization}
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) & ... \\
Store (i=1 globally) & ... \\
... & 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.
Expand Down Expand Up @@ -595,13 +604,16 @@ \subsection{Extra: Why do Condition Variables also need a mutex?}

\\
\begin{center}
\begin{table}[h]
\caption{Signaling without Mutex}
\begin{tabular}{|c|c|}
Thread 1 & Thread 2 \\ \hline
while(answer < 42) & \\
& answer++ \\
& 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.
Expand Down Expand Up @@ -1149,12 +1161,15 @@ \subsection{Naive Solutions}

\\
\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}
\\

Expand Down Expand Up @@ -1209,13 +1224,16 @@ \subsection{Turn and Flag solutions}

\\
\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 & \\
2 & 2 & If your flag is raised, wait until my turn & Raise my flag \\
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}
\\

Expand Down
19 changes: 17 additions & 2 deletions title.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6341ffe

Please sign in to comment.