Skip to content

Commit

Permalink
render svg ty claude!
Browse files Browse the repository at this point in the history
Signed-off-by: Haile Lagi <[email protected]>
  • Loading branch information
hailelagi committed Dec 8, 2024
1 parent 79b0828 commit 193e74e
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions content/notes/block-layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,44 @@ Why a filesystem? It's **a key abstraction** we'll use to go spelunking into the
## Physical Layer
At the bottom, there must exist some _physical media_ which will hold these bits and bytes we conveniently call a block. It could be an HDD, SSD, [tape](https://aws.amazon.com/storagegateway/vtl/) or something else, [what interface does this physical media present?](https://pages.cs.wisc.edu/~remzi/OSTEP/file-devices.pdf) It's exposed over many _protocols_.

```
application/process (read/write)
|
POSIX (open, read, write, close)
|
(filesystem - files and directories) <-- yay!
|
Block Interface(read/write)
|
Device Drivers(specific read/write)
|
Physical Media (HDD/SSD - sector/page r/w)
```

This is a roughly sketch made for simplicity.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 350 430" style="font-family: Arial, sans-serif;">
<!-- Vertical Arrows -->
<line x1="125" y1="30" x2="125" y2="400" stroke="gray" stroke-width="2" marker-end="url(#arrowhead)"/>

<!-- Layers -->
<rect x="25" y="20" width="200" height="50" fill="#E6F2FF" stroke="black" rx="5"/>
<text x="125" y="40" text-anchor="middle" font-size="10" font-weight="bold">Application Process</text>
<text x="125" y="52" text-anchor="middle" font-size="8">(read/write)</text>

<rect x="25" y="90" width="200" height="50" fill="#CCE5FF" stroke="black" rx="5"/>
<text x="125" y="110" text-anchor="middle" font-size="10" font-weight="bold">POSIX</text>
<text x="125" y="122" text-anchor="middle" font-size="8">(open, read, write, close)</text>

<rect x="25" y="160" width="200" height="50" fill="#B3D9FF" stroke="black" rx="5"/>
<text x="125" y="180" text-anchor="middle" font-size="10" font-weight="bold">Filesystem</text>
<text x="125" y="192" text-anchor="middle" font-size="8">(files and directories) <- we're here!! </text>

<rect x="25" y="230" width="200" height="50" fill="#99CCFF" stroke="black" rx="5"/>
<text x="125" y="250" text-anchor="middle" font-size="10" font-weight="bold">Block Interface</text>
<text x="125" y="262" text-anchor="middle" font-size="8">(read/write)</text>

<rect x="25" y="300" width="200" height="50" fill="#80BFFF" stroke="black" rx="5"/>
<text x="125" y="320" text-anchor="middle" font-size="10" font-weight="bold">Device Drivers</text>
<text x="125" y="332" text-anchor="middle" font-size="8">(specific read/write)</text>

<rect x="25" y="370" width="200" height="50" fill="#66B3FF" stroke="black" rx="5"/>
<text x="125" y="390" text-anchor="middle" font-size="10" font-weight="bold">Physical Media</text>
<text x="125" y="402" text-anchor="middle" font-size="8">(HDD/SSD - sector/page r/w)</text>

<!-- Arrowhead Marker Definition -->
<defs>
<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="0" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="gray"/>
</marker>
</defs>
</svg>
This is a rough sketch made for simplicity.

An HDD exposes a "flat" address space to read or write, the smallest atomic unit is a sector (512-byte block) and flash based
SSDs expose a unit called a "page" which we can read or write higher level "chunks" of. [†1] to create a _file system abstraction_ over this **block interface**, what does it look like?
Expand Down

0 comments on commit 193e74e

Please sign in to comment.