Virtual Memory: 2 Three problems with Memory
Memory Problems in MIPS
Insufficient Memory
- The first problem discussed is the limitation of memory in MIPS architecture, where each program is promised a 32-bit address space.
- A 32-bit address allows access to 2^32 bytes or 4 gigabytes of memory; however, practical limitations often reduce this to about 2 gigabytes due to operating system reservations.
- If a computer has less than 4 gigabytes of RAM (e.g., only 1 gigabyte), accessing addresses beyond the physical memory leads to crashes without virtual memory support.
Memory Fragmentation
- When multiple programs run simultaneously, they share the available memory, which can lead to fragmentation.
- For example, if two programs occupy a total of 3 gigabytes and one quits, there may be free space but not contiguous enough for another program that requires it (e.g., needing 2 gigabytes).
Data Corruption Between Programs
- Another significant issue arises when multiple programs attempt to access the same memory address.
- An example illustrates two programs writing data to the same address (1024), leading to corruption as they overwrite each other's data.
Summary of Memory Issues
- The problems identified include: insufficient physical memory leading to crashes, fragmentation preventing efficient use of available memory, and potential data corruption from shared access between programs.
Virtual Memory as a Solution
Introduction to Virtual Memory
- The lecture introduces virtual memory as a solution that provides each program with its own separate virtual address space.
Mapping Virtual Space to Physical RAM
Virtual Memory and Its Mapping
Understanding Virtual Memory
- Virtual memory involves a mapping system that connects program memory spaces to physical RAM, allowing for efficient memory management.
- When physical RAM is insufficient, data can be moved to disk storage, effectively using the hard disk as an extension of memory. This concept underpins the term "virtual memory."
- A discussion on shared address spaces highlights potential issues when multiple programs share a 32-bit address space with less than four gigabytes of available memory.
Address Space Limitations