4 ms·
>> Secondly, the GameCube only has 24MB (and some specialized areas) of RAM across a 4GB address space, meaning most memory addresses have no RAM backing them!
by _ytji 10y ago
>> Secondly, the GameCube only has 24MB (and some specialized areas) of RAM across a 4GB address space, meaning most memory addresses have no RAM backing them!
Is this common with consoles or anywhere else? I knew that there's very little RAM on consoles, but is there a reason for having the large address space available? (possibly convenience?)
- larrik 10y agoIt's just an artifact of 32-bit addressing. Addresses are just an integer from 0 to (2^31 - 1). Using a smaller address space may be possible (although it is still very limited), but dealing with anything other than exactly 32 bits is a TON of extra work, and so it's not reasonably to accomodate what is really a non-issue.
- serge2k 10y agoWhy would it be a ton of extra work?
- larrik 10y agoBecause the CPU "thinks" in 32-bits, therefore anything not 32-bits needs to be processed first. You would need to first convert your memory address to 32-bits before the CPU could read it, which brings something that would normally be a single CPU clock tick into more than that (it's slightly more complicated than that, but only in ways that make it worse). On top of that, since compilers don't normally do this stuff for you, you would need to end up writing a wrapper to handle every possible memory call, and write it in assembly. On top of that, you can't use those wasted bits for anything else anyway, so what's the point?
- serge2k 10y agoAt the CPU level wouldn't you just not bother attaching the address lines above X bits? Then design your toolchain so that you have knowledge that the address space is only X bits.
- BillinghamJ 10y agoPerhaps just a side effect of being 32-bit?
- kbsletten 10y agoI don't know for sure, but I believe that memory addresses are generally represented as an unsigned integer of one of a few sizes. 24MB is well over the maximum value for a 16-bit integer (approx. 65K) so they simply used the next larger size -- a 32-bit integer (max size approx. 4B) -- and figured that most of the address space being un-mapped wouldn't be a problem. This is common in most computers because the allowed memory size grows at an exponential rate with increased size for the addresses.
- rocky1138 10y agoYes, this reminds me of older computers. My Atari ST 1040 has something like 2MB of RAM but I'm sure the addressing is 32-bit, meaning that there are addresses that it can't ever reach. In fact, doing some research shows that 8-bits of the address are often ignored on the Motorola 68000 leaving a 24-bit memory address.
- coldpie 10y agoI remember reading on HN that developers would use those unused bits to carry more data around. There was so little RAM available that the unused bits in pointer addresses were useful.
- Narishma 10y agoAnd it came back to bite them when later processors used those bits.
- serge2k 10y agoThat type of thing is still done today. For example, in V8 they use the bottom 2 bits of pointers for other things. They get away with it because objects are 4 byte aligned.
- jburgess777 10y agoLast time I looked, the current 64bit Intel CPUs only used the lower 48 bits for userspace virtual addresses. This leaves 16 bits available if you want to tag your pointers with some additional information. This can be useful for saving space or using them with an 8 byte cmpxchg. This kind of trick is easier to get away with if you know exactly which CPUs your software is going to run on. Otherwise your software could break horribly when a new generation of CPU comes around.
- bdonlan 10y agoThe R&D needed to invent an entirely new CPU architecture isn't worth it for a game console, so they all use some off-the-shelf architecture - in this case, PPC, which is a 32-bit architecture like most other PC/workstation architectures of its vintage. There are relatively few architectures which have address sizes that are not a power of two, mostly because this means an array of addresses requires wasteful padding for alignment. And for 32-bit architectures, even at the time it was realistic for high end workstations to have 4G of physical RAM, so there was a good reason to support this at the architectural level. Removing this for a game console after it was developed would have been more expensive than leaving it in.
- flukus 10y agoAssuming your typing this on a modern, 64 bit computer. You theoretically have 64 exabytes of address space available, but I'm going to assume you don't have that much RAM.