Haydon said:
OK, so getting the hair splitting out of the way. Based on 32bit Vista,
and it is not necessarily 3GB of RAM used by the OS, it could be give or
take.
So, basically PC manufactures are ripping people off by selling them 4GB
of RAM, when 3GB would have the same performance?
Ok this is how it works, I am going to attempt to explain it as best as I
can...
This applies to pretty much any operating system, be it Linux, Windows, Mac,
WinCE and other embedded systems with processors that have a MMU.
A 32-bit processor can address 32-bits of address space, so in other words,
4 gigabytes. In any multi tasking operating system, address space is split
into two parts. One is called User space and it generally starts at address
0. The other part is called Kernel space and starts at whatever arbitrary
address the kernel chooses for it. In case of WinXP for example, this is
the 2 gigabyte, or if enabled via a special boot switch, the 3 gigabyte
mark.
Now user-space is reserved for applications. Each single application gets
its own copy of user space. So if there are 10 running processes, there are
10 user space mappings all starting at address 0. As the task manager
switches between the processes, it sets up the correct mapping starting
from address 0 for the process it is going to run next. Rinse and repeat
for every process in the list and then start over.
So this is what enables every application to have it's own memory and
without stepping on the memory of another application. The task manager has
a list of memory pages, usually 4kb in size each and it has a list for each
process which of these pages are assigned to it. So basically, if you have
2 gigs of memory then there are about 524288 4kb pages that can be assigned
to the various applications. Once you run out of those pages, the system
runs out of memory. These pages are assigned to each process in a
contiguous manner starting from address 0 to however much memory an
application needs to the end of user addressable space.
So on WinXP, since it has a 2 gig user space, it is impossible for any one
application to use more than 2 gigs of space even if a system had 4 gigs as
it can only address 2 gigs.
Now the second part, Kernel space cannot be used by an application. The
various hardware in your system also needs room in the 4 gigs worth of
address space. For example, the video memory of your video card is mapped
into kernel space. So taking XP as an example, if you have 512 megs of
memory, then XP assigns 512 megs of address space, of it's 2 gig kernel
addressable space, to the video card. This then leaves 1.5 gigs available
for other hardware, the kernel's own memory, etc.
Now all this is done by a Memory Management Unit on the CPU that uses a
pagetable directory to figure out what page goes where. It's a really neat
thing that can map any 4kb page from *anywhere* in memory *to* anywhere in
memory. This is the most basic thing that even allows multi tasking. It
however can only map up to 4 gigs of space since the CPU only has 32-bit
registers.
Now since hardware also has to be mapped into the same address space as
memory, any address space used up by your various installed hardware for
addressing, such as video memory, can no longer be used for anything else
in the pagetable.
So that means that if you have 4 gigs of ram, any amount of addressable
space mapped to hardware and the kernel cannot be mapped to anything else
anymore. That is why you see less than 4 gigs available.
64-bit CPUs don't have this problem because instead of 4 gigs of addressable
space, they have 17,179,869,184 gigs of addressable space.
I don't think even MS can manage to fill up that many gigs of space anytime
soon.
--
Stephan
2003 Yamaha R6
å›ã®ã“ã¨æ€ã„出ã™æ—¥ãªã‚“ã¦ãªã„ã®ã¯
å›ã®ã“ã¨å¿˜ã‚ŒãŸã¨ããŒãªã„ã‹ã‚‰