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).
The virtual address space for 32-bit Windows is 4 gigabytes (GB) in size and divided into two partitions: one for use by the process and the other reserved for use by the system.
They use an instruction set which allows a full 64-bit address space, but current CPUs just only use the lower 48 bits. The alternative was wasting transistors on handling a bigger address space which wasn't going to be needed for many years.
The size of the virtual address space is determined by the operating system and the hardware it runs on. You have probably heard people talk about 32-bit and 64-bit systems. These terms indicate the size of the registers, which is usually also the size of a virtual address.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With