I'm teaching operating systems course and I have to create many "process/memory map/inode table" structures for the course. For those who don't know (not sure if any of them would be here), See the figure below:
I can create the outer box and place it properly using TikZ but what would be the most efficient way of creating the different table boxes so that I can reuse them again and again in all the figures.
Update: After the rectangle split
tip in the comments, I have the following:
\begin{tikzpicture}
\usetikzlibrary{shapes, positioning}
\node [draw, rectangle split=3, text width=2cm] (p1) {};
\node [left=12pt of p1, rectangle split=3, font=\tiny] {256
\nodepart {second} 255
\nodepart {third} \vdots
\nodepart {fourth} 0
};
\node [draw, rectangle split=3, text width=2cm, right=1cm of p1] (p2) {};
\node[above=12pt of p1, text width=2cm, font=\tiny, text centered] (p1l) {Per Process File Descriptor Table};
\node[above=12pt of p2, text width=2cm, font=\tiny, text centered] (p1l) {File Table};
\end{tikzpicture}
It produces the following output:
A couple of issues though:
- How do I make the arrows?
- The numbering on the left of the first table doesn't really match the splits in the table.
- How do I make some boxes bigger?
Also, is this the best way to do this? Seems like the code should be clean-able a little bit more.
Best Answer
Further automation is certainly possible (
foreach
tweaks, label placement, using atikzstyle
definition for allmatrix
nodes instead of repeating etc. ) but I think you can furnish it more properly anyway.Update: Added a matrix node style. You only need to input the matrices.