Paging

Paging is a memory management method that divides the virtual address space of a process into -byte sized blocks called pages, and the physical memory (RAM) into blocks of the same size called page frames. This process requires a -bit offset, which indexes through the page frame. During the process:

  1. Each -bit virtual address is split into the offset ( least significant bits), and an -byte virtual page number (VPN), which is used to index through the page table, and find the desired PTE:
\begin{document}
\begin{tikzpicture}
   % Draw the inner boxes for Metadata
   \draw[thick, fill=darkgray] (-.5,3) rectangle (3,4) node[midway] {VPN};
   
   % Draw the inner boxes for Data
   \draw[thick] (3,3) rectangle (5,4) node[midway, align=center] {Offset};
   
   % Add offset numbers
   \node at (-.5, 4.25) {$N-1$};
   \node at (3, 4.25) {$\log_2(K)-1$};
   \node at (5, 4.25) {0};
\end{tikzpicture}
\end{document}
  1. Each -bit physical address is split into the same offset, and an -byte physical page number (PPN), used as the starting index of the page frame.
\begin{document}
\begin{tikzpicture}
   % Draw the inner boxes for Metadata
   \draw[thick, fill=darkgray] (-.5,3) rectangle (3,4) node[midway] {PPN};
   
   % Draw the inner boxes for Data
   \draw[thick] (3,3) rectangle (5,4) node[midway, align=center] {Offset};
   
   % Add offset numbers
   \node at (-.5, 4.25) {$M-1$};
   \node at (3, 4.25) {$\log_2(K)-1$};
   \node at (5, 4.25) {0};
\end{tikzpicture}
\end{document}
 

Examples

Example