Check out example codes for "virtual memory in os". It will help you in understanding the concepts better.

Code Example 1

Virtual Memory is a storage mechanism which offers user 
an illusion of having a very big main memory. It is done
by treating a part of secondary memory as the main memory. 
Therefore, instead of loading one long process in the 
main memory, the OS loads the various parts
of more than one process in the main memory.

Learn ReactJs, React Native from akashmittal.com