search
HomeWeb Front-endHTML TutorialMemory management paging and page fault calculation_html/css_WEB-ITnose

1. What is a missing page?

To put it bluntly: Page fault is defined as all memory blocks are initially empty, so the page used for the first time will generate a page fault, that is, if the page number to be entered does not exist in the memory, it will occur. Missing pages. After understanding this, it becomes easier to solve the problem of page missing calculation.

2. First-in, first-out scheduling algorithm (FIFO)

This scheduling algorithm always eliminates the latest page entered into the main memory. This scheduling algorithm is very simple. It arranges the pages into a page number queue in the order in which they are loaded into the main memory. Whenever a page fault is entered, the page that enters the earliest is eliminated.

For example: For example, the page numbers to be accessed in sequence are: 0 1 2 3 2 1 3 2 5 2 3 6 2 1 4 2. Now there are only three main memories available. If FIFO scheduling is used, Please simulate the scheduling process and calculate the number of page fault interrupts?

0 enters, a page fault interrupt occurs (1 time), the page number in the memory at this time: 0
1 enters, a page fault interrupt occurs (1 time), the page number in the memory at this time: 01
2 enters, a page fault interrupt occurs (1 time), the page number in the memory at this time: 012
3 enters, 0 is eliminated, a page fault interrupt occurs (1 time), 3 replaces the position of 0, and the memory Page number in: 123
2 Enter, there is no page fault interrupt, because page number 2 already exists in the memory, the page number in the memory is still: 123
1 Enter, page number 1 exists in the memory, no A page missing interrupt occurs. At this time, the page number in the memory is: 123
3Enter, the same as above, no page missing interrupt occurs, the page number in the memory is: 123
3Enter, the same as above, no page missing interrupt occurs , the page number in the memory is: 123
5 enters. At this time, the longest time for 312 is: 1, so 5 replaces 1, and a page fault interrupt occurs (1 time). At this time, the page in the memory No.: 235
6Enter, there is no page missing interrupt, the page number in the memory: 335
6Enter, there is a page missing interrupt (1 time), the eliminated page is No. 2, the page number in the memory is 356
2 Enter, a page missing interrupt occurs (1 time), the eliminated page number is 3, the page number in the memory is 5662
1 Enter, a page missing interrupt occurs (1 time), the eliminated page number is 5 No., the page number in the memory is 621
4 enters, a page fault interrupt occurs (1 time), the eliminated page number is 6, the page number in the memory is 214
2 enters, no page fault interrupt occurs , the page number in the memory is 214

Therefore, if the first-in-first-out scheduling algorithm is used, a total of 8 page fault interrupts will occur, and the memory simulation situation is as follows:


Enter

Time

0

1

2

2

1

2

2

2

1

2

Morning

0

0

0

1

1

1

1

1

2

2

2

2

1

1

2

2

2

2

2

2

1

1

Late

2

1

Whether

missing page

is

is

is

Yes

Not

No

It’s not

It’s

It’s not

It’s not

is

is

Yes

Yes

No


*The red number is the latest page number entered into the memory
For the first-in-first-out simulation process, it is not difficult to find the following characteristics:
1. First If it enters the memory for the first time, there must be a page fault;
2. If there is no page fault, the consecutive columns are the same;
3. The eliminated page is the one that has stayed in the memory the longest;

3. The most recently unused scheduling algorithm (LRU)

The most recently unused scheduling algorithm believes that pages that have been frequently used recently may be accessed soon, so they cannot be called out. On the contrary, if there are pages that have not been visited in the past period, they may not be visited in the near future. Therefore, when you need to load a new page, you should select the page that has not been used for the longest time in the recent period.

Still taking the above example, using LRU scheduling,
First, 0 enters, and the page is missing (1 time). At this time, the page numbers in the memory are in the order of frequency of use: 0
1 Enter, page missing (1 time), the page numbers in the memory are in the order of frequency of use: 01
2 Enter, page is missing (1 time), the page numbers in the memory are in the order of frequency of use: 012
3Enter, page missing (1 time), the longest unused page number is 0, replaced by 3. At this time, the page numbers in the memory are in the order of frequency of use: 123
2Enter, no page missing, At this time, the page numbers in the memory are in the order of frequency of use: 132
1 Enter, there is no page shortage, the page numbers in the memory are in the order of frequency of use: 321
3 Enter, there is no page shortage, and the memory is at this time The order of page number usage frequency: 213
2 Enter, there is no page missing, the page number usage frequency order in the memory at this time: 1332
5 Enter, page missing (1 time), the longest unused page The page number is No. 1 and is eliminated. At this time, the order of page number usage frequency in the memory is: 325
3Enter, there is no page shortage. At this time, the order of page number usage frequency in the memory is: 352
3Enter , there is no page missing. At this time, the page number usage frequency sequence in the memory is: 523
6Enter, page missing (1 time), at this time the page number usage frequency sequence in the memory is: 236
2 Enter, There is no page shortage. At this time, the order of page number usage frequency in the memory: 362
1 enters, page missing (1 time), the page number that has not been used for the longest time is 3, at this time, the order of page number usage frequency in the memory : 621
4 entry, page missing (1 time), the page number that has not been used for the longest time is 6, the order of page number usage frequency in the memory at this time: 214
2 entry, no page missing, the memory at this time The order of page number usage frequency: 142

Therefore, using the most recent scheduling algorithm that has not been used for a long time, its number of page misses: 8 times

Its scheduling simulation in memory is as shown in the table below Display:

Use

frequency

0

1

2

2

1

2

2

1

Long time

No use

0

0

0

1

1

2

1

2

2

1

1

1

2

2

1

2

2

2

1

Recently

Used

2

2

1

2

1

2

Yes

Missing page

Yes

Yes

Yes

Yes

No

No 🎜>Not

Not

不是

不是

不是

Yes

Yes

No


四、小结

  多拿笔画画~~~


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesThe Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesApr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Is HTML easy to learn for beginners?Is HTML easy to learn for beginners?Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

What is an example of a starting tag in HTML?What is an example of a starting tag in HTML?Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

How to use CSS's Flexbox layout to achieve centering alignment of dotted line segmentation effect in menu?How to use CSS's Flexbox layout to achieve centering alignment of dotted line segmentation effect in menu?Apr 05, 2025 pm 01:24 PM

How to design the dotted line segmentation effect in the menu? When designing menus, it is usually not difficult to align left and right between the dish name and price, but how about the dotted line or point in the middle...

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use