Paging was first introduced by the Atlas Computer in 1962. Paging with virtual memory was introduced in UNIX via BSD. There are 2 types of paging:
File System Paging is caused by applications reading and writing of pages in memory-mapped files or file systems that uses page cache. This is considered good paging.
Anonymous Paging involves data in process - heap and stack. It is called anonymous because there is no named file that back up these page ion the file system. Anonymous pages are moved in and out of swap devices. Anonymous paging is considered bad paging as it hurt performance. When application accesses pages that has been paged out, it will be blocked for I/O. Read is always synchronously handled by kernel. Page out on the other hand is handled asynchronously by kernel. Performance is best without anonymous paging.
Demand paging refers to mapping of virtual pages to physical pages in memory. Pages will be allocated first and mapping will be deferred to when the page is accessed by application. If the page can be satisfied by a page already in memory, it is called a minor fault. Otherwise, the needed page will be read into memory and is called a major fault. A page can be in one of these four stages at any one time:
(1) unallocated
(2) allocated but unmapped
(3) allocated and mapped to RAM
(4) allocated and mapped to swap devices
Transition from (2) to (3) is a page fault (minor or major). Resident Set Size = (3). Virtual Memory Size = (2) + (3) + (4)
No comments:
Post a Comment