paging is one of the memory-management schemes by which a computer can store and retrieve data from secondary storage for use in main memory.
In the paging memory-management scheme, the operating system retrieves data from secondary storage in same-size blocks called pages.
Page Replacement Algorithm:
1. Demand Paging
2. Anticipatory Paging
3. Free Page Queue
4. Page Stealing
5. Pre-Cleaning
Demand Paging:
When pure demand paging is used, page loading only occurs at the time of the data request, and not before. In particular, when a demand pager is used, a program usually begins execution with none of its pages pre-loaded in RAM.
Pages are copied from the executable file into RAM the first time the executing code references them, usually in response to page faults. As a consequence, pages of the executable file containing code not executed during a particular run will never be loaded into memory.
In the paging memory-management scheme, the operating system retrieves data from secondary storage in same-size blocks called pages.
Page Replacement Algorithm:
1. Demand Paging
2. Anticipatory Paging
3. Free Page Queue
4. Page Stealing
5. Pre-Cleaning
Demand Paging:
When pure demand paging is used, page loading only occurs at the time of the data request, and not before. In particular, when a demand pager is used, a program usually begins execution with none of its pages pre-loaded in RAM.
Pages are copied from the executable file into RAM the first time the executing code references them, usually in response to page faults. As a consequence, pages of the executable file containing code not executed during a particular run will never be loaded into memory.
Anticipatory paging
This technique, sometimes called "swap prefetch", preloads a process's non-resident pages that are likely to be referenced in the near future (taking advantage of locality of reference). Such strategies attempt to reduce the number of page faults a process experiences.
"if a program references one virtual address which causes a page fault, perhaps the next few pages' worth of virtual address space will soon be used" and "if one big program just finished execution, leaving lots of free RAM, perhaps the user will return to using some of the programs that were recently paged out".
Free page queue
The free page queue is a list of page frames that are available for assignment after a page fault.
Page stealing
Some operating systems periodically look for pages that have not been recently referenced and add them to the Free page queue, after paging them out if they have been modified.
Pre-cleaning
Pre-cleaning makes starting a new program or opening a new data file much faster. The hard drive can immediately seek to that file and consecutively read the whole file into pre-cleaned page frames. Without pre-cleaning, the hard drive is forced to seek back and forth between writing a dirty page frame to disk, and then reading the next page of the file into that frame.