This is NOT an interview question. But I tend to hear about it often a lot. Ever since the first time I heard it,I'm puzzled what does it really mean. As I'm learning OS now,I was introduced the concept of Virtual Address Space(V.A.S). I'm wondering if that very 32 bit or 64 bit means that the VAS is 32 bit or 64 bit. Is there this correlation being 64 bit process means VAS for that very process would 64 bit VAS.
Anyone please help me to clarify my understanding about the VAS and 32/64 bit process. Any answers will be appreciated,and thanks in advance.
Looking forward to get your responses.
Simple start : Stackoverflow discussion
The virtual addresses of a process are the mappings of an address table that correspond to real physical memory on the system. For reasons of efficiency and security, the kernel creates an abstraction for a process that gives it the illusion of having its own address space. This abstraction is called a virtual address space. It's just a table of pointers to physical memory.
So a 32-bit process is given about 2^32 or 4GB of address space. What this means under the hood is that the process is given a 32-bit page table. In addition, this page table has a 32-bit VAS that maps to 4GB of memory on the system.
So yes, a 64-bit process has a 64-bit VAS. Does that make sense?
@kenshin123 Thank you so much for vividly explaining it. Now it makes sense to me. Really nice explanation !!
@JustVirtually I already had read it but didn't able to make sense thoroughly. At the early stages of learning,overwhelming explanation does more harm than good. But anyway thanks for your response !
32 bit process - Code compiled with 32bit CPU Instructions. These processes can access up to 2^32 byte(4GB) address space.
64 bit process - Code complied with 64bit CPU instructions. These processes can access up to 2^64 byte address space.
Almost all major OS support running 32 bit process on 64 bit processors.
We know that register is a special kind of memory that stays within processor. 32/64 bit is the amount that register holds as a memory unit in the processor. If the registry consists of 32 bit then it can calculate up to 4 byte data per instruction cycle. On the contrary, if the registry has 64 bit memory then it can calculate up to 8 byte data per instruction cycle. When processes requests data from RAM, various instructions processing taken memory in memory address register (MAR) and memory data register (MDR). I hope in a nutshell i have addressed how processes interact with the register memory.
If you want to understand it very well, you have to learn how the CPU communicates with the memory, using a concept called buses so when the CPU tries to store and fetch data from the memory he needs to use address buses or data buses.
In case of a 32bit CPU architecture the there are 32 buses and each bus can transmit one bit which means 32bit CPU can point to 2^32 positions in the memory and the same thing applied for a 64bit CPU.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.