VIRTUAL MEMORY

 Basic Idea Of Virtual Memory

    Let us say we have a game of 50GB and RAM of 8 GB then by logic we will think that 50GB is greater than 8GB so the game can't fit in RAM so the game cant work. This is not the computers and world work pal...

    Of 50GB let us say we require only 2 GB of data of RAM for making a game run and RAM is   8GB, yes we will put those data in RAM that is in use and others in physical memory (disk ) that are not in use right now.

    The above process is done by the concept of virtual memory, it will show that it is doing hard work (running  50GB in 8GB space) but actually, it is doing smart work (running 2GB in 8GB).

    Take a look at the following diagram => 

    


1. Processor issues for a virtual address asking for a physical address

2. Memory Management Unit converts the virtual address into a physical address using some internal methods.

3. You get data from that physical address either from cache or from main memory if that is not found in both of them then it is brought from physical memory that is disk.


Address Translation of Virtual memory to Physical memory

    Let us take look at how to address translation that takes place in MMU.

  1. Programs at first are divided into pages with fixed size block in it (length)
  2. Like cache for main memory and processor we have virtual memory concept for main memory and physical memory
  3. Virtual address is generated by the processor
  4. This virtual address consists of a virtual page number and offset
  5. Virtual page number decides the row of a particular column in the page table and offset decides the particular block in that page
  6. Main memory location = page_table(virtual page number) + offset

Translation Lookaside Buffer

As we discussed above 50GB & 8GB examples we have the same concept with the contents of the page table useful page table contents are placed in MMU in TLU (Translation Lookaside Buffer) and the complete table is placed main memory

Page Faults

  1. Page fault occurs
  2. MMU asks OS to generate the output
  3. OS generates the interrrupt
  4. Control is given to OS
  5. OS takes the missing page table value from main memory puts it in TLB.
  6. OS gives control back to previous routine.

Comments

Popular posts from this blog

3 MAPPING TECHNIQUES

ADJACENT MATRIX