Introduction: Virtual Memory

WHY VIRTUAL MEMORY?

  • Not enough RAM-> CRASH
    • MIPS provides 32 bit address space(4GB memory), suppose we have only 1GB RAM. How to access address out of 1GB range?
  • Secure address space-> CORRUPT
    • Two programs can write on same address
  • Holes in the address space-> OUT OF SPACE
    • Say there are 3 programs like-> p1 needs 1GB, p2 needs 2GB and p3 need 1GB. In out 4GB address space p1 and p2 fit in, respectively. Say p1 is terminated. We have 2 address spaces of 1GB above and below of p2.
      Although we have enough space but we cannot allocate it to p3 because of Memory Fragmentation.

HOW IT SOLVES?

  • By mapping the virtual memory space given to the program to actual memory space.
  • In this, way all the programs have different VS.

WHAT IS VIRTUAL MEMORY?

  • It is an indirection from virtual address spaces generated by program to some address from where the required data can be accessed.

AGAIN, HOW IT SOLVES OUT 3 PROBLEMS?

  • Not enough RAM-> CRASH
    • Map has the mapping to disk also, whenever some address that is accessed that’s not in RAM, Map goes to the Disk, takes that data and pages out some other data to Disk to put this new, recently accessed data into RAM.
      Along with this, Map updates it self for the address whose data has been paged out.
  • Holes in the address space-> OUT OF SPACE
    • Considering the same situation as above, both p2 and p3(as well p1) would have their Maps, now p3’s address space can be mapped to 2 chunks of 1GB.
  • Secure address space-> CORRUPT
    • If 2 programs are accessing same address to write, Map of each can prevent them to write on same address.
    • Two prevent complete isolation though, programs can have same mappings.

 

Advertisements

Help to improve or comment as you wish

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s