32 v/s 64 bit architecture - virtual address space
Asked Answered
V

2

5

I am attending an OS course, wherein the instructor mentions 32 v/s 64 bit architectures.

My understanding of this difference from my architecture class is that 32 bit v/s 64 bit indicates the CPU word size, the register size, and the size on which ALU can perform computation.

The instructor said: "Today 64 bit architectures are used, and so the virtual address space size of the process is 64 bit."

I want to ask whether 32 bit v/s 64 bit also indicates whether the virtual address space size of a process is 32 bit v/s 64 bit? If not, is there any dependency of virtual address space size on type of architecture (32 bit / 64 bit).

Virility answered 12/4, 2014 at 21:45 Comment(4)
Well, do we? Who is we? This is not very specific.Droughty
Sorry I am editing it.Virility
It depends. Mostly 32 bit arch has 32 bit pointers and 64 bit arch 64 bit pointers. Doesn't have to be that way.Droughty
It's even possible for an architecture to have 32-bit data registers yet have 64-bit addressing registers. That's just not often done these days.Wera
S
9

No. Even if you have a 64-bit architecture, the virtual address space would need to be less than the total virtual addressable space in order to allow room for the operating system to operate.

How much space each process is allocated depends on the operating system. A 64-bit architecture indicates that the OS will use a much larger default process space for a process compared to a 32-bit architecture. It depends on the OS for how much default process space is allocated. In Windows 64-bit, a default virtual address space for a process is 8 terabytes (there are a total of 2 ^ 24 addressable terabytes on a 64-bit byte addressable system) and in 32-bit it's only 2 GB (4 GB addressable total). The other remaining memory is reserved for the operating system in a 32-bit system (not sure why the process is capped to such a comparatively low amount in a 64-bit system).

On 32-bit architecture these defaults can be changed on Windows (and on Linux through some other method, I'm sure) to anywhere between 2 GB - 3 GB, but the last GB must always be reserved for the OS.

This doesn't mean the process has to be 64-bit in a 64-bit architecture. A 64-bit OS can run 32-bit processes on 64-bit architectures through a compatibility mode. As John Saunders noted, there are some 64-bit architectures that have a 32-bit processor available to run 32-bit processes without the need for a compatibility mode; an example of this is Intel's Itanium processor.

32-bit architectures can allow process' memory space to be extended through the usage of Physical Address Extensions (PAE) to use a full 4 GB of memory although Windows PAE allows for 64 - 128 GB of physical memory depending on the processor.

This means a single 32-bit process can possibly 'see' up to 4 GB of main memory with PAE but no more than that. As far as I know, no process will use anywhere close to 2 ^ 64 bytes in the foreseeable future, so PAE isn't used for 64-bit systems.


All stuff beyond the scope of your question:

Virtual address space exists so the operating system can allocate more process space to each process than is actually available. It also exists to allow protection of the process space and to enable virtualization via a Virtual Machine Monitor (VMM). This protection of the process space with the VMM allows for virtualized instruction set architectures. This is what allows people to run Linux on a VM in Windows (note that the processor hardware & operating system both have to support virtualization in order for this to be possible).

The most common/simple example of a 64-bit architecture advantage over 32-bit is a system in which there is more than 4 GB of RAM/main memory. A 32-bit system can only use up to 4 GB of physical/main memory/RAM with PAE but a 64-bit system can easily allow processes to address way more memory than that without any need for PAE. Remember that 2^32 bits = 4 * 1024 * 1024 * 1024 = 4 GB. Each bit in the 32-bit address space represents 1 byte in a byte-addressable system.

Soloma answered 12/4, 2014 at 23:43 Comment(2)
Each bit in the 32-bit address space represents 1 byte in a byte-addressable system. - This is the key to understanding memory addressing scheme. This is the most basic concept many wouldn't mention. Glad that you included it in your answer.Rotative
Not 8 terabytes but 8 gigabytes. "a default virtual address space for a process is 8 terabytes (there are a total of 2 ^ 24 addressable terabytes".Wellgrounded
O
0

the limitation due to 32-bit vs 64-bit architecture comes from the max size of a number you can store in 32 bit cpu register to access an address. Even though the memory might be there you need to store address values that point to the memory in a register for assembly commands (push,mov,pop,store) to use in order to put values in those memory locations. A 64-bit register can store 2^64 different values - a really large number (16 exbibytes), 32 bit can only store 2^32 values = 4GB.

Occur answered 13/4, 2014 at 0:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.