神秘内容 Loading...
Let's fast-forward to the current era. For many years, it's been normal for personal computers to include a Memory Management Unit (MMU). MMUs were expensive add-ons for old computers, but modern CPUs all have one built in. A primary function of an MMU is to allow a computer to have "virtual memory", which in the PC world means "swapping" or "paging" data in and out of however much actual RAM you have as needed, keeping the swapped-out data in a file, or files, on hard drives. (来源:EnglishCN.com)
Virtual memory is what allows your PC to have more than 4Gb of total memory, including the swap file(s). Memory management lets the computer augment its physical RAM, and lets programs running on that computer feel as if they've each got a simple solid space of memory available to them without treading on each others' toes. But virtual memory doesn't increase the amount of physical RAM you can have.
The explanation for the three-to-four-gigabyte problems is that modern computers include an arrangement conceptually similar to the old Upper Memory Area one. Many of the original Upper Memory Area MMIO reserved areas still exist today (for backward-compatibility reasons - otherwise you couldn't install DOS on a new PC), and a few more little ones sprouted above 1Mb as PCs went through their growing pains. Those are preserved today as well.
For this reason, a modern "3Gb" computer, which has 3,145,728 kilobytes of physical memory, is only likely to show something like 3,145,192 kilobytes available (look at the Performance tab in the Windows Task Manager, for instance). MMIO ranges "shadow" some of the physical memory, and so the system can't even see that RAM, at the hardware level.
3,145,728 minus 3,145,192 is only a shortfall of 536 kilobytes, though. So this 3Gb computer gives you 99.983% of the memory you paid for. Install more expansion cards in the computer, each of which is likely to eat some MMIO space for itself, and you'll lose a bit more memory. But you'll have to try pretty hard to lose even one whole megabyte.
I, for one, am OK with that.
But things get worse above 3Gb.
Large areas of the memory between three and four gigabytes are cordoned off for system devices in exactly the same way that chunks of the Upper Memory Area were purloined in the old days. Once again, the processor (and other system components) can talk with some devices by reading and writing memory addresses up above 3Gb.
The difference is the size of the reserved areas.
Windows users can see all of the reserved memory areas on their PC in Device Manager, using the View -> Resources By Connection option. This is what that view looks like for the PC I'm using now.
The addresses are all in hexadecimal, which makes it less than instantly obvious to the untutored viewer which reserved areas are tiny (and usually old) and which large (and all relatively new). Spend the time to figure it out, though, and you can see the old backward-compatibility stuff and the new 3Gb-barrier stuff, plain as day.
Hex addresses A0000 to BFFFF, for instance, are still assigned to the video card (a GeForce 7800 GT, in this case). That's addresses 655360 to 786431 in decimal, 640 kilobytes to 768k. This is the old 128 kilobyte reservation for the monochrome, CGA and EGA graphics buffers, still there in case you find your old Leisure Suit Larry disk and want to see if it works.
In the above picture, though, you'll see a much more considerable reservation from C0000000 to CFFFFFFF, that's also assigned to my video card. That's 268,435,456 bytes, equal to the 256 megabytes of memory on the card, and it's the chunk of memory addresses that system devices use when they want to access the card's memory.
If I had a video card with 512Mb or 768Mb of memory on it, it'd take up even more space in the 3Gb-to-4Gb memory map.
And if I were still using an AGP graphics card, there'd be another block of memory reserved for the AGP aperture, used when devices on other buses in the computer want to talk to a graphics card on the AGP bus. I've got a PCIe graphics card, though, which sits on the same bus as all of the other stuff and so doesn't need an aperture.
(If you've got a computer with one of those cheap graphics adapters that uses system memory instead of having RAM of its own, it will of course eat some of your RAM no matter how much you've got installed.)
Power users with a hankerin' for dual graphics cards may be experiencing something of a sinking feeling, at this juncture. Yes, the 256Mb reserved for my little old graphics card means exactly what you think it means: Those two 768Mb graphics cards you can totally justify buying will eat one point five gigabytes of your 32-bit memory map all by themselves, cutting you down to a 2.5Gb ceiling before you even take the other reservations into account.
This also explains why 1Gb graphics cards haven't hit the consumer market yet. Nobody yet needs anything like that much memory on one card for any desktop computer purpose, but some people would still be very happy to pay for such a card just for the pose value. It'd eat the whole of the fourth gigabyte of their system memory, though. And then they'd probably demand their money back. |