I have started to learn about Virtual Address Space (VAS) and I have few questions:

  1. How much of VAS is created for each process depending on the architecture (32-bit and 64-bit)?
  2. Is VAS for each process created on hard disk? If so, what happens if there is not enough space?
  3. What are the contents stored in VAS like text, data, BSS ?
  1. Each process gets as much virtual address space as it needs, up to an architecture- and configuration-specific maximum. The amount of allocated memory can be adjusted using brk and sbrk, and mmap.

    The maximum available on x86-64 is currently 128 TiB with four-level page tables, 64 PiB with five-level page tables. On 32-bit x86, the maximum available depends on the VM split configuration; it varies between 1 GiB and 3 GiB per process.

  2. No.

  3. The address space for each process contains everything that the process may need to access in memory. Address space can be allocated without being mapped at all to physical memory.



It may vary by architecture, for x86 / x86-64 it is.

  • 32 bit has 2GB or 3GB
  • 32 bit app on 64 bit kernel has 4GB
  • 64bit app (64bit kernel) has 2⁶³GB (that is a lot).




Everything: text, data, BSS, et al. This does not mean that any physical memory is allocated. Sometimes is is lazy allocated to RAM, sometimes it is mapped to hardware, sometimes it is mapped to a calculation.

  • 1
    What do you mean by “mapped to a calculation”? – Stephen Kitt Dec 22 '20 at 12:50
  • @StephenKitt probably not arithmetic (it could be, but not useful). It could be some system data: e.g. time, current system load, etc. However it will probably be cached to RAM (and marked as read only). There is a mechanism in Linux to map some read-only kernel data into virtual memory. – ctrl-alt-delor Dec 22 '20 at 13:59
  • Yes, there is such a mechanism, but it’s just mapping physical memory. – Stephen Kitt Dec 22 '20 at 14:01
  • @StephenKitt OK maybe it is only a possibility, but not used in practice. I remember (but not well) doing something like this a few years back. Just an experiment. I also remember, using virtual memory traps to bit-bash an I²C bus, to access memory. I did not cache as low RAM, and speed on this did not matter. I had to examine the instruction and write the data to a register. We used ARM so there are few memory access instructions, making this easy to do. It worked but we went with a different solution (simple library calls). – ctrl-alt-delor Dec 22 '20 at 14:10
  • Yes, it is possible — as you say, the trap handler can look at the faulting instruction and do whatever it wants. – Stephen Kitt Dec 22 '20 at 14:26

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