Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was wondering... 64bits OSs can run 32bits applications right? Windows use WoW64 to achieve this right?

My question is, when these applications are run, does they use 64bits or 32bits addresses? I was wondering this because of the memory usage...

share|improve this question

3 Answers 3

up vote 4 down vote accepted

Internally, every program sees about 2GB of memory space (there is flag one can set to get 3GB) and therefore never has to need 64-bit pointers (32-bit pointers will work fine). The OS can handle all the 64-bit real memory management under the hood.

Not quite sure what this has to do with memory usage.

share|improve this answer
    
Because 64bits programs uses more memory because they need 64bits pointers. –  Zequez Aug 16 '11 at 3:33
    
That is such a tiny tiny difference that it does not matter (32 bits per pointer). In addition, to actually get used, the pointers the program uses have to be converted to the 64-bit real addresses anyway, so it does not prevent a 64-bit address from being stored. –  soandos Aug 16 '11 at 3:36
    
@soandos, while it is true that for an individual application the difference in pointer size will affect the memory footprint minimally. On the os side - the 64 bit pointer increase will quadruple the size of the page table required. Page tables on a loaded 32 bit system can reach 50MB, quadrupling that is not a small difference. –  crasic Aug 16 '11 at 6:01
    
@crasic it quadruples the maximum size, not the actual size. –  soandos Aug 16 '11 at 6:06
    
@soandos assuming we keep the same page size (of course that is a maybe) it will quadruple the current page table size. Think about it logically - if we pad pointer in our 32bit PT with 0's just for the hell of it it will at least quadruple in size (assuming a flat PT, which is reasonable enough for a size approximation) –  crasic Aug 16 '11 at 6:13

32 bit applications can only see 32 bit addresses. WoW64 simulates the 32 bit environment inside the 64 bit memory space for 32 bit applications.

share|improve this answer
    
So the 32bits application uses the same amount of memory it would use in a 32bits environment? –  Zequez Aug 16 '11 at 3:35
2  
I dont know the exact answer, so im venturing a guess. The applications themselves would probably use the same amount of memory in a 64 bit environment as they would in a 32 bit environment. However, more memory is used to by WoW64 in order to map those environments. –  Keltari Aug 16 '11 at 3:38
    
Keltari's answer, and comment, are correct. More: A 32-bit app running on 64-bit Windows flatly cannot use 64-bit addresses or pointers, nor access the 64-bit-wide versions of the processor's registers. There simply is no way in the 32-bit x86 instruction coding to express such things. –  Jamie Hanrahan Nov 7 at 5:17

Your question isn't very specific since you don't distinguish between virtual memory address and physical memory addresses.

Yes, x86 programs are going to use more memory and resources. They will have a 32 bit virtual address space, but underneath, the Memory Manager (MM or MMM) will use x64 pointers. Not like that takes a whole lot of effort though.

By far the biggest resource cost is drivers. There were some substantial kernel changes, many due to security, that required large parts of drivers to be rewritten.

Internally, every program sees about 2GB of memory space (there is flag one can set to get 3GB) and therefore never has to need 64-bit pointers (32-bit pointers will work fine). The OS can handle all the 64-bit real memory management under the hood.

I believe this is untrue. Every program sees 4GB (32 bit virtual address space) but the kernel splits the physical address space in half. The two 2GB you are familiar with refers to the physical memory address.

share|improve this answer
    
This answer deserves an upvote since it is the only one that mentions the salient terms virtual and physical memory addresses. Other answers that try to explain relationships between userspace memory and memory management without specifying the memory space of the pointer or address are vague and probably misleading. –  sawdust Aug 16 '11 at 18:42
    
Surfasb: Sorry, but you are mistaken. The kernel does not "split the physical address space in half." The "two 2GB" refers to the default user vs. kernel mode split of virtual address space in 32-bit Windows. In 64-bit Windows, a 32-bit process does potentially have access to 4 GB v.a.s., but its binaries must all have the "large address aware" flag in order to use this; otherwise it will be constrained to the first 2 GB of v.a.s. –  Jamie Hanrahan Nov 7 at 5:20
    
Regarding driver porting: If proper data types have been used, most drivers port from x86 Windows to x64 simply by rebuilding. Nor did drivers need substantial changes for security in any Windows version. Drivers in Windows operate well below the security layers: I/O requests are checked for security violations (ACLs on files or devices, memory access, etc.) before they ever get to the driver; security is just not the driver's job. Even for file system drivers, while the FSD has the job of storing and retrieving the OS's security info, the actual checking is done elsewhere. –  Jamie Hanrahan Nov 7 at 5:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.