A common page scheduling algorithm
A. Stochastic algorithm rang (random algorithm)
Use a random number generator of software or hardware to determine which pages are replaced in the main memory. The algorithm is simple and easy to implement. However, this algorithm does not take advantage of the history of the page scheduling situation in the main memory, nor does it reflect the local nature of the program, so the hit rate is low.
b. FIFO scheduling algorithm
FIFO scheduling algorithm according to the page into the memory of the time successively select the page, the algorithm implementation needs to be in accordance with the time of entry into a queue, each scheduling team first page to be eliminated. His advantage is relatively easy to implement, can take advantage of the main memory page scheduling situation of historical information, but he did not reflect the program's locality, because the first to transfer into the primary memory of the page, it is likely to be the most frequently used pages.
C. Least recent scheduling algorithm LFU
FIFO scheduling algorithm does not consider the use of the page, in most cases, poor performance. According to the local characteristics of the program execution, once the program has the location of some code and data, they will be frequently accessed over a period of time, so the least recent scheduling in the selection of obsolete pages is to consider the most recent use of the page, always choose the least used in the recent period of time to eliminate the page. The algorithm implementation is the time that the record page that needs to set the data structure for each page has gone through since the last visit.
D. Recent least common scheduling algorithms LRU
Because the design of the loop structure is often used, according to the local characteristics of the program execution, it can be envisaged that the Diamo code and data that are often in the direction for a period of time will also be often in the future, it is obvious that such a page should not be eliminated. Recently, the most infrequently used scheduling algorithm is always based on the number of pages accessed over a period of time to choose the elimination of the page, no time to eliminate the least visited pages. The algorithm implementation is required to set the counter for each page, record the number of visits. The counter has hardware or operating system auto-timed zeroing.
E. Optimal replacement algorithm OPT
The centralized page scheduling algorithm described above is based on the historical information of the main memory surprisingly in the page scheduling situation, he assumes that in the future main memory out of the page scheduling situation based on the historical information, he assumes that in the future, the primary storage page scheduling situation in the past period of time the main memory page scheduling is the same. Obviously, this hypothesis is not always true, the best algorithm is to choose the longest in the future is not the location of the page is the most replaced page, the algorithm hit rate must be the highest. He is the optimal replacement algorithm, but also the implementation of the OPT algorithm, the only way is to let the program execute one side, record the actual page address flow situation, according to the page address stream to find the current page to be replaced, obviously, this is unrealistic, therefore, the OPT algorithm is just an idealized algorithm, however, Special is also a very useful algorithm, in fact, often used to evaluate the other page scheduling algorithm good or bad standard, in the case of other conditions, which page scheduling algorithm hit rate and opt to go in, then, he is a better page replacement algorithm
But also dispatch book and but also interrupt rate, pages replacement rate calculation:
The number of pages that are missing from the missing pages
Page Break rate = Number of pages that have been interrupted/
Page count is the number of pages scheduled to be paged in to new pages
Page number Replacement rate = paging/Total pages
2) Determine whether a page scheduling algorithm is good or bad
First, the hit rate is high, but the algorithm is easy to achieve.
2. Important application of Li Chu page scheduling algorithm
1. Replacement of storage pages in virtual storage
Block substitution in 2.Cache
3. Substitution of block tables in the fast and slow tables in virtual memory
4. Virtual storage where the user base address register is replaced