Revisiting the DOS Memory Models
Modern compressed pointers and x32/x64 conventions
- Java’s pointer compression is discussed as analogous to old memory models: 32-bit references shifted to form 64-bit addresses.
- Commenters emphasize it’s not “wasted” alignment: object headers and atomicity already enforce alignment, and compressed oops are a major win up to ~32 GB heaps.
- x32 ABI (32-bit pointers on 64-bit kernels) is mentioned as an attempt at similar savings, but it saw little adoption and is now effectively deprecated.
- Some note you can still manually keep all code/data under 4 GB in 64‑bit mode and use 32‑bit pointers in non‑C environments.
8086 segmentation, address space, and elegance debates
- Several argue 8086’s overlapping segments and multiple pointer types are inelegant; others respond that it was a pragmatic tradeoff given cost, pin limits, and memory sizes of the era.
- Alternatives are proposed (non‑overlapping segments, combining two 16‑bit registers as a 32‑bit pointer, different selector layout on 286), but counterarguments focus on relocatability, wasted address space, and historical constraints.
- Comparisons are drawn with 68000 and PDP‑11; 8086 seen as cheaper and easier to reuse CP/M software.
- There’s discussion of RIP-relative addressing on x86‑64/RISC‑V and the need for indirection (GOT/PLT, large code models), with no fully “elegant” solution agreed upon.
DOS memory models, EMS/XMS, overlays, and tools
- Thread expands beyond the article to EMS/XMS, DPMI, unreal mode, DJGPP, and overlays; multiple people recall using different memory managers (QEMM, 386MAX, JEMM386, etc.).
- Overlays are highlighted as a key technique for large DOS apps, with examples from games and Turbo Pascal/Borland C support.
- Some note compact/large models were theoretically useful but often avoided in practice due to far‑pointer cost; many preferred small/medium plus manual
faruse.
Protected mode, segmentation today, and niche models
- On 32‑bit and 64‑bit Windows, segment registers mostly point to flat zero-based spaces, with FS/GS reserved for thread structures and TLS.
- Discussion of 286/386 selectors, descriptor tables, and a “missed opportunity” to lay out selector bits to yield a linear address space; reasons for Intel’s choice are debated and remain unclear.
- Zortech’s handle pointers and VCM are cited as compiler-level virtual memory schemes, compared to what could be done in WebAssembly with multi-memory and paging-like tricks.
Nostalgia and developer experience
- Many recall the complexity of CONFIG.SYS/AUTOEXEC.BAT juggling, TSRs, overlays, and tight memory budgets as both painful and fun.
- DJGPP and 32‑bit DOS extenders are remembered as a relief, simplifying pointers and enabling larger heaps and graphics buffers.