Paging: Difference between revisions

1,215 bytes added ,  16 years ago
Added Overview and 2 Usage Comments
[unchecked revision][unchecked revision]
(Page Table)
(Added Overview and 2 Usage Comments)
Line 7:
==MMU==
Paging is achieved through the use of the [[MMU]]. The MMU is a unit that transforms virtual addresses into physical addresses based on the current page table.This section focuses on the x86 MMU.
 
===Overview===
On the x86, the MMU maps memory through a series of tables, two to be exact. They are the paging directory, and the paging table.
 
Both tables contain 1024 4byte entries, making them each 4kb. In the page directory, each entry points to a page table. In the page table, each entry points to a physical address that is then mapped to the virtual address found by calculating the offset within the directory and the offset within the table. This can be done as the entire table system represents a linear 4gb virtual memory map.
 
===Page Directory===
Line 46 ⟶ 51:
The 'C' bit is 'D' bit above.
 
====Example====
 
Say I loaded my kernel to 0x100000. However, I want it mapped to 0xc0000000. After loading my kernel, I initiate paging, and set up the appropriate tables. (See [[Higher Half Kernel]]) After [[Identity Paging]] the first megabyte, I start to create my second table (ie. at entry #768 in my directory.) to map 0x100000 to 0xc0000000. My code could be like:
Line 74 ⟶ 79:
 
==Usage==
Due to the simplicity in the design of paging, it has many uses.
Todo
 
===Virtual Address Spaces===
In a paged system, each process may execute in its own 4gb area of memory, without any chance of effecting any other process's memory, or the kernel's.
 
===Virtual Memory===
Because paging allows for the dynamic handling of unallocated page tables, an OS can swap entire pages, not in current use, to the hard drive where they can wait until they are called. In the mean time, however, the physical memory that they were using can be used elsewhere. In this way, the OS can manipulate the system so that programs actually seem to have more RAM than there actually is.
 
''More...''
 
==Page Faults==
Anonymous user