used for the longest period of time. Use a page replacement algorithm that ensures the lowest possible page fault rate for a fixed number of frames.
For example, on a sample reference string, the optimal page replacement algorithm generates 9 page faults, as shown in Figure 3.36. The first reference causes a fill fault in 3 empty frames. The reference to page 2 replaces page 7 because 7 will not be used until reference 18, whereas page 0 will be used at 5 and page 1 at 14. The reference to page 3 replaces page 1 because page 1 will be the last of the 3 pages in memory to be referenced again. With only 9 page faults, the optimal replacement is much better than the FIFO algorithm, which has 15 faults. (If we ignore the first 3 faults that all algorithms encounter, the optimal replacement is twice as good as the FIFO replacement.) Indeed, no replacement algorithm can process the reference string in 3 frames with fewer than 9 faults.
However, the optimal page replacement algorithm is difficult to implement because it requires future knowledge of the reference sequence. Therefore, the optimal algorithm is used mainly for comparative studies. For example, it can be useful to know that, although an algorithm is not optimal, it is within 12.3% of the optimal being bad, and within 4.7% of the optimal being average.

Figure 3.36 Optimal page replacement algorithm
Maybe you are interested!
-
Solutions for tourism development in Tien Lang - 10
zt2i3t4l5ee
zt2a3gstourism, tourism development
zt2a3ge
zc2o3n4t5e6n7ts
- District People's Committees and authorities of communes with tourist attractions should support, promote, and provide necessary information to people, helping them improve their knowledge about tourism. Raise tourism awareness for local people.
*
* *
Due to limited knowledge and research time, the thesis inevitably has shortcomings. Therefore, I look forward to receiving guidance from teachers, experts as well as your comments to make the thesis more complete.
Chapter III Conclusion
Through the issues presented in Chapter II, we can come to some conclusions:
Based on the strengths of available tourism resources, the types of tourism in Tien Lang that need to be promoted in the coming time are sightseeing and resort tourism, discovery tourism, weekend tourism. To improve the quality and diversify tourism products, Tien Lang district needs to combine with local cultural tourism resources, at the same time combine with surrounding areas, build rich tourism products. The strengths of Tien Lang tourism are eco-tourism and cultural tourism, so developing Tien Lang tourism must always go hand in hand with restoring and preserving types of cultural tourism resources. Some necessary measures to support and improve the efficiency of exploiting tourism resources in Tien Lang are: strengthening the construction of technical facilities and labor force serving tourism, actively promoting and advertising tourism, and expanding forms of capital mobilization for tourism development.
CONCLUDE
I Conclusion
1. Based on the results achieved within the framework of the thesis's needs, some basic conclusions can be drawn as follows:
Tien Lang is a locality with great potential for tourism development. The relatively abundant cultural tourism resources and ecological tourism resources have great appeal to tourists. Based on this potential, Tien Lang can build a unique tourism industry that is competitive enough with other localities within Hai Phong city and neighboring areas.
In recent years, the exploitation of the advantages of resources to develop tourism and build tourist routes in Tien Lang has not been commensurate with the available potential. In terms of quantity, many resource objects have not been brought into the purpose of tourism development. In terms of time, the regular service time has not been extended to attract more visitors. Infrastructure and technical facilities are still weak. The labor force is still thin and weak in terms of expertise. Tourism programs and routes have not been organized properly, the exploitation content is still monotonous, so it has not attracted many visitors. Although resources have not been mobilized much for tourism development, they are facing the risk of destruction and degradation.
2. Based on the results of investigation, analysis, synthesis, evaluation and selective absorption of research results of related topics, the thesis has proposed a number of necessary solutions to improve the efficiency of exploiting tourism resources in Tien Lang such as: promoting the restoration and conservation of tourism resources, focusing on investment and key exploitation of ecotourism resources, strengthening the construction of infrastructure and tourism workforce. Expanding forms of capital mobilization. In addition, the thesis has built a number of tourist routes of Hai Phong in which Tien Lang tourism resources play an important role.
Exploiting Tien Lang tourism resources for tourism development is currently facing many difficulties. The above measures, if applied synchronously, will likely bring new prospects for the local tourism industry, contributing to making Tien Lang tourism an important economic sector in the district's economic structure.
REFERENCES
1. Nhuan Ha, Trinh Minh Hien, Tran Phuong, Hai Phong - Historical and cultural relics, Hai Phong Publishing House, 1993
2. Hai Phong City History Council, Hai Phong Gazetteer, Hai Phong Publishing House, 1990.
3. Hai Phong City History Council, History of Tien Lang District Party Committee, Hai Phong Publishing House, 1990.
4. Hai Phong City History Council, University of Social Sciences and Humanities, VNU, Hai Phong Place Names Encyclopedia, Hai Phong Publishing House. 2001.
5. Law on Cultural Heritage and documents guiding its implementation, National Political Publishing House, Hanoi, 2003.
6. Tran Duc Thanh, Lecture on Tourism Geography, Faculty of Tourism, University of Social Sciences and Humanities, VNU, 2006
7. Hai Phong Center for Social Sciences and Humanities, Some typical cultural heritages of Hai Phong, Hai Phong Publishing House, 2001
8. Nguyen Ngoc Thao (editor-in-chief, Tourism Geography, Hai Phong Publishing House, two volumes (2001-2002)
9. Nguyen Minh Tue and group of authors, Hai Phong Tourism Geography, Ho Chi Minh City Publishing House, 1997.
10. Nguyen Thanh Son, Hai Phong Tourism Territory Organization, Associate Doctoral Thesis in Geological Geography, Hanoi, 1996.
11. Decision No. 2033/QD – UB on detailed planning of Tien Lang town, Hai Phong city until 2020.
12. Department of Culture, Information, Hai Phong Museum, Hai Phong relics
- National ranked scenic spot, Hai Phong Publishing House, 2005. 13. Tien Lang District People's Committee, Economic Development Planning -
Culture - Society of Tien Lang district to 2010.
14.Website www.HaiPhong.gov.vn
APPENDIX 1
List of national ranked monuments
STT
Name of the monument
Number, year of decisiondetermine
Location
1
Gam Temple
938 VH/QĐ04/08/1992
Cam Khe Village- Toan Thang commune
2
Doc Hau Temple
9381 VH/QĐ04/08/1992
Doc Hau Village –Toan Thang commune
3
Cuu Doi Communal House
3207 VH/QĐDecember 30, 1991
Zone II of townTien Lang
4
Ha Dai Temple
938 VH/QĐ04/08/1992
Ha Dai Village –Tien Thanh commune
APPENDIX II
STT
Name of the monument
Number, year of decision
Location
1
Phu Ke Pagoda Temple
178/QD-UBJanuary 28, 2005
Zone 1 - townTien Lang
2
Trung Lang Temple
178/QD-UBJanuary 28, 2005
Zone 4 – townTien Lang
3
Bao Khanh Pagoda
1900/QD-UBAugust 24, 2006
Nam Tu Village -Kien Thiet commune
4
Bach Da Pagoda
1792/QD-UB11/11/2002
Hung Thang Commune
5
Ngoc Dong Temple
177/QD-UBNovember 27, 2005
Tien Thanh Commune
6
Tomb of Minister TSNhu Van Lan
2848/QD-UBSeptember 19, 2003
Nam Tu Village -Kien Thiet commune
7
Canh Son Stone Temple
2160/QD-UBSeptember 19, 2003
Van Doi Commune –Doan Lap
8
Meiji Temple
2259/QD-UBSeptember 19, 2002
Toan Thang Commune
9
Tien Doi Noi Temple
477/QD-UBSeptember 19, 2005
Doan Lap Commune
10
Tu Doi Temple
177/QD-UBJanuary 28, 2005
Doan Lap Commune
11
Duyen Lao Temple
177/QD-UBJanuary 28, 2005
Tien Minh Commune
12
Dinh Xuan Uc Pagoda
177/QD-UBJanuary 28, 2005
Bac Hung Commune
13
Chu Khe Pagoda
177/QD-UBJanuary 28, 2005
Hung Thang Commune
14
Dong Dinh
2848/QD-UBNovember 21, 2002
Vinh Quang Commune
15
President's Memorial HouseTon Duc Thang
177/QD-UBJanuary 28, 2005
NT Quy Cao
Ha Dai Temple
Ben Vua Temple
Tien Lang hot spring
div.maincontent .p { color: black; font-family:"Times New Roman", serif; font-style: normal; font-weight: normal; text-decoration: none; font-size: 14pt; margin:0pt; } div.maincontent p { color: black; font-family:"Times New Roman", serif; font-style: normal; font-weight: normal; text-decoration: none; font-size: 14pt; margin:0pt; } div.maincontent .s1 { color: black; font-family:"Times New Roman", serif; font-style: normal; font-weight: normal; font-size: 16pt; } div.maincontent .s2 { color: black; font-family:"Times New Roman", serif; font-style: italic; font-weight: bold; text-decoration: none; font-size: 14pt; } div.maincontent .s3 { color: black; font-family:"Times New Roman", serif; font-style: italic; font-weight: normal; text-decoration: none; font-size: 14pt; } div.maincontent .s4 { color: black; font-family:"Times New Roman", serif; font-style: normal; font-weight: normal; font-size: 14pt; } div.maincontent .s5 { color: black; font-family:"Times New Roman", serif; font-style: normal; font-weight: bold; font-size: 14pt; } div.maincontent .s6 { color: black; font-family:"Times New Roman", serif; font-style: normal; font-weight: normal; text-decoration: none; font-size: 14pt; } div.maincontent .s7 { color: black; font-family:"Times New Roman", serif; font-style: normal; font-weight: bold; text-decoration: none; font-size: 14pt; } div.maincontent .s8 { color: black; font-family:"Times New Roman", serif; font-style: normal; font-weight: normal; text-decoration: none; font-size: 9pt; vertical-align: 6pt; } div.maincontent .s9 { color: black; font-family:"Times New Roman", serif; font-style: normal; font-weight: bold; text-decoration: none; font-size: 12pt; } div.maincontent .s11 { color: black; font-family:"Times New Roman", serif; font-style: normal; font-weight: normal; tex -
Import-export and investment activities at Vietnam Paper Corporation in recent years - Current situation and solutions - 14 -
Glass and Construction Ceramics Market in Recent Times -
Company Performance in Recent Years -
Political and Legal Significance of Criminal Record Expungement
3) Replace LRU page
If the optimal algorithm is not feasible, perhaps an approximation to the optimal algorithm is possible. The main difference between the FIFO and OPT algorithms is that FIFO uses the time when the page is brought into memory; the OPT algorithm uses the time when the page is used. If we are going to use the recent past as an approximation of the near future, then we will replace the page that has not been used for the longest period of time (Figure 3.37). This approach is the least-recently-used (LRU) algorithm.

Figure 3.37 LRU page replacement algorithm
LRU page replacement associates with each page the last time the page was used. When a page must be replaced, LRU selects the page that has not been used for the longest period of time. This strategy is an optimal page replacement algorithm that searches backward in time rather than forward. (Let S R be the reverse order of the reference sequence S, then the page fault rate for the OPT algorithm on S is the same as the page fault rate for the OPT algorithm on S R . Similarly, the page fault rate for the LRU algorithm on S is the same as the page fault rate for the LRU algorithm on S R )
The results of applying LRU replacement to a typical reference string are shown in Figure 3.38. The LRU algorithm generates 12 errors. The first 5 errors are similar to the optimal replacement. However, when the reference to page 4 occurs, the LRU replacement finds that 3 frames in memory, page 2 is the most recently used. The most recently used page is page 0, and just before page 3 is used. Therefore, the LRU algorithm replaces page 2, not knowing that page 2 is about to be used. Then, when it causes a page 2 fault, the LRU algorithm replaces page 3, of the 3 pages in memory {0, 3, 4}, page 3 is the least recently used. Despite this problem, the LRU replacement with 12 errors is still better than the FIFO replacement with 15.

Figure 3.38 page replacement algorithm
LRU policy is often used as a page replacement algorithm and is considered good. The main issue is how to implement LRU replacement. An LRU page replacement algorithm
may require hardware assistance. The problem is to determine the order for the frames defined by the most recent use time. Two possible implementations are:
- Counters : In the simplest case, we attach to each page table entry a usage time field and add to the CPU a logical clock or counter. The clock is incremented for each memory reference. Whenever a reference to a page is made, the contents of the clock register are copied to the usage time field in the page table entry for that page. In this way, we always have the time of the last reference to each page. We replace the page with the smallest usage time value. This mechanism requires a page table lookup to find the LRU page and a write to memory (to the usage time field in the page table) for each memory access. The times must also be maintained when the page tables are changed (due to CPU scheduling). Exceeding the clock limit must be considered.
- Stack : Another approach to implementing LRU replacement is to keep a stack of page numbers. Whenever a page is referenced, it is removed from the stack and placed on the top. In this approach, the top of the stack is always the most recently used page and the bottom is the LRU page (Figure 3.39). Since entries must be removed from the middle of the stack, it is best implemented by a doubly linked list with head and tail pointers. Removing a page and placing it on the top of the stack then requires changing 6 pointers in the worst case. Each update is less expensive but does not require finding a replacement; the tail pointer points to the bottom of the stack as the LRU page. This approach is particularly suitable for software or microcode implementations of LRU replacement.
Optimization and LRU replacement do not suffer from Belady's paradox. There is a class of page replacement algorithms called stack algorithms, which never suffer from Belady's paradox. A stack algorithm is an algorithm for which it can be shown that the set of pages in memory for n frames is always a subset of the set of pages that are in memory for n + 1 frames. For LRU replacement, the set of pages in memory is the n most recently referenced pages. If the number of pages is increased, then these n pages will still be the most recently referenced pages and thus will remain in memory.
Note that LRU implementation will probably have no hardware assistance except for the TLB register. Updates to clock or stack fields must be performed for
per memory reference. If we used interrupts for each memory reference, allowing software to update data structures, it would slow down each memory reference by nearly 1/10. Very few systems can afford that level of memory management overhead.

Figure 3.39 uses the stack to record recent page references.
4) Approximate LRU page replacement algorithm
Very few computer systems provide complete hardware support for LRU page replacement. Some systems do not provide any hardware support and other page replacement algorithms (such as FIFO algorithms) must be used. However, many systems provide some support in the form of a reference bit. The reference bit for a page is set by the hardware whenever that page is referenced (read or written to any bit in the page). The reference bits are associated with each entry in the page table.
Initially, all bits are cleared (to 0) by the operating system. When a user process executes, the bit assigned to each referenced page is set (to 1) by the hardware. After that time, we can determine which pages are used and which are not by examining the reference bits. We do not know the order of use, but we know which pages are used and which are not. The partial order information leads to many page replacement algorithms that approximate LRU replacement.
a) Algorithm for auxiliary reference bits
We can get additional sequence information by recording reference bits at regular intervals. We can keep one byte for each page in a table in memory. At regular intervals (every 100 milliseconds)
seconds), a timer interrupt transfers control to the operating system. The operating system moves the reference bit for each page into the most significant bit of the byte, shifting the remaining bits right by 1 bit. The least significant bit is cleared. The 8-bit shift register can hold a history of page usage for the last 8 times. If the shift register contains 00000000, the page has not been used for 8 times; a page that has been used at least once each time will have a shift register value of 11111111.
A register with a historical register value of 11000100 is more recently used than a page with 01110111. If we interpret these 8 bits as an unsigned integer, the page with the lowest number is the LRU page and it can be replaced. However, these numbers are not guaranteed to be unique, we replace all pages with the lowest value or use a FIFO to choose between them.
Of course, the number of history bits can vary and can be chosen (depending on available hardware) to perform the update as quickly as possible. In extreme cases, the number can be reduced to zero, leaving only the reference bit itself. This algorithm is called the second-chance page-replacement algorithm.
b) Second chance algorithm

Figure 3.40 Second chance page replacement algorithm
The second-chance page replacement algorithm is essentially a FIFO replacement algorithm. However, when a page is selected, we examine its reference bit. If this bit is 0, we proceed to replace the page. However, if the reference bit is set to 1, we give the page a second chance and move to select the next FIFO page. When a page receives a second chance, its reference bit is cleared and its arrival time is reset to the current time. Therefore, a page that is given a second chance will not be replaced until all other pages have been replaced (or given a second chance). Additionally, if a page is used frequently enough to keep its reference bit set, it will never be replaced.
One way to implement the second-chance algorithm is as a circular queue. A pointer indicates which page is to be replaced next. When a frame is requested, the pointer is incremented until it finds a page with the reference bit 0. As it increments, it clears the reference bits (Figure 3.12). Once the victim page is found, the page is replaced and the new page is inserted into the circular queue in that position. Note that, in the worst case when all bits are set, the pointer cycles through the entire queue, giving each page a second chance. Second-chance replacement becomes a FIFO replacement if all bits are set.
c) Advanced Second Chance Algorithm
We can improve the second chance algorithm by considering both the reference and modifier bits as an ordered pair. With these two bits, we have four possible cases:
1) (0,0) is not used recently and has not been modified - the best page to replace.
2) (0,1) is not used recently but has been modified - not so good as the page needs to be written before replacing.
3) (1,0) has been used recently but has not been modified - it will probably be used again soon.
4) (1,1) is recently used and modified-the page will likely be reused soon and the page will need to be written to disk before it can be replaced.
When replacing a requested page, each page is in one of four situations. We use the same mechanism as the clock algorithm, but instead of looking at the page
If the page we are pointing to has the reference bit set to 1, we look at the instance to which the page belongs. We replace the first page encountered in the lowest case that is not empty. We may have to scan the circular queue many times before we find a page to replace.
This algorithm is used in the Macintosh virtual memory management mechanism. The main difference between this algorithm and the simpler clock algorithm is that we refer to those pages which are modified to reduce the amount of I/O required.
d) Replace page based on count
There are many other algorithms that can be used for page replacement. For example, we could keep a reference counter for each page and develop the following two mechanisms:
- The least frequently used (LFU) page-replacement algorithm requires that the page with the smallest count be replaced. The reason for this choice is that the page that is used should have a large reference counter. This algorithm suffers from the situation: the page is used a lot during initialization but is never used again. Because it is used a lot, it has a large counter and remains in memory even though it is no longer needed. One solution is to shift the counter right by 1 bit at regular intervals, forming an exponentially decreasing average usage counter.
- The most frequently used (MFU) page-replacement algorithm replaces the page with the largest count value, that is, the page that is used the most.
3.2.6 Frame allocation
How do we allocate a fixed amount of free memory between different processes? If we have 93 free frames and 2 processes, how many frames will each process get?
The simplest case of virtual memory is a single-tasking system. Consider a single-tasking system with 128 KB of memory made up of 1 KB pages. Therefore, there are 128 page frames. The operating system can take 35 KB, leaving 93 page frames for the user process. Under pure request paging, all the first 93 page frames are placed on the free frame list. When a user process starts
As it executes, it generates a sequence of page faults. The first 93 page faults are free frames from the free frame list. When the free frame list is exhausted, a page replacement algorithm is used to select one of the 93 pages currently in memory to replace with the 94th page, etc. When a process terminates, the 93rd page frame is again replaced on the free frame list.
There are many variations on this simple strategy. We can ask the operating system to allocate all its buffers and table spaces from the free frame list.
When this space is not used by the operating system, it can be used to support user paging. We can try to keep 3 free page frames reserved on the free page frame list at all times. Thus, when a page fault occurs there is a free frame available for the page. While a page swap is occurring, a replacement can be chosen, and the page is then written to disk when the user process resumes execution.
Another change that can be made to the basic strategy is that the user process is allocated any free page frames.
Another problem arises when request paging is combined with multiprogramming.
Multiprogramming places two or more processes in memory at the same time.
- Minimum number of page frames
Frame allocation strategies are constrained in various ways. We cannot allocate more than the total number of available frames (without page sharing). We also allocate at least a minimum number of frames. Note that as the number of frames allocated to each process decreases, the page fault rate increases, reducing process execution.
In addition, the ability to perform unexpected allocations is limited to a few page frames, and there is a minimum number of page frames that must be allocated. The minimum number. This minimum number is specified by the computer architecture. Remember, when a page fault occurs before an instruction completes execution, the instruction must start over. Therefore, we must have enough page frames to hold all the different pages that any single instruction might refer to.
For example, consider a machine in which all instructions refer to memory with only one memory address. Therefore, we need at least one page frame for the instruction and one frame for the





