Collection
zero Useful+1
zero

address space

Memory size occupied by computer entity
The address space represents the memory size occupied by any computer entity. Such as peripherals, files, servers, or a network computer. The address space includes the physical space and virtual space
Chinese name
address space
Foreign name
address space
Represent
Memory size occupied by computer entity
address space
Including physical space and virtual space

Introduction

Announce
edit

Memory abstraction

stay computer In, each device and process is allocated an address space. The address space of the processor is determined by its Address bus as well as register decision. The address space can be divided into Flat - indicating that the starting space position is 0; Or Segmented -- indicates that the spatial position is determined by Offset decision. In some systems, address space type conversion can be performed. As for the IP address space, the IPV4 protocol did not foresee that the demand for IP addresses is so large that the 32-bit address space can no longer meet the demand. Therefore, the IPV6 protocol , supporting 128 bit address space [1]

Expose problems

Exposing the physical address to the process will cause the following serious problems. First, if User program Each of the addressable memory byte , they can easily (intentionally or accidentally) destroy the operating system, so that the system slowly stops running. This problem exists even when only one user process is running. Second, using this model, it is difficult to run multiple programs at the same time (if there is only one CPU, it will be executed in turn). stay personal computer It is common to open several programs at the same time (one word processor, one mail program, one Web browser , one of them is currently working, and the rest will be activated when the mouse is pressed). There is no match in the system physical memory In the case of abstraction, it is difficult to achieve the above scenarios, so we need other methods.

concept

Announce
edit
Multiple application program If they are in memory at the same time and do not affect each other, two problems need to be solved: protection and Reposition Let's look at an original solution to the former: mark a memory block with a protection key, and compare the key of the executing process with the protection key of each memory word it accesses. However, this method itself does not solve the latter problem, although this problem can be solved by Reposition Procedure, but this is a slow and complex solution.
A better approach is to create a new memory abstraction: the address space. Just as the concept of process creates a class of abstract CPUs to run programs, the address space creates an abstract memory for programs. An address space is a set of addresses that a process can use to address memory. Each process has its own address space, and this address space is independent of the address space of other processes (except in some special cases, processes need to share their address space).
The concept of address space is very general and appears in many occasions. As the number grows, the space becomes less and less, resulting in the need to use more digits.
The address space may not be numeric. Internet domain name It is also an address space. This address space is composed of 2~63 characters character string The characters that make up these strings can be letters, numbers, and Hyphen [2]

Physical address versus virtual address

Announce
edit
Physical address: the address placed on the addressing bus. Put it on the addressing bus. If it is read, the circuit will put the data in the physical memory of the corresponding address into the data bus for transmission according to the value of each address. If it is a write, the circuit will put the physical memory of the corresponding address into the data bus according to the value of each address. Physical memory is addressed in bytes (8 bits).
Virtual address: After the CPU starts the protection mode, the program runs in the virtual address space. Note that not all "programs" run in virtual addresses. The CPU runs in the real mode when it is started. The kernel does not use the virtual address before initializing the page table, but directly uses the physical address.

And address space

Announce
edit
Physical storage And storage address space are two different concepts. But because they are closely related, and both use B, KB, MB, GB to measure their capacity Size, so it is easy to have cognitive confusion. Understanding these two different concepts is helpful for further understanding Main memory And make good use of main memory.
Physical storage It refers to the specific memory chip that actually exists. For example, the main memory strip inserted on the motherboard and the ROM chip loaded with the system BIOS, the display RAM chip on the display card and the ROM chip loaded with the display BIOS, as well as various adapter The RAM chip and ROM chip on the Physical storage
The storage address space refers to the storage Range of encoding (encoding address). The so-called coding is to Storage unit (a byte) assign a number, usually called“ Addressing ”。 Assign a number to a Storage unit The purpose of the“ addressing ”(Therefore, some people also call the address space Addressing space )。
CPU is operating Physical storage Physical memory is treated as memory, and it is generally regarded as a logical memory composed of several storage units. This logical memory is what we call memory address space.
Some physical memory is regarded as a logical memory composed of several storage units, and each physical memory occupies an address segment, that is, an address space, in this logical memory. When the CPU reads and writes data in this address space, it actually reads and writes data in the corresponding physical memory.
The size of the address space and the size of the physical memory are not necessarily equal. Take an example to illustrate this problem: there are 17 rooms on a floor, and their numbers are 801-817. The 17 rooms are physical, and the address space uses a three bit code, which ranges from 800 to 899, with a total of 100 addresses. It can be seen that the address space is larger than the actual number of rooms.
For computers above 386 Address bus It is 32-bit, so the address space can reach the 32nd power of 2, namely 4GB. But in fact, what we have configured Physical storage Usually only 1MB, 2MB, 4MB, 8MB, 16MB, 32MB, etc., which is far less than the allowed range of the address space [1]

IPv6 address space

Announce
edit
IPv6 is Next generation Internet agreement. The existing Internet operates on the basis of IPv4. With the rapid development of the Internet, the limited addresses defined by IPv4( IP address )The space will be exhausted, which will affect the further development of the Internet. IPv4 uses 32-bit address length, with only about 4.3 billion addresses. It is estimated that IPv4 will be allocated in 2009~2010. IPv6 redefines the address space, uses 128 bit address length, and can provide addresses almost without restrictions. By conservatively estimating the actual addresses that can be allocated for IPv6, more than 1000 addresses can be allocated per square meter of the whole earth.
In addition to the huge address space, IPv6 also has these advantages: stateless automatic configuration, more secure network, and better quality of service.

Virtual address space for Linux processes

Announce
edit
In the x86 architecture, the segmentation mechanism is mandatory, while the paging mechanism can be selected by the specific operating system. Linux skilfully bypasses the base address by making the base address of the segment 0. Therefore, for Linux, virtual addresses and linear addresses are consistent. On 32-bit platforms, the size of the linear address is a fixed 4GB. Moreover, because of the protection mechanism, the Linux kernel divides the 4GB into two parts. The 1GB with higher virtual addresses (0xC0000000 to 0xFFFFFFFF) is the shared kernel space; The lower 3GB (0x00000000 to 0xBFFFFFFF) is the user space of each process. Because each process cannot access the kernel space directly, but enters the kernel indirectly through system calls, all processes share the kernel space. Each process has its own user space, and each process cannot access each other's user space. Therefore, for each specific process, there is a 4GB virtual address space [3]