Professional Documents
Culture Documents
BSCS - Binan
● Each process running on a computer has its own virtual address space,
which is the range of memory addresses that the process can use.
● The virtual address space is divided into pages, which are typically 4KB
in size. These pages are the basic units of memory management.
3. Virtual-to-Physical Mapping
4. Page Tables
● Each process has its own page table, which is a data structure used to
store the mapping information for every page in the process's virtual
address space.
● A page table entry typically contains:
● Virtual Page Number (VPN): The page number in the process's
virtual address space.
● Physical Page Number (PPN): The corresponding page number
in physical memory (RAM).
● Valid/Invalid Bit: Indicates whether the page is currently in
physical memory or not.
● Permissions Bits: Information regarding whether the page
read-only or read-write, and other access permissions.
● Additional control bits: Some page table entries may have additional
bits for various purposes, such as dirty bit (indicating whether the page
has been modified), accessed bit, etc.
5. Address Translation
6. Page Fault
7. Swap Space
8. Page Replacement:
1. Page Size:
Pages are fixed-size blocks of memory typically ranging from a few kilobytes to a few
megabytes. The most common page size is 4KB. The choice of page size is a trade-off
between reducing internal fragmentation (wasted memory within a page) and reducing
the overhead of managing a large number of pages.
2. Virtual Memory:
An MMU enables the use of virtual memory. Virtual memory allows a computer to use
more memory than is physically available. Each process running on the system has its
own virtual address space, and the MMU maps these virtual addresses to physical
addresses in RAM.
3. Page Tables:
To manage this mapping between virtual and physical memory, an MMU uses a data
structure known as a page table. Each process has its own page table. The page table is
used to store the mapping information for every page in the process's virtual address
space.
- Virtual Page Number (VPN): The page number in the process's virtual address space.
Physical Page Number (PPN): The corresponding page number in physical memory
(RAM).
- Valid/Invalid Bit: Indicates whether the page is currently in physical memory or not.
Permissions Bits: Information regarding whether the page is read-only or read-write, and
other access permissions.
- Additional control bits: Some page table entries may have additional bits for various
purposes, such as dirty bit (indicating whether the page has been modified), accessed
bit, etc.
5. Page Faults:
When a program accesses a virtual address, the MMU consults the page table to find
the corresponding physical address. If the page is not in physical memory, a page fault
occurs. In response to a page fault, the operating system loads the required page from
secondary storage (e.g., a hard disk) into physical memory.
7. Page Replacement:
If physical memory becomes full, the operating system may need to swap out pages to
secondary storage to make room for new pages. Various page replacement algorithms
(e.g., LRU, FIFO, etc.) are used to determine which pages to evict.
Pages and the MMU are fundamental concepts in modern computer systems, enabling
efficient use of physical memory and providing memory protection between processes.
They are critical for the stability, security, and performance of operating systems and
applications.