Home > Common Problem > What is the principle of program locality?

What is the principle of program locality?

藏色散人
Release: 2022-01-24 14:23:12
Original
16224 people have browsed it

The principle of locality of the program means that the program shows locality rules when executed, that is, within a period of time, the execution of the entire program is limited to a certain part of the program; accordingly, the storage space accessed by the execution It is also limited to a certain memory area; the principle of locality is also expressed as "temporal locality" and "space locality".

What is the principle of program locality?

#The operating environment of this article: Windows 10 system, Dell G3 computer.

What is the principle of locality of program?

The principle of locality of the program means that the program shows locality rules when executed, that is, within a period of time, the execution of the entire program is limited to a certain part of the program. Correspondingly, the storage space accessed by execution is also limited to a certain memory area. The principle of locality is also expressed as: locality in time and locality in space. Temporal locality means that if an instruction in the program is once executed, the instruction may be executed again soon; if some data is accessed, the data may be accessed again soon. Spatial locality means that once a program accesses a certain storage unit, its nearby storage units will also be accessed soon after.

Principle of locality of program:

In addition, based on the theory of locality of program, Denning proposed the working set theory. The so-called working set refers to the set of pages that are frequently accessed when the process is running. Obviously we know that as long as the working set of the program is concentrated in the memory, the number of page faults of the process can be greatly reduced; otherwise, the process will frequently have page fault interruptions during the running process, resulting in frequent page transfer in/out phenomena. , resulting in a decrease in system performance and even "jitter".

The working set can be divided by two methods: fixed time or fixed length page. When thrashing occurs, it indicates that the system load is too large, and processor balancing scheduling is usually used. The other is to control the page fault rate. When the page fault rate reaches the upper limit, the memory allocation amount is increased; when the page fault rate reaches the lower limit, the memory allocation amount is reduced.

For more related knowledge, please visit the FAQ column!

The above is the detailed content of What is the principle of program locality?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template