From 92aea44cb7dd0a7995327d2f276563b8058afbc9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 11 Nov 2026 12:00:42 -0300 Subject: design: the address space to true scale, magnified beside itself (a draft) From the user: the view's worth is the feel of the space's size, with its ends in the picture. The whole user half is one rectangle to linear scale, the mappings hairlines where they are, and what cannot be read is enlarged beside it with the magnification's lines and its factor. The mocks are rough: lines through labels, the program's bands unnamed. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- design/mock/30-intro-words-480.png | Bin 43111 -> 39749 bytes design/mock/30-intro-words.png | Bin 230085 -> 200634 bytes design/mock/30-intro-words.svg | 368 ++++++++++++++++--------------------- design/mock/34-segments.png | Bin 113202 -> 102844 bytes design/mock/34-segments.svg | 368 ++++++++++++++++--------------------- design/mock/35-segments-abc.png | Bin 0 -> 137096 bytes design/mock/35-segments-abc.svg | 314 +++++++++++++++++++++++++++++++ design/mock/intro.py | 122 +++++++++++- 8 files changed, 748 insertions(+), 424 deletions(-) create mode 100644 design/mock/35-segments-abc.png create mode 100644 design/mock/35-segments-abc.svg (limited to 'design/mock') diff --git a/design/mock/30-intro-words-480.png b/design/mock/30-intro-words-480.png index 4156b0a..04aa7d5 100644 Binary files a/design/mock/30-intro-words-480.png and b/design/mock/30-intro-words-480.png differ diff --git a/design/mock/30-intro-words.png b/design/mock/30-intro-words.png index 463726e..987e33d 100644 Binary files a/design/mock/30-intro-words.png and b/design/mock/30-intro-words.png differ diff --git a/design/mock/30-intro-words.svg b/design/mock/30-intro-words.svg index 267a344..3231e34 100644 --- a/design/mock/30-intro-words.svg +++ b/design/mock/30-intro-words.svg @@ -167,216 +167,164 @@ - -ffffffffffffffff - - - ---x -[vsyscall] -4 KiB -ffffffffff600000 - - - - -nothing mapped · 15 EiB - - - -rw- -[stack] -132 KiB -7ffffffde000 - - - - -nothing mapped · 127 MiB - - - -rw- -data (anonymous) -4 KiB -7ffff7ffe000 - - - -rw- -data -4 KiB -7ffff7ffd000 - - - -r-- -read-only -8 KiB -7ffff7ffb000 - - - -r-- -read-only -60 KiB -7ffff7fec000 - - - -r-x -code -180 KiB -7ffff7fbf000 - - - -r-- -read-only -4 KiB -7ffff7fbe000 - - - -r-x -[vdso] -8 KiB -7ffff7fbc000 - - - -r-- -[vvar] -24 KiB -7ffff7fb6000 - - - -r-- -read-only -260 KiB -7ffff7f75000 - - - -rw- -data (anonymous) -20 KiB -7ffff7f70000 - - - - -nothing mapped · 1.3 MiB - - - -rw- -data (anonymous) -32 KiB -7ffff7e1b000 - - - -rw- -data -8 KiB -7ffff7e19000 - - - -r-- -read-only -16 KiB -7ffff7e15000 - - - -r-- -read-only -472 KiB -7ffff7d9f000 - - - -r-x -code -1.5 MiB -7ffff7c24000 - - - -r-- -read-only -144 KiB -7ffff7c00000 - - - - -nothing mapped · 127 TiB - - - -rw- -[heap] -132 KiB -1004000 - - - -rw- -data -4 KiB -1003000 - - - -r-- -read-only -4 KiB -1002000 - - - -r-x -code -4 KiB -1001000 - - - - -r-- -read-only -4 KiB -1000000 - - - -ld.so - - - -ld.so.cache - - - -libc.so.6 - - - -list -0 - - - - -rsp - -the address space -high addresses on top · not to scale: holes 40, bands by the log of their size - + + + +0 TiB + +16 TiB + +32 TiB + +48 TiB + +64 TiB + +80 TiB + +96 TiB + +112 TiB + +128 TiB + + + + + + + + + + + + + + + + + + + + + + +0x7fffffffffff · the user half's end +0 +above: 16 EiB not canonical, then the kernel's half + + + +0 MiB + +32 MiB + +64 MiB + +96 MiB + +128 MiB + +160 MiB + +192 MiB + +224 MiB + +256 MiB + + + + + + + + + + + + + + + + + + + +the top 256 MiB · × 500 000 + + + +0 MiB + +1 MiB + +2 MiB + +3 MiB + +4 MiB + + + + + + +r-x ld.so +180 KiB + + + + + +r-- ld.so.cache +260 KiB + + + + + + +r-- libc.so.6 +472 KiB + + +r-x libc.so.6 +1.5 MiB + + +r-- libc.so.6 +144 KiB + + +the libraries, 4 MiB · × 32 + + + +0 MiB + +4 MiB + +8 MiB + +12 MiB + +16 MiB + +20 MiB + + + + + + + + +the bottom 20 MiB · × 7 000 000 + +rw- [stack] 132 KiB, rsp in it: a hairline even here + + Eight bytes make a word, stored low byte first: read right to left, this one is 10018b0, an address in the code, so it takes code's ink. diff --git a/design/mock/34-segments.png b/design/mock/34-segments.png index 03d26db..62e1c3c 100644 Binary files a/design/mock/34-segments.png and b/design/mock/34-segments.png differ diff --git a/design/mock/34-segments.svg b/design/mock/34-segments.svg index 5c5505b..c37a4d4 100644 --- a/design/mock/34-segments.svg +++ b/design/mock/34-segments.svg @@ -1,213 +1,163 @@ -ffffffffffffffff - - - ---x -[vsyscall] -4 KiB -ffffffffff600000 - - - - -nothing mapped · 15 EiB - - - -rw- -[stack] -132 KiB -7ffffffde000 - - - - -nothing mapped · 127 MiB - - - -rw- -data (anonymous) -4 KiB -7ffff7ffe000 - - - -rw- -data -4 KiB -7ffff7ffd000 - - - -r-- -read-only -8 KiB -7ffff7ffb000 - - - -r-- -read-only -60 KiB -7ffff7fec000 - - - -r-x -code -180 KiB -7ffff7fbf000 - - - -r-- -read-only -4 KiB -7ffff7fbe000 - - - -r-x -[vdso] -8 KiB -7ffff7fbc000 - - - -r-- -[vvar] -24 KiB -7ffff7fb6000 - - - -r-- -read-only -260 KiB -7ffff7f75000 - - - -rw- -data (anonymous) -20 KiB -7ffff7f70000 - - - - -nothing mapped · 1.3 MiB - - - -rw- -data (anonymous) -32 KiB -7ffff7e1b000 - - - -rw- -data -8 KiB -7ffff7e19000 - - - -r-- -read-only -16 KiB -7ffff7e15000 - - - -r-- -read-only -472 KiB -7ffff7d9f000 - - - -r-x -code -1.5 MiB -7ffff7c24000 - - - -r-- -read-only -144 KiB -7ffff7c00000 - - - - -nothing mapped · 127 TiB - - - -rw- -[heap] -132 KiB -1004000 - - - -rw- -data -4 KiB -1003000 - - - -r-- -read-only -4 KiB -1002000 - - - -r-x -code -4 KiB -1001000 - - - -r-- -read-only -4 KiB -1000000 - - - -ld.so - - - -ld.so.cache - - - -libc.so.6 - - - -list -0 - - - - -rsp - -rip - -the address space -high addresses on top · not to scale: holes 40, bands by the log of their size + + + +0 TiB + +16 TiB + +32 TiB + +48 TiB + +64 TiB + +80 TiB + +96 TiB + +112 TiB + +128 TiB + + + + + + + + + + + + + + + + + + + + + + +0x7fffffffffff · the user half's end +0 +above: 16 EiB not canonical, then the kernel's half + + + +0 MiB + +32 MiB + +64 MiB + +96 MiB + +128 MiB + +160 MiB + +192 MiB + +224 MiB + +256 MiB + + + + + + + + + + + + + + + + + + + +the top 256 MiB · × 500 000 + + + +0 MiB + +1 MiB + +2 MiB + +3 MiB + +4 MiB + + + + + + +r-x ld.so +180 KiB + + + + + +r-- ld.so.cache +260 KiB + + + + + + +r-- libc.so.6 +472 KiB + + +r-x libc.so.6 +1.5 MiB + + +r-- libc.so.6 +144 KiB + + +the libraries, 4 MiB · × 32 + + + +0 MiB + +4 MiB + +8 MiB + +12 MiB + +16 MiB + +20 MiB + + + + + + + +the bottom 20 MiB · × 7 000 000 + +rw- [stack] 132 KiB, rsp in it: a hairline even here + + +If this space were as tall as the Eiffel Tower, all the program has mapped would +be thinner than a hair: the stack a third of a micron, at the very top. diff --git a/design/mock/35-segments-abc.png b/design/mock/35-segments-abc.png new file mode 100644 index 0000000..482baff Binary files /dev/null and b/design/mock/35-segments-abc.png differ diff --git a/design/mock/35-segments-abc.svg b/design/mock/35-segments-abc.svg new file mode 100644 index 0000000..9c0c154 --- /dev/null +++ b/design/mock/35-segments-abc.svg @@ -0,0 +1,314 @@ + + + +A +true scale, then magnified: the recommended + + + +0 TiB + +16 TiB + +32 TiB + +48 TiB + +64 TiB + +80 TiB + +96 TiB + +112 TiB + +128 TiB + + + + + + + + + + + + + + + + + + + + + + +0x7fffffffffff · the user half's end +0 +above: 16 EiB not canonical, then the kernel's half + + + +0 MiB + +32 MiB + +64 MiB + +96 MiB + +128 MiB + +160 MiB + +192 MiB + +224 MiB + +256 MiB + + + + + + + + + + + + + + + + + + + +the top 256 MiB · × 500 000 + + + +0 MiB + +1 MiB + +2 MiB + +3 MiB + +4 MiB + + + + + + +r-x ld.so +180 KiB + + + + + +r-- ld.so.cache +260 KiB + + + + + + +r-- libc.so.6 +472 KiB + + +r-x libc.so.6 +1.5 MiB + + +r-- libc.so.6 +144 KiB + + +the libraries, 4 MiB · × 32 + + + +0 MiB + +4 MiB + +8 MiB + +12 MiB + +16 MiB + +20 MiB + + + + + + + +the bottom 20 MiB · × 7 000 000 + +rw- [stack] 132 KiB, rsp in it: a hairline even here + + +B +one long strip of powers of ten, left to right + + + +0 TiB + +32 TiB + +64 TiB + +96 TiB + +128 TiB + + + + + + + + + + + + + + + + + + + + + + +128 TiB + + + +0 MiB + +32 MiB + +64 MiB + +96 MiB + +128 MiB + +× 1 000 000 + + + + + +0 MiB + +1 MiB + +2 MiB + +3 MiB + +4 MiB + + + + + + + + + + + + + + + + +× 32 + + + + + +0 KiB + +32 KiB + +64 KiB + +96 KiB + +128 KiB + +the stack × 30 + + +C +true scale alone, distances written + + + +0 TiB + +16 TiB + +32 TiB + +48 TiB + +64 TiB + +80 TiB + +96 TiB + +112 TiB + +128 TiB + + + + + + + + + + + + + + + + + + + + + + + +the stack, 132 KiB, a hairline at the top + +the libraries, 4 MiB, 127 MiB below it + +the program and its heap, 0.2 MiB, 16 MiB above 0 +127 TiB of nothing between + diff --git a/design/mock/intro.py b/design/mock/intro.py index 098455c..a0684fd 100644 --- a/design/mock/intro.py +++ b/design/mock/intro.py @@ -150,11 +150,124 @@ def segments(g, x, y, hot=(), rsp=None, rip=None, label_x=None): return yy +TOP = 0x800000000000 # the user half's end: 0x00007fffffffffff + 1, 128 TiB + + +def ink_of(lo, perm, name): + return STACK if name == "[stack]" else HEAP if name == "[heap]" else INK[perm] + + +def bar(g, x, y, w, h, lo, hi, unit, step, labels=False, label_x=None, hot=()): + """`segments` at one level: the stretch lo..hi to a linear scale, high on top, its ruler on the left in + `unit` every `step`, each mapping where it is, a hairline (1 unit) when that is all it comes to.""" + yof = lambda a: y + h - (a - lo) / (hi - lo) * h + g.rect(x, y, w, h, PAGE) + g.frame(x, y, w, h, DIM, 2) + n = (hi - lo) // step + for k in range(int(n) + 1): + a = lo + k * step + yy = yof(a) + g.rect(x - 8, yy - 1, 8, 2, FAINT) + if k % max(int(n) // 8, 1) == 0 or k == n: + g.t(x - 12, yy + 6, "%d %s" % (k * step // unit, {1 << 40: "TiB", 1 << 30: "GiB", 1 << 20: "MiB", + 1 << 10: "KiB"}[unit]), 18, FAINT, "sans", "end") + for lo_, hi_, perm, name in MAPPINGS: + if hi_ <= lo or lo_ >= hi: + continue + a, z = max(lo_, lo), min(hi_, hi) + y0, y1 = yof(z), yof(a) + ink = ink_of(lo_, perm, name) + g.rect(x + 2, y0, w - 4, max(y1 - y0, 1), ink if y1 - y0 < 3 else mix(ink, PAGE, 0.35)) + if lo_ in hot: + g.frame(x - 2, y0 - 3, w + 4, max(y1 - y0, 1) + 6, READ, 2) + if labels and y1 - y0 >= 6: + g.path(f"M{x + w + 4},{(y0 + y1) / 2} H{label_x - 6}", RULE, 2) + g.t(label_x, (y0 + y1) / 2 + 7, "%s %s" % (perm, name or "anonymous"), 18, VELLUM, "sans") + g.t(label_x + 200, (y0 + y1) / 2 + 7, size(hi_ - lo_), 18, FAINT, "sans") + return yof + + +def magnify(g, yof, x0, lo, hi, x1, y1, h1): + """The lines of a magnification: from the stretch's two ends on one level to the next level's corners.""" + g.path(f"M{x0},{yof(hi)} L{x1},{y1}", RULE, 2) + g.path(f"M{x0},{yof(lo)} L{x1},{y1 + h1}", RULE, 2) + + +def treatment_a(g, x, y, H, wide=False, hot=()): + """A: the whole user half to true scale, then two magnifications of its two clusters, then the libraries.""" + yof = bar(g, x, y, 60, H, 0, TOP, 1 << 40, 16 << 40) + g.t(x - 12, y - 30, "0x7fffffffffff · the user half's end", 18, DIM, "sans") + g.t(x - 12, y + H + 26, "0", 18, DIM, "sans") + g.t(x - 12, y - 52, "above: 16 EiB not canonical, then the kernel's half", 18, FAINT, "sans") + # the top cluster: the libraries and the stack, the last 128 MiB of the user half + t_lo, t_hi = TOP - (256 << 20), TOP + X2 = x + 240 + y2 = bar(g, X2, y, 60, H * 0.45, t_lo, t_hi, 1 << 20, 32 << 20, hot=hot) + magnify(g, yof, x + 60, t_lo, t_hi, X2, y, H * 0.45) + g.t(X2, y - 8, "the top 256 MiB · × 500 000", 18, DIM, "sans") + # the libraries: 4 MiB of them, with names + l_lo, l_hi = 0x7ffff7c00000, 0x7ffff8000000 + X3 = X2 + 300 + y3 = bar(g, X3, y, 60, H * 0.45, l_lo, l_hi, 1 << 20, 1 << 20, labels=True, label_x=X3 + 80, hot=hot) + magnify(g, y2, X2 + 60, l_lo, l_hi, X3, y, H * 0.45) + g.t(X3, y - 8, "the libraries, 4 MiB · × 32", 18, DIM, "sans") + # the bottom cluster: the program and its heap, the first 20 MiB + b_lo, b_hi = 0, 20 << 20 + yb = y + H * 0.55 + y4 = bar(g, X2, yb, 60, H * 0.45, b_lo, b_hi, 1 << 20, 4 << 20, labels=True, label_x=X2 + 80, hot=hot) + magnify(g, yof, x + 60, b_lo, b_hi, X2, yb, H * 0.45) + g.t(X2, yb - 8, "the bottom 20 MiB · × 7 000 000", 18, DIM, "sans") + # the stack, its 132 KiB, in the top magnification's level: its label there + sy = y2(0x7ffffffff000) + g.path(f"M{X2 + 64},{sy + 2} L{X2 + 120},{y + H * 0.45 + 30}", RULE, 2) + g.t(X2 + 124, y + H * 0.45 + 36, "rw- [stack] 132 KiB, rsp in it: a hairline even here", 18, VELLUM, "sans") + gen.arrow(g, [(X2 + 30, sy + 4), (X2 + 30, sy + 26)], BRIGHT, 2, hl=8, hw=8) + return yof + + def frame_space(name): - """Mock 34: the rectangle alone, every label reading.""" + """Mock 34: treatment A at full size: the whole user half to scale, and magnified into its clusters.""" gen.W, gen.H = 1920, 1080 g = Svg() - segments(g, 560, 110, rsp=RSP, rip=0x1001926, label_x=760) + treatment_a(g, 200, 100, 760) + gen.caption(g, [[("If this space were as tall as the Eiffel Tower, all the program has mapped would",)], + [("be thinner than a hair: the stack a third of a micron, at the very top.",)]]) + g.save(name) + + +def sheet_abc(name): + """Mock 35: three treatments of physicality, on the list recording's mappings.""" + gen.W, gen.H = 2880, 1000 + g = Svg() + for k, (t, sub) in enumerate([("A", "true scale, then magnified: the recommended"), + ("B", "one long strip of powers of ten, left to right"), + ("C", "true scale alone, distances written")]): + x0 = 80 + k * 960 + g.t(x0, 50, t, 44, GOLD, "sansb") + g.t(x0 + 50, 50, sub, 22, VELLUM, "sans") + if t == "A": + treatment_a(g, x0 + 120, 130, 760) + elif t == "B": + levels = [(0, TOP, 1 << 40, 32 << 40, "128 TiB"), (TOP - (128 << 20), TOP, 1 << 20, 32 << 20, "× 1 000 000"), + (0x7ffff7c00000, 0x7ffff8000000, 1 << 20, 1 << 20, "× 32"), + (0x7ffffffde000, 0x7ffffffff000, 1 << 10, 32 << 10, "the stack × 30")] + prev = None + for j, (lo, hi, u, st_, lab) in enumerate(levels): + xx = x0 + 70 + j * 210 + f = bar(g, xx, 130, 50, 760, lo, hi, u, st_) + g.t(xx, 120, lab, 18, DIM, "sans") + if prev: + magnify(g, prev[0], prev[1] + 50, lo, hi, xx, 130, 760) + prev = (f, xx) + else: + yof = bar(g, x0 + 150, 130, 80, 760, 0, TOP, 1 << 40, 16 << 40) + for a, txt in [(0x7ffffffde000, "the stack, 132 KiB, a hairline at the top"), + (0x7ffff7c00000, "the libraries, 4 MiB, 127 MiB below it"), + (0x1000000, "the program and its heap, 0.2 MiB, 16 MiB above 0")]: + yy = yof(a) + g.path(f"M{x0 + 236},{yy} H{x0 + 300}", RULE, 2) + g.t(x0 + 306, yy + 6 + (20 if a == 0x7ffff7c00000 else 0), txt, 18, VELLUM, "sans") + g.t(x0 + 306, 500, "127 TiB of nothing between", 22, FAINT, "sans") g.save(name) @@ -208,9 +321,7 @@ def frame_words(name): g.frame(12 * A + 12 + 8 * 30 + 24 - 6, ys[k] - 1, 7 * A + 12, ROW + 2, READ, 2) g.o.append("") g.o.append('') - g.o.append('') # the stage holds it whole above the caption - segments(g, 200, 0, hot={0x1001000}, rsp=RSP, label_x=380) - g.o.append("") + treatment_a(g, 1060, 110, 740, hot={0x1001000}) g.o.append("") gen.caption(g, [[("Eight bytes make a word, stored low byte first: read right to left,",)], [("this one is ",), ("10018b0", "mono"), (", an address in the code, so it takes code's ink.",)]]) @@ -322,3 +433,4 @@ if __name__ == "__main__": frame_code("32-intro-code") frame_aligned("33-aligned") frame_space("34-segments") + sheet_abc("35-segments-abc") -- cgit v1.3