Running 32 bit .NET programs on 64 bit Vista

Discussion in 'Windows 64bit' started by segallw, Mar 18, 2008.

  1. segallw

    segallw Guest


    If I installed 64 bit Vista on a pc with 8GB RAM, do 32 bit programs
    have access to the additional RAM over 3GB (or is it 4GB 32bit
    programs are limited to?).

    For example, on a pc with 8GB physical RAM, say one 32bit program use
    2GB RAM, if Vista has already used 4GB ram, does the 32bit program use
    the next lot of 2GB as though it is the first lot of 2GB or is it
    simply unable to address the memory?

    If this is unclear, I'll put it another way.

    If I have 6 x 32bit programs each using say 1GB of RAM on Vista x64,
    does the operating system assign each 32bit program 1GB RAM and handle
    any memory address issues? I guess being 32bit they're not actually
    capable of addressing memory over 4GB or so?

    Or are all 32bit programs limited to the first 3 or 4 GB RAM on Vista

    segallw, Mar 18, 2008
    1. Advertisements

  2. You have a basic misunderstanding of RAM, memory, and virtual memory address

    32-bit Windows uses a flat memory address space, thus is limited to 4 GB of
    memory addresses. This is divided up 2 GB for individual user programs, and
    2 gb for the operating system. It doesn't matter if you have 4 GB of RAM, or
    512 Mb of RAM, it's the same virtual memory address space. This means that
    in order to directly address the memory used by video cards, and other such
    things on your computer, the OS has to be assign those specific addresses to
    that memory, and it's locked away and can't be seen - effectively making
    your memory address space smaller. But each user program that runs gets its
    own 2 GB of virtual memory address space, regardless of the RAM in your
    machine. There are even programs that can access >2 GB of memory address
    space, IF you configure Windows to allow it - using the /3GB boot switch.
    This effectively limits the OS to only 1 GB of virtual memory address space
    for its own operations, however, causing the operating system to effectively
    starve if there's a lot of I/O or other demands on the OS itself, so it
    isn't recommended for ordinary usage. Especially since only specially
    written programs can take advantage of it.

    Now, RAM. If you have 8 GB of RAM, running 32-bit Windows Vista, you simply
    can't see any of the RAM >4GB - there's no address space to communicate with
    it. So, if you have >4GB of RAM, you _need_ 64-bit Windows. (There is one
    exception to this, using something called /PAE, but it's not supported on
    all versions of 32-bit Windows and has a significant speed penalty, so is
    generally not recommended.)

    Whether a particular program that uses 1 GB of _memory_ will have all of the
    program in RAM is a decision that the operating system makes. It may decide
    to offload some of that to virtual memory, or may leave it all in RAM,
    depending on the other requirements of the system.

    In 64-bit Windows, the memory address space is 16 TB. 8TB for user programs
    and 8TB for the operating system. 32-bit programs running in 64-bit Windows
    run in the WOW64 subsystem. Each 32-bit program is assigned a 4 GB virtual
    memory address space in the WOW64 subsystem - with no requirement for the OS
    which is still running in the 8 TB of virtual memory address space it gets.
    So, if your 32-bit program is written to take advantage of >2GB of memory
    (using the LARGEMEMORYADDRESSAWARE compiler switch), it will automatically
    see a full 4GB.
    Charlie Russel - MVP, Mar 18, 2008
    1. Advertisements

  3. segallw

    segallw Guest

    Thanks Charlie for that thorough explanation.
    segallw, Mar 18, 2008
  4. segallw

    Doug Forster Guest

    Just to add a tiny bit more to Charlie's thorough explanation, I notice your
    post title mentions .NET programs. If a managed (.NET) program is compiled
    to target any platform (the Visual Studio default) then it will run as a 64
    bit program on a 64 bit OS and a 32 bit program on a 32 bit OS. This is
    achieved by the magic of JIT compilation.

    Doug Forster
    Doug Forster, Mar 18, 2008
  5. Thanks. What happens at the compiler level is entirely outside my area of
    Charlie Russel - MVP, Mar 19, 2008
  6. segallw

    segallw Guest

    I assumed only being able to target 64 bit (together with 32 bit) OS
    only if I compiled on 64 bit OS. I'm not sure why I had that

    I'm compiling on 32 bit OS and need to run my .NET program on both 32
    & 64 bit OS, so that is good news the compiler automatically manages
    the change to 64 bit OS allowing my .NET program access to more RAM.

    Thanks Doug.
    segallw, Mar 23, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.