Linear Address Spaces: Unsafe at any speed
&gt; Why do we even have linear physical and virtual addresses in the first place, when pretty much everything today is object-oriented?<p>Well, GPU code is certainly not object-oriented, and I hope it never becomes that. SIMD code won&#x27;t be able to jump between objects like typical CPU-oriented OOP does (unless all objects within a warp&#x2F;workgroup jump to the same function pointers?)<p>GPU code is common in video games. DirectX needs to lay out its memory very specifically as you write out the triangles and other vertex&#x2F;pixel data for the GPU to later process. This memory layout is then memcopy&#x27;d over to PCIe using the linear address space mechanism, and GPUs are now cohesive with this space (thanks to Shared Virtual Memory).<p>So today, thanks to shared virtual memory and advanced atomics, we can have atomic compare-and-swap coordinate CPU and GPU code operating over the same data (and copies of that data can be cached in CPU-ram or GPU-VRAM and transferred over automatically with PCIe memory barriers and whatnot).<p>----------<p>Similarly, shared linear address spaces operate over rDMA (remote direct memory access), a protocol built on top of Ethernet. This means that your linear memory space is mmap&#x27;d on your CPU, but then asks for access to someone else&#x27;s RAM over the network. The mmap then causes this whole &quot;inefficient pointer-traversals&quot; to then get turned into Ethernet packets to share RAM between CPUs.<p>Ultimately, when you start dealing with high-speed data-sharing between &quot;external&quot; compute units (ie: a GPU, or a ethernet-connected far-away CPU), rather than &quot;just&quot; a NUMA-node or other nearby CPU, the linear address space seems ideal.<p>--------<p>Even the most basic laptop, or even Cell Phone, these days, is a distributed system consisting of a CPU + GPU. Apple chips even have a DSP and a few other elements. Passing data between all of these things makes sense in a distributed linear address space (albeit really wonky with PCIe, mmaps, base address pointers and all sorts of complications... but they are figured out, and it does work every day)<p>I&#x2F;O devices working directly in memory is going to only become more common. 100Gbps network connections exist in supercomputer labs, 10Gbps Ethernet is around the corner for consumers. NVMe drives are pushing I&#x2F;O to such high bandwidths that&#x27;d make DDR2 RAM blush. GPUs are growing more complicated and are rumored to start turning into distributed chiplets soon. USB3.0 and beyond are high-speed links that directly drop off data into linear address spaces (or so I&#x27;ve been told). Etc. etc.