in last post we saw how to ask for all physical memory
lets see Maximum memory can be allocated.
run the code above to see maximum memory your linux distribution can allocate on your machine.
if allocation fails that means memory is full
program gets terminated.
reason behind allocating more memory is swap space
linux implements a demand paged virtual system.
All memory seen by user is virtual .
that means ,it doesn’t actually exists at physical address the program uses.
linux divides all memory into pages, generally 4096 bytes per page.
when program tries to access memory virtual to physical memory translation is done and time taken depends on your hardware.