Analysis on multi-task of Linux (III.)

Source: Internet
Author: User

The first two has already said the multi-task switching principle, left a problem, that is, Linux skipped fragments, the logical address is always equal to the linear address then how to isolate the process?

Besides, there are a couple of concepts. 1. Physical memory-You can directly understand it as your memory bar. 2. Virtual memory-assuming your computer is 32-bit, then his address space is 4G, but suppose your memory is only 2 G, if some programs are assigned to more than 2G of data segment what to do? In fact, the x86 system uses virtual memory technology, he will read out the system's most unused memory data on the peripherals such as disk, and then put your excess content into memory, you seem to be incremental but in fact he is not, he is the use of other space. The memory you actually have becomes 4G. You feel like you're growing linearly, but you're actually being manipulated, and we don't have to worry about how the system can do this with 4G. (This is just a sense of opinion, the following will be official) 3. Logical address. In the program, the basic of the GCC compiler is the logical address, select the Sub + offset address composition. 4. Linear address (also called virtual address). The linear address is the segment base + offset address, in Linux because each segment base is 0, the virtual address is the logical address. 5. Linear address to physical address there is also a conversion is a paging conversion. Linux will be virtual address and physical address in 4k a unit size into a number of blocks, the virtual address and physical address is one by one corresponding to the virtual memory block called the page, the physical address block is called the page frame. So the problem is, the virtual address is greater than the physical address ah This is the case of 2, Linux is handled, Linux has a page failure function, Linux found the minimum use of physical memory of the page frame, let him fail and write to disk, and then put the page to access the page frame,  Finally, the mappings in the page table are modified. Each task will maintain a own page table, this page table is the virtual address to the physical address mapping relationship, different tasks the same virtual address will be mapped to a different physical address, the process system will do for us we do not care.   So the paging mechanism is the core of the Linux protection model. Reference http://www.cnblogs.com/curtful/archive/2012/02/16/2354496.html

Analysis on multi-task of Linux (III.)

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.