Virtual Memory: 3 What is Virtual Memory?

Virtual Memory: 3 What is Virtual Memory?

Virtual Memory and Indirection

In this section, the speaker explains what virtual memory is and how it works. The concept of indirection is introduced as a way to solve problems in computer science.

What is Virtual Memory?

  • Virtual memory is a layer of indirection that maps program addresses to RAM addresses.
  • Without virtual memory, the program address used by the program in MIPS is exactly the same as the RAM address.
  • When using direct mapping, if we try to access more memory than available, we will crash.

How Does Virtual Memory Work?

  • With virtual memory, we have a map in between that provides indirection between program addresses and RAM addresses.
  • This mapping allows us to use our memory in a more flexible way.
  • When accessing data beyond what's available in RAM, virtual memory can retrieve it from disk instead of crashing.

How Does Virtual Memory Solve Problems?

  • Virtual memory solves three problems: limited physical memory space, larger logical address space than physical address space, and protection against unwanted access.
  • Some of the program's address space can be mapped to disk when it doesn't fit into physical memory.
  • When trying to load data that doesn't fit into physical memory, virtual memory moves it around so it can be retrieved from disk.

Virtual Memory Overview

This section provides an overview of virtual memory and how it solves the problem of not having enough memory.

How Virtual Memory Solves the Problem of Not Enough Memory

  • Update the map to say that data is on disk, not in memory.
  • Virtual memory allows programs to have more memory than is physically available by using a mapping system.
  • Performance can be impacted when data needs to be accessed from disk instead of memory.
  • Adding more physical memory can improve performance by reducing the need to access data from disk.

Address Space Holes

This section explains how virtual memory addresses space holes and how it increases flexibility in using available memory.

Address Space Holes

  • With virtual memory, programs can be mapped anywhere in physical RAM, increasing flexibility.
  • Programs can be split into multiple parts and mapped to different areas of physical RAM.
  • The mapping system allows for filling up address space holes and utilizing all available memory.

Program Isolation and Security

This section discusses program isolation and security with virtual memory.

Program Isolation and Security

  • Programs are isolated from each other through mapping systems that send them to different physical locations in RAM.
  • Different mappings ensure that even if two programs try to access the same address, they write to different places in RAM.
  • Complete program isolation may prevent sharing data between programs.
  • A solution is using mappings that allow shared data between programs.

Program Isolation and Sharing Data

This section explains how virtual memory can enable shared data between programs.

Program Isolation and Sharing Data

  • Complete program isolation may prevent sharing data between programs.
  • Mappings can be used to allow shared data between programs, regardless of where they need to access it.
  • Shared mappings are common in applications like save dialog boxes.