WO2022237624A1 - Procédé, appareil et système d'attribution de mémoire - Google Patents

Procédé, appareil et système d'attribution de mémoire Download PDF

Info

Publication number
WO2022237624A1
WO2022237624A1 PCT/CN2022/091040 CN2022091040W WO2022237624A1 WO 2022237624 A1 WO2022237624 A1 WO 2022237624A1 CN 2022091040 W CN2022091040 W CN 2022091040W WO 2022237624 A1 WO2022237624 A1 WO 2022237624A1
Authority
WO
WIPO (PCT)
Prior art keywords
physical memory
memory space
user
request
kernel
Prior art date
Application number
PCT/CN2022/091040
Other languages
English (en)
Chinese (zh)
Inventor
黄强
李�雨
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022237624A1 publication Critical patent/WO2022237624A1/fr

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0646Configuration or reconfiguration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/14Protection against unauthorised use of memory or access to memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/14Protection against unauthorised use of memory or access to memory
    • G06F12/1458Protection against unauthorised use of memory or access to memory by checking the subject access rights

Definitions

  • the present application relates to the field of computer technology, and more specifically, to a memory allocation method, device and system.
  • the processor When running the operating system, the processor can be divided into two operating modes, kernel mode and user mode, according to the function.
  • kernel mode When the processor is in the kernel mode, it mainly executes some key tasks of the operating system and controls the hardware resources of the computer.
  • the user mode Compared with the kernel mode, the user mode has lower execution authority.
  • the processor When the processor is in the user mode, it mainly executes the application-related processes.
  • the processor By dividing the user mode and the kernel mode, the processor can realize the isolation of system key data and application data and improve security. sex and reliability.
  • Memory management is an important function of the operating system. It is mainly used for the allocation and use of memory resources, such as allocating the memory space required for the process to run.
  • Memory management can be implemented by the processor in kernel mode or in user mode. When memory management is implemented in user mode, it can reduce the complexity of kernel mode, but the problem is that the memory required by the system service process also needs to apply to the user mode memory management process through inter-process communication (IPC). When the required memory is large, frequent IPC will bring a large overhead.
  • IPC inter-process communication
  • memory management is implemented in the kernel state, due to the complex data structures and algorithms used in memory management, it will make the formal verification of the kernel and pass high-level security certification very difficult, and increase the probability of being attacked.
  • the memory management method of the current operating system has yet to be optimized.
  • the present application provides a memory allocation method, device and system to improve the working efficiency of memory allocation.
  • a memory allocation method includes:
  • the first user state process receives the task request of the second user state process, and the task request is used to request memory space allocation; the first user state process allocates the first physical memory for the second user state process from the first physical memory space interval, wherein the first physical memory space is the physical memory space authorized by the kernel to the first user mode process.
  • the kernel can perform the first-level memory space management, that is, authorize part of the physical memory space for the first user-mode process, so that the user-mode process can allocate the authorized physical memory space according to the demand, that is, the second-level memory space management,
  • the kernel is responsible for completing a small amount of work, frequent communication between user-mode processes is reduced, energy consumption and memory allocation time overhead can be reduced, and memory allocation can be improved. s efficiency.
  • the method before the first user-mode process allocates the first physical memory range to the second user-mode process, the method further includes: when the first user-mode process When the size of the free memory space in the second physical memory space authorized by the process does not meet the size of the memory space required by the task request, the process in the first user state applies for physical memory space to the kernel; The process authorizes the third physical memory space, wherein the first physical memory space includes the second physical memory space and the third physical memory space.
  • the first user state process can further apply for physical memory space from the kernel to obtain enough authorized physical memory space, avoiding the Insufficient physical memory space authorized by a user state process causes the second user state process to fail to request memory, which improves the flexibility of physical memory space management.
  • the method further includes: allocating a corresponding first virtual memory interval for the first physical memory interval in the first user mode process; The process sends a memory mapping request to the kernel, and the memory mapping request is used for requesting establishment of a mapping relationship between the first physical memory range and the first virtual memory range.
  • the first user mode process allocates the corresponding first virtual memory interval, and requests the kernel to perform memory mapping to complete the connection between the first physical memory interval and the first virtual memory interval. mapping.
  • the method further includes: the first user mode process authorizes a physical memory space allocation permission for the third user mode process.
  • the first user state process also has the function of authorizing physical memory space allocation permissions for other user processes (such as the third user state process), so that after the third user state process obtains the allocation authority, it can request the kernel for physical memory space , so that the third user state process can allocate the authorized physical memory space according to the demand, which can prevent the third user state process from requesting physical memory through inter-process communication, reduce the overhead caused by inter-process communication, and improve the efficiency of memory allocation .
  • other user processes such as the third user state process
  • the first user mode process may be a user mode main memory management process
  • the third user mode process may be a related process that provides system services.
  • the task request is a file mapping request
  • the first user state process is a file system process or a virtual file system process
  • the method further includes: the first user process In response to the file mapping request, the file requested by the file mapping request is mapped to the first physical memory range; the first user process sends the first physical memory range to the second user process.
  • the first user process after the first user process receives the task request for file mapping, it allocates the first physical memory interval for the file mapping task, maps the requested file to the first physical memory interval, and then notifies the second user mode process , the first physical memory range allocated by the first user mode process to the file mapping task.
  • This enables the first user state process to allocate a physical memory range for the file mapping task and complete the file mapping, avoiding requesting physical memory through inter-process communication, reducing the overhead caused by inter-process communication, and improving the efficiency of memory allocation.
  • the first user mode process may be a user mode virtual file system (VFS) process
  • the second user mode process may be a main service process.
  • the main service process obtains the first physical memory interval allocated by the VFS process for the file mapping task through the file mapping request, and then allocates the corresponding virtual address interval for the first physical memory interval, so as to request the kernel to complete the first physical memory interval and the virtual address interval mapping between.
  • VFS virtual file system
  • the task request is a file read/write request
  • the first user state process is a file system process or a virtual file system process
  • the method further includes: the first The user process executes the read/write operation requested by the file read/write request on the first physical memory range.
  • the first user process after receiving the file read/write task request, the first user process allocates a first physical memory range for the file read/write task, and will perform read and write operations on the first physical memory range.
  • This enables the first user-mode process to allocate physical memory ranges for file read/write tasks and complete file read/write, avoiding requesting physical memory through inter-process communication, reducing the overhead caused by inter-process communication, and improving the efficiency of memory allocation.
  • the method further includes: authorizing the physical memory space allocation authority for the first user-mode process in the second user-mode process.
  • the user state process also has the function of authorizing physical memory space allocation permissions for other user processes (such as the first user state process), which can avoid the need for the user state process to request physical memory through inter-process communication, and reduce the inter-process communication bandwidth. to improve the efficiency of memory allocation.
  • a memory allocation device including: a request unit, configured to send a task request to a first user-mode process in a second user-mode process;
  • the task requests to allocate a first physical memory range, and the first physical memory range belongs to a first physical memory space, and the first physical memory space is a physical memory space authorized by the kernel for the first user mode process.
  • the processing unit before the processing unit allocates the first physical memory range to the task request of the second user-mode process by the first user-mode process, the processing unit further uses It is determined that the size of the free memory space in the authorized physical memory space of the first user mode process does not meet the size of the memory space required by the task request; the request unit is also used to apply to the kernel for physical memory in the first user mode process. memory space; the processing unit is further configured to authorize the first physical memory space for the first user mode process in the kernel.
  • the processing unit is further configured to request allocation of a first virtual memory interval for the task in the first user state process;
  • a user mode process sends a memory mapping request to the kernel, and the memory mapping request is used to request establishment of a mapping relationship between the first physical memory range and the first virtual memory range.
  • the processing unit is further configured to authorize the physical memory space allocation permission for the third user-mode process in the first user-mode process.
  • the task request is a file mapping request
  • the first user state process is a file system process or a virtual file system process
  • the processing unit is further configured to The process responds to the file mapping request, and maps the file requested by the file mapping request to the first physical memory range
  • the device further includes: a transceiver unit, configured to send the second user to the second user in the first user process The process sends the first physical memory range.
  • the task request is a file read and write request
  • the first user mode process is a file system process or a virtual file system process
  • the processing unit is further configured to A user process executes the read and write operations requested by the file read and write request on the first physical memory range.
  • the processing unit is further configured to authorize the physical memory space allocation permission for the first user-mode process in the second user-mode process.
  • a communication device including a processor.
  • the processor may implement the first aspect and the method in any possible implementation manner of the first aspect.
  • the communication device further includes a memory
  • the processor is coupled to the memory, and can be used to execute instructions in the memory, so as to implement the above first aspect and the method in any possible implementation manner of the first aspect.
  • the communication device further includes a communication interface, and the processor is coupled to the communication interface.
  • the communication interface may be a transceiver, a pin, a circuit, a bus, a module or other types of communication interfaces, without limitation.
  • an operating system including computer programs and computer program codes.
  • the computer operating system executes the method in the first aspect and any possible implementation manner of the first aspect .
  • a processor including: an input circuit, an output circuit, and a processing circuit.
  • the processing circuit is configured to receive a signal through the input circuit and transmit a signal through the output circuit, so that the processor executes the method in the first aspect and any possible implementation manner of the first aspect.
  • the above-mentioned processor can be one or more chips
  • the input circuit can be an input pin
  • the output circuit can be an output pin
  • the processing circuit can be a transistor, a gate circuit, a flip-flop and various logic circuits, etc. .
  • the input signal received by the input circuit may be received and input by, for example but not limited to, the receiver
  • the output signal of the output circuit may be, for example but not limited to, output to the transmitter and transmitted by the transmitter
  • the circuit may be the same circuit, which is used as an input circuit and an output circuit respectively at different times.
  • the embodiment of the present application does not limit the specific implementation manners of the processor and various circuits.
  • a computer program product includes: a computer program (also referred to as code, or an instruction), when the computer program is executed, the computer executes the above-mentioned first aspect and the first aspect A method in any of the possible implementations.
  • a computer program also referred to as code, or an instruction
  • a computer-readable medium stores a computer program (also referred to as code, or an instruction) which, when running on a computer, causes the computer to execute the above-mentioned first aspect and the first A method in any one of the possible implementations of the aspect.
  • a computer program also referred to as code, or an instruction
  • FIG. 1 is a schematic diagram of an operating system architecture applicable to the present application
  • FIG. 2 is a schematic flowchart of a memory allocation method provided by an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of Embodiment 1 of the memory allocation method provided by the present application.
  • FIG. 4 is a schematic flowchart of Embodiment 2 of the memory allocation method provided by the present application.
  • FIG. 5 is a schematic flowchart of Embodiment 3 of the memory allocation method provided by the present application.
  • FIG. 6 is a schematic flowchart of Embodiment 4 of the memory allocation method provided by the present application.
  • FIG. 7 is a schematic block diagram of an example of a communication device provided by the present application.
  • Fig. 8 is a schematic structural diagram of an example of a communication device provided by the present application.
  • the functions of the processor running the operating system are divided into the kernel state (in some contexts, it can also be referred to as the kernel for short) and the user state.
  • the kernel state is only responsible for some key business functions, and most of the operating system functions are released. In the user mode, this can ensure the "miniaturization" of the kernel mode.
  • different functional modules are managed separately and run in different processes. A problem with one module will not affect other modules, achieving better security and reliability.
  • Typical microkernel architecture operating systems include SeL4, QNX, MINIX, Fuchsia, etc.
  • the macro-kernel architecture In the macro-kernel architecture, all the functions of the processor running the operating system run in the kernel mode to realize a "grand" kernel, because all modules run in one address space and can directly access each other, the macro-kernel architecture can achieve very high efficiency performance, but there are also safety and reliability issues that a module failure will cause the entire kernel to crash.
  • a typical macro-kernel architecture operating system is Linux.
  • a system service process can be referred to as a system service or a service process for short.
  • a system service process is a process that performs specified system functions, and usually provides users with some system function services locally and through the network.
  • a system service process can include but is not limited to a file system process (file system, FS), client/server process, Web server process, etc.
  • the system service process generally runs in the background, and no program window or dialog box will appear to the user application process. You can find the started system service process in the task manager.
  • FIG. 1 is a schematic diagram of an operating system architecture applicable to this application.
  • the operating system can be divided into a kernel mode and a user mode according to functional rights.
  • the working mode of the processing device can include a kernel mode or a user mode.
  • the user state mode includes at least one user state process, such as the user state mode may include a system manager (system manager, SYSMGR) process, which is responsible for starting and managing system components and system services, and providing user application (user application, UAPP) requests.
  • the user mode can also include a virtual file system process (virtual file system, VFS), which is responsible for managing and storing file information.
  • VFS virtual file system
  • the user state mode may also include other system service processes, and the present application is not limited thereto.
  • the kernel-mode mode includes at least one kernel-mode process, which is responsible for key business functions. It should be understood that FIG. 1 is only a schematic diagram of a system architecture applicable to an operating system of the present application, but the present application is not limited thereto, and the solutions of the present application may also be applied to operating systems of other system architectures.
  • memory management in an embedded real-time operating system (quick unix, QNX) is completely implemented in user mode, and the kernel is responsible for filling the page table during address space mapping.
  • the specific process steps are as follows:
  • Step 1 UAPP sends a file read request to the FS process (hereinafter referred to as FS);
  • Step 2 FS judges whether the file has been read, and returns after reading, otherwise continue;
  • Step 3 FS applies for content as a cache memory (cache) to the memory management process
  • Step 4 FS reads the file and writes it into the cache
  • Step 5 FS copies the content in the cache to the address specified by UAPP;
  • Step 6 Go back to Step 2.
  • FS needs to apply for cache from the memory management process through inter-process communication (IPC).
  • IPC inter-process communication
  • the memory management in the Fuchsia operating system is completely implemented in the kernel mode.
  • the memory allocation operation of the user mode system service process can directly apply to the kernel through system calls.
  • the memory management module in the kernel mode It is relatively large, which makes Fuchsia's kernel larger and more complex than traditional microkernels, and the difficulty and workload of passing various security certifications will be greater.
  • this application proposes that the kernel can perform the first-level memory space management, authorize part of the physical memory space for the first user-mode process, and let the user-mode process perform the second-level memory space management , allocate authorized physical memory space according to task requirements, which can prevent user-mode processes from requesting physical memory space from other user-mode processes through inter-process communication (IPC) after receiving task requests, or requesting physical memory space from the kernel through system calls .
  • IPC inter-process communication
  • FIG. 2 is a schematic flowchart of the memory allocation method provided by the present application.
  • the memory allocation method may be executed by an operating system, or the memory allocation method may be executed when the processing device runs an operating system, and the operating system includes multiple user state process programs and kernel programs (which may be called kernels).
  • kernels which may be called kernels.
  • the following uses the memory allocation method of the operating system as an example for illustration, but the present application is not limited thereto.
  • the kernel authorizes the first physical memory space for the first user mode process.
  • the processing device runs an operating system whose kernel is used to manage the physical memory space of the operating system.
  • the kernel may be used to authorize part of the physical memory space in the physical memory space of the system for the first user state process, for example, the kernel authorizes the first physical memory space for the first user state process.
  • the first user mode process may allocate the authorized first physical memory space.
  • the first user mode process is a system service process.
  • the operation of the kernel or the operation of the user-mode process (such as execution, authorization, sending, receiving, determination, management, etc.) involved in this application can be understood as the process that the processing device runs into the operating system. What to do when the process is run, or when the operating system runs into the process.
  • the first user-mode process applies to the kernel for physical memory space.
  • the kernel allocates the first physical memory space for the first user process in response to the application of the first user state process.
  • the first user mode process can apply for physical memory space from the kernel.
  • the kernel allocates the first physical memory space for the first user process in response to the application of the first user process.
  • the first user mode process allocates the first physical memory range in the first physical memory space to the second user mode process.
  • the first user mode process receives a task request from the second user mode process.
  • the task request may be a file mapping request, a file read and write request, etc. from an application process.
  • the first user state process can determine the memory space size required by the task request, and determine the first physical memory address interval in the first physical memory space authorized by the first user state process, then allocate the first physical memory address interval for the task request A range of memory addresses.
  • the first user mode process judges whether the size of the physical memory space to be allocated in the authorized physical memory space of the first user mode process meets the required size of the task request based on the size of the memory space required by the task request. The size of the memory space. If satisfied, then in the physical memory space to be allocated, allocate a physical memory address interval for the task request; if not satisfied, the first user mode process applies for a physical memory space to the kernel, and the kernel is the authorized part of the first user process In the physical memory space, the first user state process requests to allocate the first physical memory range for the task in the authorized physical memory space.
  • the first user mode process may be the main service process of memory management in the user mode process, or may be called the main memory management process, and the main service process may authorize physical memory space allocation rights for other system service processes.
  • other system service processes may include a file system process.
  • the main service process authorizes the file system process to allocate physical memory space. After the file system process is authorized to allocate physical memory space, it can apply for physical memory space from the kernel. After the process authorizes part of the physical memory space, the file system process can allocate a physical memory range in the part of the physical memory space for task requests of other processes. But the present application is not limited thereto.
  • the kernel obtains the request of the user state process to apply for the physical memory space, based on the size of the physical memory space required by the request, it is determined whether the size of the physical memory space to be allocated in the physical memory space managed by the kernel satisfies the request The size of the required memory space. If it is satisfied, part of the physical memory space is authorized for the user-mode process. If it is not satisfied, the kernel can initiate physical memory space recovery, such as initiating a physical memory space request to a user-mode process with physical memory space allocation permissions, thereby reclaiming part of the physical memory space After that, the physical memory space is authorized for the user mode process.
  • the two-level physical memory space management method can reduce frequent communication between user mode processes when the kernel is responsible for completing a small amount of work, and can reduce system energy consumption and overhead.
  • FIG. 3 is a flow chart of Embodiment 1 of the memory allocation method provided by the present application.
  • FIG. 3 shows a schematic flow chart of memory allocation using the memory allocation method provided by the present application at the startup initialization stage of the operating system.
  • the process of initializing the processing device to start the operating system includes but is not limited to the following steps:
  • boot allocator boot allocator
  • the memory management main service process can be the system manager SYSMGR process
  • the main service process (i.e. an example of the first user mode process) may include a first physical memory management algorithm (physical memory management algorithm, PHYMGR), the kernel may include a global PHYMGR (global PHYMGR), and the main service process manages
  • PHYMGR physical memory management algorithm
  • the kernel may include a global PHYMGR (global PHYMGR)
  • the main service process manages
  • the algorithm applies for a physical memory space to the kernel, and the kernel responds to the application by authorizing part of the physical memory space (that is, an example of the first physical memory space) to the main service process through the global PHYMGR.
  • the main service process may authorize one or more system service processes to manage physical memory space.
  • a virtual file system (VFS) process has a higher allocation requirement for physical memory, and the main service process can authorize the physical memory management authority of the VFS process, but the application is not limited thereto.
  • Process physical memory management permissions for processes with high allocation requirements are not limited thereto.
  • step 9 the system service process (that is, another example of the first user mode process) authorized to manage the physical memory applies to the kernel for physical memory space.
  • the system service process authorized with the physical management authority completes the initialization of the metadata of the authorized physical memory space (that is, another example of the first physical memory space). System services that are granted physical management rights have allocation rights to the authorized physical memory space.
  • the kernel authorizes part of the physical memory space for the main service process, so that the main service process can allocate the authorized physical memory space according to the requirements during the running phase of the operating system.
  • the miniaturization of the kernel can be realized, the workload of the kernel can be reduced, and the security of the system can be improved.
  • FIG. 4 is a schematic flowchart of Embodiment 2 of the memory allocation method provided by the present application.
  • FIG. 4 shows a schematic flow of memory allocation in response to the anonymous memory mapping request of the UAPP after the processing device obtains the anonymous memory mapping request while running the main service process.
  • the VFS process can be, for example, as shown in FIG. 3 , authorized by the main service process to manage the physical memory space in the initialization phase, and authorized by the kernel, and the VFS process has a part of the physical memory space allocated with the authority, but the application is not limited thereto.
  • the process of the processing device responding to UAPP's anonymous memory mapping request includes but is not limited to the following steps:
  • Anonymous memory mapping means that the mapped area is not associated with a file.
  • the virtual memory range may be a virtual memory address range, or called a virtual memory address segment
  • the physical memory range may be a physical memory address range, or called a physical memory address segment.
  • the processing device first needs to determine whether the physical memory space to be allocated in the authorized physical memory space of the main service process can satisfy the size of the memory space required by the memory mapping request. If not satisfied, apply for physical memory space from the kernel in step 4; if satisfied, perform step 8 to allocate a physical memory range for the anonymous memory mapping request in the authorized physical memory space of the main service process;
  • the kernel judges whether the physical memory space to be allocated in the global physical memory space is enough
  • the processing device judges whether the size of the physical memory space to be allocated in the global physical memory space satisfies the size of the physical memory space applied by the main service process. If it is satisfied, the kernel authorizes part of the physical memory space for the main service process, and then returns to step 3; if not, initiates memory recovery in step 6.
  • the kernel initiates a memory reclamation request to reclaim part of the physical memory space
  • the kernel authorizes part of the physical memory space for the main service process, and performs metadata initialization on the authorized part of the physical memory space in the main service process, and returns to step 3;
  • the processing unit completes the rest of the process.
  • FIG. 5 is a schematic flowchart of Embodiment 3 of the memory allocation method provided by the present application.
  • FIG. 5 shows a schematic flow chart of executing a memory allocation process in response to the file mapping request after the processing device acquires a file mapping request from the UAPP while running the main service process.
  • the VFS process can be, for example, as shown in FIG. 3 , authorized by the main service process to manage the physical memory space in the initialization phase, and authorized by the kernel, and the VFS process has a part of the physical memory space with the assigned authority, but the application is not limited thereto.
  • the process of the processing device responding to the file mapping request of UAPP includes but not limited to the following steps:
  • the file mapping request may be that the mmap file mapping function carries a populated flag (with populated flag), but the application is not limited thereto.
  • the main service process requests the page cache (page cache) corresponding to the UAPP from the VFS process, and requests the VFS process to provide the physical memory (interval) of the file page corresponding to the UAPP;
  • step 4 Determine whether the VFS process has a page cache corresponding to the UAPP, if not, then perform step 5; if so, perform step 11, and return the page cache corresponding to the UAPP to the main service process;
  • the processing device first needs to judge whether the physical memory space to be allocated in the authorized physical memory space of the VFS process can satisfy the size of the memory space required by the file mapping request. If not satisfied, apply for physical memory space to the kernel in step 6; if satisfied, perform step 10, in the authorized physical memory space of the VFS process, allocate a physical memory interval as a page cache for the file mapping task.
  • the kernel judges whether the physical memory space to be allocated in the global physical memory space is enough
  • the kernel After the kernel obtains the application of the VFS process, it judges whether the size of the physical memory space to be allocated in the global physical memory space satisfies the size of the physical memory space applied by the VFS process. If not, initiate memory reclamation in step 8; if satisfied, return to step 5 after the kernel authorizes part of the physical memory space for the VFS process in step 9.
  • the kernel initiates a memory reclamation request to reclaim part of the physical memory space
  • the kernel authorizes part of the physical memory space for the VFS process, and performs metadata initialization on the authorized physical memory space in the VFS process, and returns to step 5;
  • a physical memory range is allocated for the file mapping task from authorized physical memory space through a physical memory management algorithm (phymgr) corresponding to the VFS process.
  • phymgr physical memory management algorithm
  • the VFS process returns the page cache corresponding to the UAPP to the VFS process
  • mapping request to the kernel in the main service process, that is, send the virtual memory interval and physical memory interval allocated for the file mapping request to the kernel to initiate a mapping request;
  • the processing unit completes the remaining process.
  • this application allocates and uses physical memory of system services (such as VFS processes, etc.) with clear authority management and operation boundaries, and the physical memory managed by system services is only used to meet its own functions and logic implementation. Needs (such as file mapping tasks, etc.), cannot be used to satisfy the physical memory allocation of the application, and the physical memory allocation of the application is still the responsibility of the main memory management process. This can reduce the frequent interaction between processes, and does not increase the overall memory management complexity. The access control of physical memory is still handled in the main memory management process.
  • system services such as VFS processes, etc.
  • the file reading and writing performance has obvious disadvantages compared with the macro-kernel operating system.
  • the file reading and writing performance can be equal to or surpass the typical macro-kernel operating system Linux.
  • the memory allocation method provided by the present application was compared with the read ability and write ability of the Linux operating system in the prior art. For files of the same size, when the same number of bytes is read each time, no matter in the way of sequential reading or random reading, the memory allocation method provided by this application can improve the processing efficiency by more than 35% compared with the Linux operating system .
  • the memory allocation method provided by this application can improve the processing efficiency by more than 15% compared with the Linux operating system .
  • the processing efficiency of the memory allocation method provided by the present application is significantly improved. For example, when 2 megabytes are written per second, the processing efficiency can be increased by 60%.
  • FIG. 6 is a schematic flowchart of Embodiment 4 of the memory allocation method provided by the present application.
  • FIG. 6 shows a schematic flow chart of executing a memory allocation process in response to the file mapping request after the processing device obtains a file read and write request from UAPP while running a VFS process, wherein the VFS process can be, for example, as shown in FIG.
  • the main service process is authorized to manage the physical memory space, and is authorized by the kernel, and the VFS process has a part of the physical memory space with the allocation authority, but the application is not limited thereto.
  • the process of the processing device responding to the file read and write request of UAPP includes but not limited to the following steps:
  • the file reading and writing request of UAPP is directly sent to the VFS process, and in response to the file reading and writing request in the VFS process, according to the file indicator fd, call the corresponding read (read) function or write (write) function to find the corresponding file location.
  • step 3 determines whether there is a page cache corresponding to the file; if it does not exist, the processing device executes step 3; if it exists, executes step 9, and performs the corresponding read and write operations of the UAPP request on the page cache;
  • the processing device judges whether the size of the physical memory space to be allocated in the authorized physical memory space satisfies the size of the page cache required by the read-write task. If it is not satisfied, execute step 4 to apply to the kernel for authorization of part of the physical memory space of the VFS process; if satisfied, execute step 8 to allocate a physical memory range for the read and write task as the page cache for the read and write task.
  • the kernel judges whether the global physical memory space is sufficient
  • the kernel judges whether the size of the physical memory space to be allocated in the global physical memory space can satisfy the memory space requested by the VFS process. If it is enough, then execute step 7.
  • the kernel authorizes part of the physical memory space for the VFS process; if not, execute step 6.
  • the kernel initiates the memory space space reclamation request;
  • the kernel initiates a memory space reclamation request to reclaim part of the physical memory space that has not been authorized by the VFS process;
  • the kernel authorizes part of the physical memory space for the VFS process, and performs metadata initialization on the authorized physical memory space in the VFS process, and returns to step 3;
  • the processing device When processing the file reading and writing task shown in Figure 6, the processing device receives the file reading and writing request in the VFS process, and if there is no corresponding page cache, it can read and write the file in the physical memory space authorized by the VFS process Allocate the corresponding page cache. With the permission to allocate physical memory space in the VFS process, it can reduce the inter-process communication overhead caused by the VFS process requesting the physical memory range from the memory management process, and improve the processing efficiency.
  • the memory allocation method provided by the present application has been described above with reference to FIG. 2 to FIG. 6 .
  • the communication device provided by the present application will be described below with reference to FIG. 7 .
  • FIG. 7 is a schematic structural diagram of a memory allocation device provided by the present application. As shown in FIG. 7 , the memory allocation device includes a request unit 710 and a processing unit 720 .
  • the request unit is used to send a task request to the first user mode process in the second user mode process, and the task request is used to request memory space allocation;
  • a processing unit configured to allocate a first physical memory range to the task request in the first user state process, the first physical memory range belongs to the first physical memory space, and the first physical memory space is the kernel for the first user The physical memory space authorized by the state process.
  • the processing unit before the processing unit requests allocation of the first physical memory range for the task of the second user-mode process by the first user-mode process, the processing unit is further configured to determine the authorized first user-mode process 2.
  • the size of the free memory space in the physical memory space does not meet the size of the memory space required by the task request;
  • the request unit is also used to apply for physical memory space from the kernel in the first user state process
  • the processing unit is further configured to authorize a third physical memory space for the first user mode process in the kernel, wherein the first physical memory space includes the second physical memory space and the third physical memory space.
  • the processing unit is further configured to allocate a corresponding first virtual memory interval to the first physical memory interval in the first user mode process
  • the request unit is also used to send a memory mapping request to the kernel in the first user mode process, and the memory mapping request is used to request the kernel to establish a mapping relationship between the first physical memory interval and the first virtual memory interval .
  • the processing unit is further configured to authorize the allocation permission of the physical memory space for the third user-mode process in the first user-mode process.
  • the task request is a file mapping request
  • the first user mode process is a file system process or a virtual file system process
  • the processing unit is further configured to respond to the file mapping request in the first user process, and map the file requested by the file mapping request to the first physical memory interval; and, the device further includes:
  • a transceiver unit configured to send the first physical memory range to the second user process in the first user process.
  • the task request is a file read/write request
  • the first user mode process is a file system process or a virtual file system process
  • the processing unit is further configured to perform a process on the first physical memory range in the first user process. Performs the read/write operation requested by the file read/write request.
  • processing unit is further configured to authorize the physical memory space allocation permission for the first user-mode process in the second user-mode process.
  • FIG. 8 is a schematic structural diagram of a communication device 800 provided by an embodiment of the present application.
  • the communication device 800 may be configured with an operating system as shown in FIG. 1 .
  • the communication device 800 includes a bus 840 and a processor 810 connected to the bus 840 , and the communication device 800 may also include a communication interface 820 and a memory 830 .
  • the communication device 800 shown in FIG. 8 can implement each process of the memory allocation method in any method embodiment.
  • the operations and/or functions of the various modules in the communication device 800 are respectively for implementing the corresponding procedures in the foregoing method embodiments.
  • the communication device may be a terminal, and may also be called user equipment (user equipment, UE), and the communication device may be a mobile phone, a tablet computer, or a computer device.
  • user equipment user equipment
  • the embodiment of the present application also provides a computer operating system, including: computer program code, which causes the computer operating system to execute the method in any one of the above method embodiments when the computer program code is invoked.
  • the embodiment of the present application also provides a processing device, including a processor and an interface; the processor is configured to execute the method in any one of the above method embodiments.
  • the present application also provides a computer program product, the computer program product including: computer program code, when the computer program code is executed by one or more processors, the device including the processor executes any one of the above method embodiments Methods.
  • the present application also provides a computer-readable storage medium, the computer-readable storage medium stores program code, and when the program code is run by one or more processors, the device including the processor executes any one of the above methods. method in the example.
  • the various embodiments may refer to each other, for example, the methods and/or terms between the method embodiments may refer to each other, such as the functions and/or terms between the device embodiments Or terms may refer to each other, for example, functions and/or terms between the apparatus embodiment and the method embodiment may refer to each other.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Storage Device Security (AREA)

Abstract

La présente demande concerne un procédé, un appareil et un système d'attribution de mémoire. Grâce au procédé, un noyau peut exécuter une gestion d'espace de mémoire de premier niveau pour accorder une partie d'un espace mémoire physique à un processus d'état d'utilisateur, de telle sorte que le processus d'état d'utilisateur puisse attribuer l'espace mémoire physique accordé en fonction des exigences, ce qui permet de réaliser une gestion d'espace mémoire de second niveau. En utilisant un mode de gestion d'espace mémoire physique à deux niveaux, lorsqu'un noyau est responsable de l'achèvement d'une petite quantité de travail, les communications fréquentes entre des processus d'état d'utilisateur sont réduites, et la consommation d'énergie et les surcharges de temps d'attribution de mémoire peuvent être réduites, afin d'améliorer l'efficacité d'attribution de mémoire.
PCT/CN2022/091040 2021-05-14 2022-05-05 Procédé, appareil et système d'attribution de mémoire WO2022237624A1 (fr)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110527267.6A CN115344507B (zh) 2021-05-14 2021-05-14 内存分配方法、装置和系统
CN202110527267.6 2021-05-14

Publications (1)

Publication Number Publication Date
WO2022237624A1 true WO2022237624A1 (fr) 2022-11-17

Family

ID=83977947

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/091040 WO2022237624A1 (fr) 2021-05-14 2022-05-05 Procédé, appareil et système d'attribution de mémoire

Country Status (2)

Country Link
CN (1) CN115344507B (fr)
WO (1) WO2022237624A1 (fr)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117591293A (zh) * 2023-12-01 2024-02-23 深圳计算科学研究院 内存管理方法、装置、计算机设备及计算机可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104050101A (zh) * 2014-05-29 2014-09-17 汉柏科技有限公司 一种实现arm cpu用户态收发报文的方法
CN104796337A (zh) * 2015-04-10 2015-07-22 京信通信系统(广州)有限公司 一种转发报文的方法及装置
CN104794069A (zh) * 2015-04-01 2015-07-22 北京创毅视讯科技有限公司 一种cpu中缓存的用户态分配方法和系统
US20160188251A1 (en) * 2014-07-15 2016-06-30 Nvidia Corporation Techniques for Creating a Notion of Privileged Data Access in a Unified Virtual Memory System
CN112711546A (zh) * 2019-10-24 2021-04-27 华为技术有限公司 内存配置方法、装置及存储介质

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100536473C (zh) * 2006-11-09 2009-09-02 华中科技大学 一种用于nas存储系统的加密读写方法
CN102819497B (zh) * 2012-05-31 2015-09-30 华为技术有限公司 一种内存分配方法、装置及系统
GB2506684A (en) * 2012-10-08 2014-04-09 Ibm Migration of a virtual machine between hypervisors
WO2016033718A1 (fr) * 2014-09-01 2016-03-10 华为技术有限公司 Procédé et appareil d'accès aux fichiers et système de stockage
US10140462B2 (en) * 2015-05-21 2018-11-27 Qualcomm Innovation Center, Inc. Stackable file system with user space policy management
CN110554911A (zh) * 2018-05-30 2019-12-10 阿里巴巴集团控股有限公司 内存访问与分配方法、存储控制器及系统
CN110502335A (zh) * 2019-06-12 2019-11-26 成都虚谷伟业科技有限公司 分布式数据库多级内存管理装置
CN110659248B (zh) * 2019-09-05 2022-11-11 上海交通大学 基于非易失性内存的用户态文件系统设计方法及系统
CN111078408B (zh) * 2019-12-10 2022-10-21 Oppo(重庆)智能科技有限公司 内存分配方法、装置、存储介质及电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104050101A (zh) * 2014-05-29 2014-09-17 汉柏科技有限公司 一种实现arm cpu用户态收发报文的方法
US20160188251A1 (en) * 2014-07-15 2016-06-30 Nvidia Corporation Techniques for Creating a Notion of Privileged Data Access in a Unified Virtual Memory System
CN104794069A (zh) * 2015-04-01 2015-07-22 北京创毅视讯科技有限公司 一种cpu中缓存的用户态分配方法和系统
CN104796337A (zh) * 2015-04-10 2015-07-22 京信通信系统(广州)有限公司 一种转发报文的方法及装置
CN112711546A (zh) * 2019-10-24 2021-04-27 华为技术有限公司 内存配置方法、装置及存储介质

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117591293A (zh) * 2023-12-01 2024-02-23 深圳计算科学研究院 内存管理方法、装置、计算机设备及计算机可读存储介质

Also Published As

Publication number Publication date
CN115344507B (zh) 2024-08-27
CN115344507A (zh) 2022-11-15

Similar Documents

Publication Publication Date Title
US11392506B2 (en) Apparatus and method for secure memory access using trust domains
US11500689B2 (en) Communication method and apparatus
US20220091911A1 (en) Method and apparatus for inter-process communication, and computer device
US10228737B2 (en) Affinity-aware parallel zeroing of memory for initialization of large pages in non-uniform memory access (NUMA) servers
US20060265561A1 (en) System and method for out of user space block mode I/O directly between an application instance and an I/O adapter
US20060265521A1 (en) System and method for creation/deletion of linear block address table entries for direct I/O
CN106354687B (zh) 一种数据传输方法及系统
WO2012058917A1 (fr) Procédé, système et hôte physique pour gestion d'espace de stockage de machine virtuelle (vm)
CN111290827A (zh) 数据处理的方法、装置和服务器
WO2015085826A1 (fr) Procédé et appareil pour accéder à une ressource partagée
US20230168953A1 (en) Inter-process communication method and apparatus
US11940927B2 (en) Technologies for memory tagging
WO2022237624A1 (fr) Procédé, appareil et système d'attribution de mémoire
WO2023016414A1 (fr) Procédé de rotation de justificatif d'identité, dispositif informatique et support d'enregistrement
CN110609708A (zh) 用于数据处理的方法、设备和计算机程序产品
CN113791898B (zh) 一种基于TrustZone的可信微内核操作系统
US9684525B2 (en) Apparatus for configuring operating system and method therefor
US20130246729A1 (en) Method for Managing a Memory of a Computer System, Memory Management Unit and Computer System
WO2022222977A1 (fr) Procédé et appareil pour gérer une mémoire d'un serveur physique pour exécuter des instances de service en nuage
WO2022199560A1 (fr) Procédé et dispositif de gestion de mémoire
CN111666579B (zh) 计算机设备及其访问控制方法和计算机可读介质
CN117539627A (zh) 基于SR-IOV协议的NVMe队列资源动态分配方法及寄存器
CN115756742A (zh) 直通i/o虚拟化的性能优化设计方法、系统、介质及设备
CN114968480A (zh) 一种节点内异构设备的管理方法、系统及存储介质
CN118312302A (zh) 共享内存的读写权限管理方法、控制器及内存扩展设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22806592

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22806592

Country of ref document: EP

Kind code of ref document: A1