Operating System paging Mechanism

Source: Internet
Author: User

The differences between Win32 compilation and the compilation in previous textbooks

Of course the Win32 interface is involved. If there is no interface, there will be a ghost.

We used to learn a 16-bit dos assembly.

Now the technology is improving, learning 32-bit nnd

In dos, 16 BITs adopt the segment register addressing mode, that is, the second-level addressing mode.

Specifically, the first N bits are the register addresses, which are stored in the registers, and the last N bits are the offset addresses. This is really painful to use. It is more difficult to search for segments than to catch super mm; direct addressing can be achieved by chasing mm, regardless of the content of the obtained address, but results can be obtained directly.

The figure above means to first use the segment register to find the segment, and then use the address offset to find the physical address in the segment! This is the legendary real-mode addressing mode or DoS addressing mode;

The addressing range of this register is small and only 1 m.

The registers of 80386 are 32-bit. it means you can directly use this general register to find the 4 GB address space. Is it nice, but don't forget that 4 GB is a virtual address space, before using it, you must also ask the physical storage to apply for it. If the application fails, null is returned (For details, refer to the Windows core programming ). it is said that the segment register is still useful in the 32-bit operating system and still does not quite understand it, the number of priority levels of code that can be written to the database. If the code is allowed to be executed or not, the protection issues will arise. To solve these problems, you must define some security attributes for an address space. The segment register is then used. However, if there are too many parameters that involve attributes and the lower part of the protection mode, they must be expressed with 64-bit long data. We call the 64-bit attribute data segment descriptor (segment descriptor ))

What I don't understand is how these attributes are associated with segment registers, and how do I associate segment registers with segment registers when common registers are searched !!!!

 

 

 

 

Now let's get started with this article: Paging mechanism!

The benefit of using paging is that the memory can be easily processed to solve the memory fragmentation problem. ==== a bunch of linear addresses are composed of those page tables. In fact, this is a level-2 addressing, manage the page table

The following describes how the virtual memory is implemented using a page table.

A page table can specify a page that is not truly mapped to the physical memory. When the location of a page accessed is no longer in the physical memory, the system will encounter an exception, then the system calls the content on the hard disk to the physical memory.

Or film watching

Use a page table to run programs in windows,

The system maintains a page table for each process. The operating system code, data, and system DLL are transparent to these page tables. The difference is user DLL and Process Code data;

Conclusion:

Each application has its own 4 GB addressing space. This space can store the operating system, system DLL, and user DLL Code, among which there are various functions that can be called by programs. Aside from other spaces, the rest is the application code, data, and address space that can be allocated.

Linear address spaces of different applications are isolated. Although they exist simultaneously in the physical memory, the code and data of other applications are not mapped to the addressable linear address in the time film to which a program belongs, therefore, it is not accessible. From the programming point of view, the program can use a 4 GB addressing space, and this space is "private.

The DLL program does not have its own "private" space. They are always mapped to the address space of other applications and run as part of other applications. The reason is simple. If it does not belong to the same address space as other programs, how should the application call it?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.