top | item 43886519

(no title)

kfuse | 10 months ago

Frankly, that doesn't explain much, because that sounds like how modern computing works: every program has its own continuos 32/64 bit address space. With 24 bits you can address 16MB which seems enough to be useful if you throw away reflection and such.

discuss

order

chongli|10 months ago

16MB is larger than every single SNES game ever released.

Modern programs have dynamic memory allocation. You can't just start writing to any address you want. You have to request memory from the operating system with malloc() and then free() it when you're done. Memory-managed programming languages handle this for you but it's still there under the covers.

On the SNES, you simply have all memory available from the beginning. No malloc/free, just start reading and writing.

ninkendo|10 months ago

Malloc and free aren’t handled by the operating system, they’re handled in user space.

Underneath malloc is mmap(2) (or in older unices, setbrk), which actually requests the memory. And with delayed/lazy allocation in the OS, you can just mmap a huge region up front, and it won’t actually do anything until you write/read to the individual pages.

Point is, you only need one up front call to mmap to write to any page you want.