title: Virtual Memory and Physical Memory
body: <p>I am studying the concept of Memory Management Unit(MMU) from the book titled "Operating System Concepts" - by Abraham Silberschatz and Galvin. Though things were fine till chapter 8. As soon I started with chapter 9, things started messing up.</p>
  
  <p>I am not clear about what my virtual memory is? Also, physical and logical addresses seems to be confusing now? Does it(virtual memory) exists in real or not? 
  As per my understanding of now, the RAM of my system is what I call Physical(or main) Memory. I have 8GB RAM and 64- bit OS. Thus, my RAM can accommodate 2^64-1 addresses. Is this what I call physical address space? Also, what exactly is logical address space?</p>
  
  <p>Every process has to be in main memory for execution otherwise it resides on hard disk. Are the addresses given to instructions of my code residing on hard disk is what I call logical address? And when it's loaded in RAM, because location is not fixed and hence the code can be loaded anywhere, the addresses assigned here(RAM) called Physical Addresses? This mapping I suppose is referred to as Logical-Physical address mapping. </p>
  
  <p>Now, because size of my code or process can be large than the size of RAM available, here comes the use of virtual memory. As I understood, it's an abstraction to give the programmer a view that he has an infinite amount of memory available on the system. It's basically an area of hard disk where some processes(which are seldom used) from RAM are swapped out. Simultaneously desired pages are brought in the main memory. Is it so? Then what determines the size of this area on hard disk? Also, RAM is cheap, then why do we need to have such a mechanism? Can't we increase our RAM size instead of including this overhead of swapping?</p>
  
  <p>I have searched much on web but didn't find the exact definition and difference between these terms. Please help!</p>
  
  <p>Thanks</p>