Linux Space & amp; MMU, linux Space

Source: Internet
Author: User

Linux Space Division & MMU, linux Division
Linux Kernel Address Space Division
Generally, 32-bit Linux kernel address space is divided into 0 ~ 3G is the user space, 3 ~ 4G is the kernel space. Note that the 32-bit kernel address space is divided, and the 64-bit kernel address space is divided differently. In a 32-bit Linux system, the entire 4 GB virtual storage space is from 0x00000000 to 0xFFFFFFFF.
Kernel space: the kernel space indicates the code or data running in the Super User mode of the processor. The kernel space occupies 1 GB linear address space from 0xC0000000 to 0xffffffffff, the Kernel linear address space is shared by all processes, but only processes running in the kernel state can access it. User processes can switch to the kernel state to access the kernel space through system calls, the address generated when the process runs in the kernel state belongs to the kernel space.
User space: the user space occupies 3 GB linear address space from 0x00000000 to 0xBFFFFFFF. Each process has an independent 3 GB user space. Therefore, the user space is exclusive to each process, however, the kernel thread does not have user space because it does not generate user space addresses. In addition, the user space of the parent process shared (inherited) only uses the ing relationship between the user linear address and the physical memory address of the parent process, rather than sharing the user space of the parent process. Processes running in the user State and kernel state can access the user space.
Such a user program can use its own 0 ~ 3G space. At the same time, you can use system calls and other 1g space for kernel space. In this way, each application can use 4g space.
The Linux operating system and the driver run in the kernel space, and the application run in the user space. The two cannot simply use pointers to transmit data, because Linux uses the virtual memory mechanism, user space data may be swapped out. When the kernel space uses the user space pointer, the corresponding data may not be in the memory.
Kernel space is usually divided once again, for example, ZONE_DMA, ZONE_NORMAL, and ZONE_HIGHMEM. The above analysis shows that ZONE_DMA and ZONE_NORMAL can be mapped to physical memory using simple ing relationships, because this part of space is consistent with the kernel for each application, but the user space is 0 ~ independent of each application ~ Ing between 3G space and 3G space is relatively more troublesome (this is a great convenience for users to write applications ). The ing of ZONE_NORMAL is generally implemented using an offset. For example, if the actual memory address starts with 0x0, you only need to add an offset 0xc0000000 (3G. However, if the 1 GB space is mapped in this way, the kernel space can only access 1 GB space of the actual physical memory, so there is a high-end memory to solve this problem. High-end memory is generally 896 ~ MB space in this section. When the kernel wants to access the memory above MB physical address, it ranges from 0xF8000000 ~ In the range of 0xFFFFFFFF address space, find a logical address space of the corresponding size and borrow it for a while. Use this logical address space to create the physical memory mapped to the table you want to access (that is, to fill the kernel PTE page table), temporarily use it for a while, and return it after use. In this way, others can also use this address space to access other physical memory, so that they can use a limited address space to access all physical memory.
For the s3c24ing of user space addresses in s3c2440, the page table method is used. Note that the page table is a dynamic concept, that is to say, this page table may be modified as the program runs. MMU provides two basic functions:
>>> Responsible for switching between virtual addresses and physical addresses
This function means that each application mentioned above has its own independent 0 ~ 3G user space, where each application is located ~ In 3G space, all data is displayed. The page table mentioned above is used to convert virtual addresses and physical addresses when MMU is working.

>>> Provides hardware-based Memory Access Authorization
In the ARM processor, MMU divides the entire storage space into up to 16 domains and records them as D0 ~ D15: each domain corresponds to a certain storage region, which has the same access control attributes. In the ARM processor, the access permissions for each domain in MMU are set by two places in the C3 register of CP15, And the C3 register can set the access permissions for 16 domains.

In linux, it is best to set the swap partition to twice the memory capacity: when the system is fully loaded, some of the memory occupied by the program will be written into the swap partition, when your system suddenly goes down, you can ensure that there is enough space in your swap to put down the memory for later query.
Linux space allocation

Partition:
Generally, only/, swap, And/boot are required.
You can also separate the following partitions:/home,/tmp,/var,/usr.
Generally, MB of boot is enough. Swap is generally 1-2 times the memory size. If the memory size is large, it will be smaller. If the memory size is small, it will be larger. Other partitions, depending on the actual needs,/home is the user's home directory, depending on the number of users and the data of each user. /Tmp m and/var M. /Usr has a lot of things here, including the user's application software, which must be installed under this, which should be slightly larger. The partition format is EXT3.

Redhat linux 50 division of available space

Sda is your array.
Fdisk/dev/sda
Enter m to see help
Input n to add a new partition.
P primary Partition
Input size
W save
Then mkfs. ext3
Then edit/etc/vfstab to enable automatic mount.

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.