What are concept of physical address, logical address, and virtual memory in Java ? What are the page replacement algorithms in Java? What are dynamic link libraries and static link libraries in Java?
What are concept of physical address, logical address, and virtual memory in Java ?
1. Physical address: It is the final address of the address conversion. When the process executes instructions and accesses data when it is running, it must be accessed from the main memory through the physical address. It is the real address of the memory unit.
2. Logical address: refers to the address seen by computer users. For example: when creating an integer array with a length of 100, the operating system returns a logically continuous space: the pointer points to the memory address of the first element of the array. Since the size of the integer element is 4 bytes, the address of the second element is the starting address plus 4, and so on. In fact, the logical address is not necessarily the real address where the element is stored, that is, the physical address of the array element (the location in the memory bar). It is not continuous, but the operating system maps the logical address into continuous through address mapping. Yes, this is more in line with people's intuitive thinking.
3. Virtual memory: It is a technology of computer system memory management. It makes the application think that it has continuous available memory (a continuous and complete address space), but in fact, it is usually divided into multiple physical memory fragments, and some are temporarily stored on external disk storage. Data exchange at the time.
What are the page replacement algorithms in Java?
Request paging, also known as on-demand paging, means that "pages" that are not in the memory are called in when the process is executed, otherwise it may not be called in until the end of the program. The space reserved for pages in memory is limited, and pages are placed in memory in units of frames. In order to prevent excessive memory page faults in the process of requesting paging (that is, the required page is not currently in memory, data needs to be read from the hard disk, that is, page replacement is required) and the efficiency of program execution is reduced, we need to design some Page replacement algorithm, when pages are replaced with each other according to these algorithms, the error rate can be as low as possible. Commonly used page replacement algorithms are as follows:
First-in-first-out replacement algorithm (FIFO)
First-in-first-out, that is, eliminate the page that was imported first.
Optimal Replacement Algorithm (OPT)
Selecting the pages that will be used farthest in the future is an optimal solution, and it can prove that the number of missing pages is the smallest.
The least recently used (LRU) algorithm
That is, the page that has not been used the most recently is selected to be eliminated
Clock replacement algorithm
The clock replacement algorithm is also called NRU (Not Recently Used). The algorithm sets an access bit for each page, and links all pages in the memory into a circular queue through the link pointer.
What are dynamic link libraries and static link libraries in Java?
Static linking is to directly copy the required execution code to the calling place when compiling and linking. The advantage is that the dependent library is not needed when the program is released, that is, it is no longer necessary to release the library together, and the program can be executed independently, but the size It may be relatively large.
Dynamic linking means that the executable code is not copied directly when compiling, but a series of symbols and parameters are recorded, and the information is passed to the operating system when the program is running or loading. The operating system is responsible for loading the required dynamic library into the memory. And then when the program runs to the specified code, it shares the executable code of the dynamic library that has been loaded in the execution memory, and finally achieves the purpose of runtime connection. The advantage is that multiple programs can share the same piece of code without storing multiple copies on the disk. The disadvantage is that because it is loaded at runtime, it may affect the performance of the program's early execution.
Comments
Post a Comment