Page table-based service processing method and apparatus, device, medium, and product

By deploying agent processes in data center servers, limiting the virtual address range of business processes and executing code segments in user space, the problem of poor isolation between business processes is solved, achieving high-performance and stable business processing.

WO2025243095A1PCT designated stage Publication Date: 2025-11-27CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/IB2025/053058
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-05-22
Filing Date
2025-03-24
Publication Date
2025-11-27

AI Technical Summary

Technical Problem

In existing technologies, business processes in high-performance servers in data centers cannot be effectively isolated, resulting in poor stability and significant performance loss when introducing new business processes.

Method used

By deploying agent processes in electronic devices, the virtual address ranges of each business process are restricted to not overlap, and the agent processes execute business code segments in user mode, avoiding kernel mode switching and achieving process-level resource sharing and isolation.

Benefits of technology

It effectively reduces CPU resource overhead, improves performance, and maintains stability and isolation between business processes, avoiding overall process crashes caused by anomalies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure IB2025053058_27112025_PF_FP_ABST
    Figure IB2025053058_27112025_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure relate to the technical field of data processing, and provide a page table-based service processing method and apparatus, a device, a medium, and a product. The method is applied to an electronic device, an agent process and multiple service processes are deployed in the electronic device, the agent process is used for executing a service code segment of any service process, and virtual address ranges corresponding to different service processes do not overlap. The method comprises: first, acquiring a service code segment to be executed, user mode context, and a first page table of a service process to be processed; then, loading said service code segment and the user mode context by means of an agent process; and finally, on the basis of the first page table and the user mode context, executing said service code segment by means of the agent process to generate an execution result, wherein the agent process is in a user mode. The present technical solution effectively reduces overhead, improves performance and stability, and retains process-level service isolation.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] The present disclosure relates to the technical field of data processing, and particularly relates to a page table-based service processing method, device, equipment, medium and product. For a high-performance server of a data center, in order to ensure performance, part of service processes often run in a long-term exclusive central processing unit (CPU) mode, and under limited resources, how to introduce new service processes and share is a relatively complex problem. At present, the purpose of sharing CPU resources is achieved by merging similar polling mode driver (PMD) process codes of different services into one service and running in a process mode. However, the prior art causes mutual coupling between multiple services, an exception of one service can cause the whole process to crash and affect other services, services cannot be effectively isolated, and stability is poor. The present disclosure provides a page table-based service processing method, device, equipment, medium and product, which can solve the problem that services cannot be effectively isolated and stability is poor in the prior art. In a first aspect, the present disclosure provides a page table-based service processing method, which comprises: obtaining a to-be-executed service code segment, a user state context and a first page table of a to-be-processed service process; loading the to-be-executed service code segment and the user state context through a proxy process, wherein the proxy process is in a user state; executing the to-be-executed service code segment according to the first page table and the user state context through the proxy process, and generating an execution result. In a possible implementation manner, the executing the to-be-executed service code segment according to the first page table and the user state context through the proxy process, and generating an execution result, comprises: copying a page table entry in the first page table to a second page table of the proxy process; calling the first page table according to a page table entry corresponding to the first page table in the second page table through the proxy process; and executing the to-be-executed service code segment according to the first page table and the user state context through the proxy process, and generating the execution result.In a possible implementation, the executing the to-be-executed business code segment according to the first page table and the user mode context by the agent process to generate the execution result comprises: executing the to-be-executed business code segment according to the first page table and the user mode context by the agent process; if an exception occurs in the executing process, caching and marking the current user mode context of the to-be-processed business process by the agent process, the marking being used to indicate that the current user mode context exists an exception; loading the current user mode context by the to-be-processed business process; and continuing to execute the to-be-executed business code segment according to the first page table, the current user mode context and the marking by the to-be-processed business process to generate the execution result. In a possible implementation, the exception comprises a software and hardware exception or an error occurring when accessing a kernel mode resource. In a possible implementation, when the marking indicates that the exception is an error occurring when accessing the kernel mode resource, the continuing to execute the to-be-executed business code segment according to the first page table, the current user mode context and the marking by the to-be-processed business process to generate the execution result comprises: returning an instruction pointer register of the current user mode context to a position before accessing the kernel mode resource by the to-be-processed business process to obtain a processed user mode context; and re-accessing the kernel mode resource according to the first page table and the processed user mode context by the to-be-processed business process to continue to execute the to-be-executed business code segment and obtain the execution result. In a possible implementation, the method further comprises: loading a user mode context of the agent process by the agent process. In a possible implementation, when an exception occurs in the process of executing the to-be-executed business code segment by the agent process, the agent process is switched from the user mode to the kernel mode, and after the loading the current user mode context by the to-be-processed business process, the method further comprises: loading a user mode context of the agent process by the agent process; and controlling the agent process to be switched from the kernel mode to the user mode. In a possible implementation, the second page table is a multi-level page table, and a top-level page table of the second page table is used to store a page table entry of a business process. Correspondingly, the copying the page table entry in the first page table to the second page table of the agent process comprises: copying the page table entry in the first page table to the top-level page table of the second page table.In a possible implementation, when the flag indicates that the exception is the software / hardware exception, the method further includes: continuing, by the to-be-processed business process, to execute the to-be-executed business code segment according to the first page table, the current user mode context, and the flag, to generate the execution result; and controlling the to-be-processed business process to switch from the kernel mode to the user mode. In a possible implementation, before the obtaining of the to-be-executed business code segment, the user mode context, and the first page table of the to-be-processed business process, the method further includes: configuring a new business process by using a compiling tool, a global kernel module, a process loader, and a memory allocation module. In a possible implementation, the configuring of the new business process by using the compiling tool, the global kernel module, the process loader, and the memory allocation module includes: limiting, by the compiling tool, business code in the new business process to be accessed and jumped by using a relative offset; allocating, by the global kernel module, a virtual address interval for the new business process; starting, according to the virtual address interval allocated for the new business process, the new business process; configuring, by the memory allocation module, a memory mapping parameter of the new business process according to the virtual address interval allocated for the new business process; and mapping, by the process loader, business code of the new business process to the virtual address interval of the new business process according to the memory mapping parameter. In a second aspect, an embodiment of the present disclosure provides a business processing apparatus based on a page table, which includes: an obtaining module configured to obtain a to-be-executed business code segment, a user mode context, and a first page table of a to-be-processed business process; a loading module configured to load the to-be-executed business code segment and the user mode context by using a proxy process, the proxy process being in a user mode; and an executing module configured to execute, by the proxy process, the to-be-executed business code segment according to the first page table and the user mode context, to generate an execution result. In a possible implementation, the executing module is specifically configured to: copy a page table entry in the first page table to a second page table of the proxy process; invoke, by the proxy process, the first page table according to a page table entry corresponding to the first page table in the second page table; and execute, by the proxy process, the to-be-executed business code segment according to the first page table and the user mode context, to generate the execution result.In a possible implementation, the execution module is specifically configured to: execute the to-be-executed business code segment according to the first page table and the user-mode context by the agent process; if an exception occurs in the execution process, cache and mark the current user-mode context of the to-be-processed business process by the agent process, where the mark is used to indicate that the current user-mode context exists an exception; load the current user-mode context by the to-be-processed business process; and continue to execute the to-be-executed business code segment according to the first page table, the current user-mode context, and the mark by the to-be-processed business process, to generate the execution result. In a possible implementation, the exception includes a software and hardware exception or an error occurring when accessing a kernel-mode resource. In a possible implementation, when the mark indicates that the exception is an error occurring when accessing a kernel-mode resource, the execution module is specifically configured to: roll back an instruction pointer register of the current user-mode context to a position before accessing the kernel-mode resource by the to-be-processed business process, to obtain a processed user-mode context; and re-access the kernel-mode resource according to the first page table and the processed user-mode context by the to-be-processed business process, to continue to execute the to-be-executed business code segment and obtain the execution result. In a possible implementation, the loading module is specifically configured to: load a user-mode context of the agent process by the agent process. In a possible implementation, when an exception occurs in the process in which the agent process executes the to-be-executed business code segment, the agent process is switched from the user mode to the kernel mode, and after the current user-mode context is loaded by the to-be-processed business process, the page table-based business processing apparatus further includes: the loading module, which is further configured to load a user-mode context of the agent process by the agent process; and a control module, which is configured to control the agent process to be switched from the kernel mode to the user mode. In a possible implementation, the second page table is a multi-level page table, and a top-level page table of the second page table is used to store a page table entry of a business process. Correspondingly, the execution module is specifically configured to: copy a page table entry in the first page table to the top-level page table of the second page table. In a possible implementation, when the mark indicates that the exception is the software and hardware exception, the execution module is specifically configured to: continue to execute the to-be-executed business code segment according to the first page table, the current user-mode context, and the mark by the to-be-processed business process, to generate the execution result; and control the to-be-processed business process to be switched from the kernel mode to the user mode.In a possible implementation, before the obtaining of the to-be-executed business code segment, the user state context and the first page table of the to-be-processed business process, the page table-based business processing apparatus further includes a configuration module configured to configure a new business process by using a compiling tool, a global kernel module, a process loader and a memory allocation module. In a possible implementation, the configuration module is specifically configured to: limit, by the compiling tool, a business code in the new business process, and use a relative offset for access and jump; allocate, by the global kernel module, a virtual address interval for the new business process; the virtual address interval allocated for the new business process does not overlap with a virtual address interval of an existing business process; start the new business process according to the virtual address interval allocated for the new business process; configure, by the memory allocation module, a memory mapping parameter of the new business process according to the virtual address interval allocated for the new business process; and map, by the process loader, a business code of the new business process to the virtual address interval of the new business process according to the memory mapping parameter. In a third aspect, an electronic device is provided, including a processor, a memory and computer-executable instructions stored in the memory and executable on the processor, and the processor is configured to implement the method in the first aspect and the possible implementations. In a fourth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executable on a processor to implement the method in the first aspect and the possible implementations. In a fifth aspect, a computer program product is provided, including a computer program, and the computer program is executable on a processor to implement the method in the first aspect and the possible implementations. The page table-based business processing method, apparatus, device, medium and product provided in the embodiments of the present disclosure are applied to an electronic device, and the electronic device is deployed with an agent process and a plurality of business processes, the agent process is configured to execute a business code segment of any business process, and virtual address intervals corresponding to different business processes do not overlap. In the method, a to-be-executed business code segment, a user state context and a first page table of a to-be-processed business process are obtained. Then, the agent process loads the to-be-executed business code segment and the user state context. Finally, the agent process executes the to-be-executed business code segment according to the first page table and the user state context, and generates an execution result. The agent process is in the user state.In the technical solution, the agent process can load and execute the to-be-executed business code segment of the to-be-processed business process without entering the kernel state and giving up the CPU resource, effectively reducing the overhead and improving the performance. Moreover, because the virtual address intervals corresponding to different business processes do not overlap and the processing processes of different business processes do not affect each other, the process-level business isolation is preserved without modifying the business code, and the stability is high. The accompanying drawings are used to provide further understanding of the present disclosure, and form a part of the present disclosure. The illustrative embodiments of the present disclosure and their descriptions serve to explain the present disclosure without limiting it. In the drawings: Fig. 1 is a structural schematic diagram of an electronic device according to an embodiment of the present disclosure; Fig. 2 is a flow schematic diagram of a business processing method based on a page table according to an embodiment of the present disclosure; Fig. 3 is a structural schematic diagram of a second page table according to an embodiment of the present disclosure; Fig. 4 is a flow schematic diagram of a business processing method based on a page table according to an embodiment of the present disclosure; Fig. 5 is a flow schematic diagram of a business processing method based on a page table according to an embodiment of the present disclosure; Fig. 6 is a flow schematic diagram of a business processing method based on a page table according to an embodiment of the present disclosure; Fig. 7 is a flow schematic diagram of a business processing method based on a page table according to an embodiment of the present disclosure; Fig. 8 is a flow schematic diagram of a business processing method based on a page table according to an embodiment of the present disclosure; Fig. 9 is a flow schematic diagram of a business processing method based on a page table according to an embodiment of the present disclosure; Fig. 10 is a structural schematic diagram of a business processing device based on a page table according to an embodiment of the present disclosure; and Fig. 11 is a structural schematic diagram of an electronic device according to an embodiment of the present disclosure. In the specific embodiments of the present disclosure, the technical solutions and advantages of the present disclosure will be more clearly described. Obviously, the described embodiments are only some, but not all, of the embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present disclosure. The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present disclosure are all authorized by the user or authorized by all parties, and the collection, use and processing of the related data need to comply with relevant laws, regulations and standards, and provide corresponding operation entrances for the user to choose authorization or refusal.First, the terms involved in the embodiments of the present disclosure are explained: Virtual Address (Virtual Address, VA): the main memory of a computer system is an array composed of M contiguous byte-sized units, each byte has a unique physical address, the address range is from 0 to M-1. OThere are two ways for computer to use memory, one is physical addressing, that is, using physical address. The other way is to use virtual address, CPU accesses main memory by generating a virtual address, which is converted into an appropriate physical address before being sent to memory. The specialized hardware responsible for address translation is called memory management unit (MMU). For current 64-bit computer systems, MMU usually has the ability to access a very large virtual address space, and the commonly used 4-level page table has an address access capacity of 256TB. Most processes only need less than 512GB of virtual address space to meet their needs, but computer systems generally allow each process to access almost all the virtual address space that can be accessed. In order to improve the performance of computer translation of virtual addresses, computer systems provide page table cache (Translation Lookaside Buffer, TLB), and high-frequency access page table is recorded in the CPU cache to reduce address translation overhead. Process: Process is a unit of resource isolation in traditional operating system, processes do not share virtual address space with each other, and the operating system kernel configures a page table for each process, and each process thinks it owns all physical memory resources. Each process can only access its own code segment and memory, and the code segments of different processes can only be executed in their own user state context. Process switching and scheduling: The operating system designs a process queue for each CPU through the scheduler in the kernel, and schedules the process running on the CPU according to the time slice of each process. The switching of the process on the CPU is completed by the operating system kernel in the kernel state, and after the switching is completed, the CPU will switch back to the user state to continue executing the user state process. Each switching needs a hardware "enter-exit" kernel state process. When the kernel state does process switching, it will reset the corresponding page table register CR3, so that the newly switched-in process can correctly access its own page table. At the same time, when resetting the CR3 register, the hardware will flush the TLB, resulting in lower address translation performance of the newly switched-in process. Next, the scenario involved in the embodiments of the present disclosure is introduced: For data center high-performance servers, in order to ensure performance, some business processes often run in a long-term exclusive CPU mode. When there is no allocatable CPU in the high-performance server, how to introduce and share new business processes is a problem to be solved. At present, in order to introduce new business processes, multiple business processes can be bound to the same CPU. Specifically, in actual use, after a business process is running, the CPU will switch to the kernel state, and the switching of the business process will be completed in the kernel state.After the switch is completed, the CPU switches back to the user mode to continue executing the new switched-in business process. Each switch needs a hardware "enter-exit" kernel mode process, which has a large overhead and can cause a sharp decline in server performance. Furthermore, to solve the above problems, similar PMD process codes of different businesses can be combined into one business and implemented in the form of a process. In this way, different businesses can share CPU resources within the same process. However, this method often causes mutual coupling between multiple businesses, and an exception of one business can cause the entire process to crash and affect other businesses, so the businesses cannot be effectively isolated and the stability is poor. To solve the above technical problems, the inventive concept of the present disclosure is as follows: The virtual address range used by each business process can be limited so that the virtual address ranges corresponding to different business processes do not overlap. In addition to multiple business processes, a proxy process can also be deployed in the electronic device, which is responsible for CPU resource allocation. In this way, when any business process needs to execute a business code segment, the page table, the to-be-executed business code segment, and the user mode context of the business process can be shared with the proxy process, and the proxy process can directly load the to-be-executed business code segment and access the memory of the business process without kernel switching when occupying the CPU, thereby realizing process-level resource switching in the user mode. The present disclosure executes the to-be-executed business code segments of different business processes through the proxy process, without performing the "enter-exit" kernel mode process, which has a small overhead and good performance. At the same time, by allocating non-overlapping virtual address ranges to each business process, the isolation between businesses is effectively guaranteed, and the business processes do not affect each other, so the stability is high. Based on the above inventive concept, the present disclosure provides a page table-based business processing method, device, equipment, medium, and product. The page table-based business processing method provided by the present disclosure is applied to an electronic device, which can be a terminal device or a server. In actual applications, whether the electronic device is a terminal device or a server can be determined according to actual conditions, and no specific limitation is made in this regard. Exemplarily, the electronic device can be applied to the structural schematic diagram shown in FIG. 1. FIG. 1 is a structural schematic diagram of an embodiment of an electronic device according to the present disclosure. As shown in FIG. 1, the electronic device 10 is deployed with a proxy process 11 and multiple business processes (the business process 12, the business process 13, and the business process 14 in FIG. 1). Different business processes correspond to non-overlapping virtual address ranges, and each business process can interact with the proxy process 11.The agent process 11 is responsible for CPU resource allocation. When a service process needs to execute a service code segment, the service process shares its page table, service code segment, and user state context with the agent process, and the agent process 11 executes the service code segment of the service process on behalf of the service process. It should be understood that the service process shown in FIG. 1 is a service process participating in sharing, that is, a service process executing its own service code segment through an agent process. In actual applications, the electronic device 10 can also include other service processes that do not participate in sharing, which need to execute service code segments by themselves. Specifically, which service processes in the electronic device 10 participate in sharing and which service processes do not participate in sharing can be achieved by pre-configuring the service processes. The configuration process can refer to the embodiments shown in FIG. 8 and FIG. 9, and details are not described herein. It should be understood that the number of agent processes and the number of service processes deployed in the electronic device are not limited in the embodiments of the present disclosure. FIG. 1 only exemplarily illustrates one agent process and three service processes, and the number of agent processes and the number of service processes can be determined according to actual conditions. The technical solutions shown in the present disclosure are described in detail through specific embodiments. It should be noted that the following embodiments can exist independently or be combined with each other. For the same or similar content, details are not described again in different embodiments. FIG. 2 is a flowchart of an embodiment of a page table-based service processing method provided by the embodiments of the present disclosure. Please refer to FIG. 2. The page table-based service processing method can be implemented through the following steps.

[0002] S21, obtain a to-be-executed business code segment of a to-be-processed business process, a user mode context, and a first page table. The execution subject of the embodiment of the present disclosure is an electronic device, the electronic device is deployed with a proxy process and a plurality of business processes, the proxy process is used to execute a business code segment of any business process, and the virtual address intervals corresponding to different business processes do not overlap. That is, the business process is the above-mentioned business process participating in sharing. It should be understood that the electronic device can be a terminal device, and can also be a server. Whether the electronic device is a terminal device or a server can be determined according to actual conditions, and no specific limitation is made in this regard. In this step, when the to-be-processed business process is triggered and the corresponding to-be-executed business code segment needs to be called to implement the required functions such as data processing, verification, calculation, etc. Since the present disclosure needs to replace the business process to execute the business code segment by the proxy process, the to-be-executed business code segment of the to-be-processed business process needs to be obtained. In the execution process of the to-be-executed business code segment, the user mode context is needed to ensure the correctness of the business logic, and the first page table is needed to access the memory of the to-be-processed business process, so the user mode context and the first page table also need to be obtained. The user mode context is used to describe the state information of the to-be-processed business process running in the user mode, for example, can include at least one of a program counter, a register state, memory management information, a user stack, an opened file descriptor, or signal processing information. It should be understood that the memory management information includes a page table pointer, the page table pointer points to the first page table, and the first page table is a page table used by the to-be-processed business process. In a possible implementation manner, after the to-be-processed business process is triggered, the to-be-processed business process obtains the to-be-executed business code segment and the user mode context. Then the to-be-processed business process calls a kernel mode interface to apply the to-be-executed business code segment to be executed by the proxy process, so as to submit the to-be-executed business code segment and the user mode context to the proxy process. At the same time, the to-be-processed business process obtains the first page table of the to-be-processed business process, and shares the first page table to the proxy process, so that the proxy process accesses the memory of the to-be-processed business process. In a specific implementation manner, the first page table can be copied, and the copied first page table is submitted to the proxy process, so as to share the first page table to the proxy process. In another specific implementation manner, the page table entries in the first page table can also be copied into a second page table of the proxy process, so as to share the first page table to the proxy process. The second page table is a page table used by the proxy process. It should be understood that the first page table can be a one-level page table or a multi-level page table; similarly, the second page table can be a one-level page table or a multi-level page table, which can be set according to actual conditions, and the embodiment of the present disclosure does not make a specific limitation in this regard.In the case that the second page table is a multi-level page table, the top-level page table of the second page table is used to store the page table entry of the service process, and the page table entry of the first page table can be copied into the top-level page table of the second page table. For example, in the case of a four-level page table, the content contained in each level of the page table can be as follows: the first-level page table: contains the page table entry pointing to the second-level page table, and is used to map the virtual address to the second-level page table; the second-level page table: contains the page table entry pointing to the third-level page table, and is used to map the virtual address to the third-level page table; the third-level page table: contains the page table entry pointing to the fourth-level page table, and is used to map the virtual address to the fourth-level page table; and the fourth-level page table: contains the address mapping of the physical page, and the control information related to the page state, such as the present bit, the dirty bit, the protection bit, etc. In the above example, the first-level page table is the top-level page table. Since the page table entry in the top-level page table is used to map the virtual address to the next level of the page table, it will not be changed. Therefore, after obtaining the first page table, it can also be detected whether the page table entry of the first page table is already contained in the top-level page table of the second page table. If it is contained, no copying operation is needed, and if it is not contained, the page table entry of the first page table needs to be copied into the top-level page table of the second page table. It should be understood that in the copying process, the page table entry of other service processes previously copied can be overwritten. For example, in actual application, any of the following situations will cause the to-be-processed service process to be triggered: a triggering event: the to-be-processed service process will be triggered according to a specific event triggering condition, such as a user request, a timing task, a message notification, etc. timing scheduling: the to-be-processed service process will be triggered according to a predetermined time schedule, such as performing data backup every morning, performing report generation every week, etc. condition satisfaction: in some cases, the to-be-processed service process is triggered when a specific condition is met, such as a certain indicator reaching a certain value, a user performing a certain operation, etc. external request: the to-be-processed service process is triggered to respond to a request when it receives an external system or user request. data change: the to-be-processed service process is triggered to perform corresponding processing when it monitors data changes, such as real-time data updating, data synchronization, etc. It should be understood that when the to-be-processed service process is triggered, the to-be-processed service process is switched from the user mode to the kernel mode.

[0003] 522、 Load the to-be-executed business code segment and the user mode context by the agent process. In this step, when the agent process is in an idle state, it is detected in real time whether there is a to-be-executed business, i.e., whether there is a to-be-executed business code segment, a user mode context and a first page table of any to-be-processed business process. If there is, the agent process loads the to-be-executed business code segment and the user mode context. Here, the agent process is in a user mode. In a specific implementation, the user mode context contains an instruction pointer register (English: rip) pointing to the code in the to-be-executed business code segment. The to-be-executed business code segment in the memory is read, the code pointed to by the rip in the to-be-executed business code segment is determined, and the to-be-executed business code segment is executed from the code. Optionally, if the agent process detects that there are multiple to-be-executed businesses, the agent process can determine the next to-be-processed to-be-executed task according to the order in which the multiple to-be-executed tasks arrive at the agent process. The agent process can also determine the to-be-executed task with the highest priority in the multiple to-be-executed tasks as the next to-be-processed to-be-executed task according to the priority of the to-be-executed task. The next to-be-processed to-be-executed task in the multiple to-be-executed businesses can also be determined by a scheduling component. The scheduling component is deployed with a related scheduling algorithm, such as according to the arrival time, according to the priority, according to whether it needs to be responded in real time, according to the time slice, according to the response ratio, etc., to determine the next to-be-processed to-be-executed task according to the scheduling algorithm. After the next to-be-processed to-be-executed task is determined, the to-be-executed business code segment and the user mode context corresponding to the to-be-executed task are loaded.

[0004] 523、According to the first page table and the user state context, the agent process executes the to-be-executed business code segment to generate an execution result. In this step, after the agent process loads the to-be-executed business code segment and the user state context, the agent process can access the memory of the to-be-processed process through the first page table, execute the to-be-executed business code segment according to the user state context, and thus generate a corresponding execution result. In a possible implementation manner, when the sharing mode is to copy the page table entry in the first page table to the second page table of the agent process, the agent process can call the first page table according to the page table entry corresponding to the first page table in the second page table. According to the first page table and the user state context, the agent process executes the to-be-executed business code segment to generate an execution result. FIG. 3 is a structural schematic diagram of a second page table provided in an embodiment of the present disclosure. Referring to FIG. 3, the second page table shown in FIG. 3 is a multi-level page table, and the top-level page table of the second page table stores a plurality of page table entries. The page table entry 1 is a page table entry corresponding to the agent process, and is used to store the mapping information of the virtual address interval of the agent process itself to the physical address interval. The in-page offset corresponding to the page table entry 1 is 0-512GB OThe page table item 2 is a page table item corresponding to the service process 1, and a next-level page table page indexed by a value of the page table item 2 directly points to a page table 1 of the service process 1. A page offset corresponding to the page table item 2 is 512GB*i-512GB*(i+1), i is a positive integer greater than 0. The page table 1 includes a plurality of page table items, for example, a page table item with a page offset of 0-2MB and a page table item with a page offset of 2MB*m-2MB*(m+1) in FIG. 3, m is a positive integer greater than 0. The page table item 3 is a page table item corresponding to the service process 2, and a next-level page table page indexed by a value of the page table item 2 directly points to a page table 2 of the service process 2. A page offset corresponding to the page table item 2 is 512GB*j-512GB*(j+1), j is a positive integer greater than i. The page table 2 includes a plurality of page table items, for example, a page table item with a page offset of 0-2KB and a page table item with a page offset of 2KB*m-2KB*(m+1) in FIG. 3. For example, assuming that a to-be-executed service code segment of the service process 1 needs to be executed, the page table 1 of the service process 1 indexed by a value of the page table item of the service process 1 stored in the top-level page table of the second page table can be determined, and the memory of the service process 1 is accessed according to a corresponding virtual address interval in the page table 1. Then, the agent process executes the to-be-executed service code segment based on the loaded user state context, including data processing, logical operation and other operations, and finally, an execution result corresponding to the to-be-executed service code segment is generated. In another possible implementation, the first page table sent by the to-be-processed service process can be obtained, and the to-be-executed service code segment is executed according to the first page table and the user state context, and an execution result is generated. Optionally, in some embodiments, after the execution result is generated, it is indicated that the service processing is completed this time, and the agent process needs to load the user state context of the agent process, so that the agent process returns to the initial state, and waits for the next to-be-processed to-be-executed service for continuous processing. It should be understood that the user state context of the agent process refers to a user state context used when processing the service code of the agent process. Similarly, the user state context of the to-be-processed service process refers to a user state context used when processing the service code of the to-be-processed service process. Optionally, when the agent process executes the to-be-executed service code segment of the to-be-processed service process, the to-be-processed service process is in the kernel state and in the waiting state with less occupied resources, which greatly saves the computing resources. After the to-be-processed service process obtains the execution result, the processing is completed this time, and the to-be-processed service process is switched from the kernel state to the user state.The page table-based service processing method provided by the embodiments of the present disclosure is applied to an electronic device, the electronic device is deployed with a proxy process and a plurality of service processes, the proxy process is used to execute a service code segment of any service process, and the virtual address intervals corresponding to different service processes do not overlap. In the method, first, a to-be-executed service code segment of a to-be-processed service process, a user state context, and a first page table are acquired. Then, the proxy process is used to load the to-be-executed service code segment and the user state context. Finally, the proxy process is used to execute the to-be-executed service code segment according to the first page table and the user state context, and an execution result is generated. In the technical solution, after the proxy process acquires the first page table shared by the to-be-processed service process, the proxy process can load and execute the to-be-executed service code segment of the to-be-processed service process without entering the kernel state and giving up the CPU resource, thereby effectively reducing the overhead and improving the performance. In addition, because the virtual address intervals corresponding to different service processes do not overlap and the processing processes of different service processes do not affect each other, the process-level service isolation is preserved and the stability is improved without modifying the service code. Next, the above embodiments are explained and described through a specific example. By way of example, FIG. 4 is a flowchart of a second embodiment of the page table-based service processing method provided by the embodiments of the present disclosure, please refer to FIG. 4. The page table-based service processing method can be implemented through the following steps.

[0005] 5401、 The to-be-processed service process acquires a to-be-executed service code segment and a user state context.

[0006] 5402、 The to-be-processed service process calls a kernel state interface to apply the proxy process to execute the to-be-executed service code segment, so as to submit the to-be-executed service code segment and the user state context to the proxy process.

[0007] 5403、 The to-be-processed service process shares the page table entries of the first page table to a second page table of the proxy process.

[0008] 5404、 The to-be-processed service process waits for an execution result of the proxy process.

[0009] 5405、 The proxy process performs scheduling and distribution.

[0010] 5406、 The proxy process detects whether there is a to-be-executed service. If yes, S407 is executed; if no, S405 is executed. o

[0011] 5407、 The proxy process loads a to-be-executed service code segment and a user state context.

[0012] 5408、 The agent process executes the to-be-executed business code segment according to the page table entry of the first page table and the user-mode context.

[0013] 5409、 After the agent process completes the execution, an execution result is generated and returned to the to-be-processed business process.

[0014] 5410、 The agent process restores the user-mode context of the agent process, and executes S404 o In actual applications, the agent process may trigger an exception when executing the to-be-executed business code segment, and therefore an exception handling mechanism needs to be formulated. Next, the exception handling mechanism is described. FIG. 5 is a flowchart of an embodiment three of the business processing method based on a page table provided by the present disclosure, please refer to FIG. 5, S23 can be implemented by the following steps: 551, executing the to-be-executed business code segment by the agent process according to the first page table and the user-mode context. It should be understood that the implementation manner and principle of the present step can refer to the related content in S23, and will not be described here.

[0015] 552、If an exception occurs in the execution process, the current user mode context of the to-be-processed business process is cached and marked by the agent process. In this step, when the agent process executes the to-be-executed business code segment, the user mode context will change. If an exception occurs in the execution process, the exception needs to be returned to the to-be-processed business process for processing. Therefore, when an exception occurs in the execution process, the current user mode context needs to be saved, that is, the current user mode context is different from the above-mentioned user mode context. The agent process needs to cache the current user mode context of the to-be-processed business process, so as to subsequently return the current user mode context to the to-be-processed business process, and the to-be-processed business process recovers and processes it. At the same time, since different exceptions correspond to different processing methods, the current user mode context also needs to be marked, which is used to indicate the exception existing in the current user mode context, so that the to-be-processed business process can execute the corresponding processing method according to the mark on the current user mode context. The exception includes a software and hardware exception or an error (English: syscall) when accessing a kernel mode resource. For example, the software and hardware exception includes a divide-by-zero operation, a memory page fault, and the like. Alternatively, when an exception occurs in the process of the agent process executing the to-be-executed business code segment, the agent process will automatically switch from the user mode to the kernel mode. After the agent process caches and marks the current user mode context of the to-be-processed business process, the agent process ends this processing, needs to load the user mode context of the agent process by the agent process, and controls the agent process to switch from the kernel mode to the user mode, so as to make the agent process return to the initial state, and then continue to process the next to-be-executed business. It should be understood that the specific implementation process and principle of loading the user mode context of the agent process by the agent process can refer to the related content of loading the user mode context by the agent process in S22, which will not be repeated here.

[0016] 553、Load the current user mode context by the to-be-processed business process. It should be understood that the specific implementation process and principle of loading the current user mode context by the to-be-processed business process can refer to the related content of loading the user mode context by the agent process in S22, which will not be repeated here.

[0017] 554、The to-be-processed business process continues to execute the to-be-executed business code segment according to the first page table, the current user mode context, and the mark, to generate an execution result. In this step, the to-be-processed business process can determine an exception existing in the current user mode context according to the mark, and then determine the processing logic for the exception. Subsequently, the to-be-processed business process continues to execute the to-be-executed business code segment according to the first page table, the current user mode context, and the processing logic. When the exception is a hardware or software exception, the to-be-processed business process re-executes the exception code in the to-be-executed business code segment after loading the current user mode context, and then triggers the processing logic of the to-be-processed business process for the hardware or software exception, to obtain an execution result. After obtaining the execution result, the to-be-processed business process is switched from the kernel mode to the user mode, and waits to be triggered next time. When the to-be-executed business code segment needs to access a kernel mode resource, because the kernel contexts of each process in the kernel are independent of each other, and the to-be-executed business code segment is executed by the proxy process, the kernel code will mistakenly consider that the access request originates from the proxy process, and the application programming interface (App I i cat i on Programmi ng I interface, AP I) of the kernel application program will mistakenly write changes to the kernel mode resource of the proxy process instead of the kernel mode resource of the to-be-processed business process, and thus access an incorrect resource, resulting in an exception. When an error occurs in the exception of accessing the kernel mode resource, in order to enable the to-be-processed business process to re-execute the instruction of accessing the kernel mode resource, so as to trigger the access process of the to-be-processed business process itself, it is necessary to return the r i p of the current user mode context of the to-be-processed business process to a position before the kernel mode resource is accessed, to obtain a processed user mode context. In this way, the to-be-processed business process can re-access the kernel mode resource according to the first page table and the processed user mode context, to continue to execute the to-be-executed business code segment and obtain an execution result. Specifically, because the user mode process (the business process and the proxy process) enters the kernel mode to access hardware through a sysca I I instruction, after obtaining the processed user mode context, the to-be-processed business process still needs to be switched from the kernel mode to the user mode, so that the subsequent sysca Instructions, re-access the kernel state resources. The above embodiment provides an exception handling mechanism, in modern operating systems, the process enters the kernel state after saving the user state context for use when exiting, the embodiment of the disclosure reuses the design, when the proxy process executes the exception of the to-be-processed code segment, the current user state context is reserved, and the current user state context is returned to the to-be-processed business process for exception handling. The process of the to-be-processed business process for exception handling can directly follow the existing process, or the existing process can be improved, and the embodiment of the disclosure does not make specific limitations. The embodiment of the disclosure formulates an exception handling mechanism to ensure that when the proxy process executes the to-be-executed business code segment, the to-be-executed business code segment can still be executed by the to-be-processed business process, and the smooth execution of the to-be-executed business code segment is ensured. Next, the exception handling mechanism is exemplarily described with respect to software and hardware exceptions and errors occurring when accessing the kernel state resources. FIG. 6 is a flowchart of an embodiment four of a business processing method based on a page table provided by the embodiment of the disclosure, please refer to FIG. 6, when a software and hardware exception is triggered, S23 can be implemented by the following steps:

[0018] 5601、 When a software and hardware exception is triggered, the proxy process judges whether the to-be-executed business code segment is being executed. This step is mainly used to judge whether the proxy process is processing the business of the business process or the business of itself at this time. If the business of the business process is processed, the exception handling mechanism proposed by the disclosure is triggered, and the exception is returned to the business process for processing, if the business of the proxy process is processed, the exception handling mechanism of the proxy process itself is triggered, that is, the exception handling mechanism configured in advance for processing the exception of each process. If yes, S602 is executed; if no, the exception handling mechanism of the proxy process itself is triggered.

[0019] 5602、 The proxy process caches the current user state context of the to-be-processed business process.

[0020] 5603、 The proxy process marks the cached current user state context as "in a software and hardware exception".

[0021] 5604、 The proxy process loads the user state context of itself.

[0022] 5605、 The proxy process returns to the user state.

[0023] 5606、 The to-be-processed business process monitors whether the proxy process returns to the user state in real time. If yes, S607 is executed, if no, S606 is executed o

[0024] 5607、 The agent process whether to cache the current user mode context marked as "in soft / hardware exception". In this step, the to-be-processed business process can check whether there is the current user mode context marked as "in soft / hardware exception" in the cache of the agent process after determining that the agent process returns to the user mode. If yes, S608 is executed, and if no, S610 is executed. o

[0025] 5608、 The to-be-processed business process loads the current user mode context.

[0026] 5609、 The to-be-processed business process re-accesses the kernel mode resource according to the first page table and the processed user mode context, to continue to execute the to-be-executed business code segment, and obtain an execution result.

[0027] 5610、 The to-be-processed business process returns to the user mode. FIG. 7 is a flowchart of the fifth embodiment of the business processing method based on the page table provided by the embodiment of the present disclosure. As shown in FIG. 7, when an error occurs in accessing the kernel mode resource, S23 can be implemented through the following steps:

[0028] 5701、 When an error occurs in accessing the kernel mode resource, the agent process determines whether the to-be-executed business code segment is being executed. If yes, S702 is executed, and if no, an exception handling mechanism of the agent process itself is triggered.

[0029] 5702、 The agent process caches the current user mode context of the to-be-processed business process.

[0030] 5703、 The agent process marks the cached current user mode context as "syscall".

[0031] 5704、 The agent process loads the user mode context of the agent process.

[0032] 5705、 The agent process returns to the user mode.

[0033] 5706、 The to-be-processed business process monitors whether the agent process returns to the user mode in real time. If yes, S707 is executed, and if no, S706 is executed. o

[0034] 5707、 The agent process whether to cache the current user mode context marked as "syscall". If yes, S708 is executed, and if no, S710 is executed. o

[0035] 5708、 The to-be-processed business process loads the current user mode context.

[0036] 5709、 The to-be-processed service process returns the rip in the current user mode context to the position before accessing the kernel mode resource, and obtains a processed user mode context.

[0037] 5710、 The to-be-processed service process returns to the user mode.

[0038] 5711、 The to-be-processed service process re-accesses the kernel mode resource according to the first page table and the processed user mode context, to continue executing the to-be-executed service code segment, and obtains an execution result. Optionally, in any of the foregoing embodiments, based on non-overlapping virtual addresses and page table sharing, the proxy process can execute the service code segment of the service process. During execution, some special user mode contexts need to be loaded in the user mode by using privileged instructions, for example, a file segment register (File Segment Register, fs) for recording a thread local variable, a floating point unit (Floating Point Unit, fpu) register context, and a vector instruction (Advanced Vector Extensions, AVX / Streaming SIMD Extensions, SSE) register context. In order to execute the foregoing special user mode contexts, the proxy process can directly load the foregoing special user mode contexts in the user mode based on the fsgsbase feature and the xsave / xstore feature of the CPU. In actual application, the service process in the electronic device can be configured in advance, so that the configured service process can execute the service code of the service process by using the proxy process. Similarly, when a new service process needs to be introduced during the running of the electronic device, and the new service process needs to execute the service code of the new service process by using the proxy process, the new service process also needs to be configured. In a possible implementation, before obtaining the to-be-executed service code segment, the user mode context, and the first page table of the to-be-processed service process, the new service process can be configured by using a compiling tool, a global kernel module, a process loader, and a memory allocation module. FIG. 8 is a flowchart of a service processing method based on a page table according to a sixth embodiment of the present disclosure. As shown in FIG. 8, the process of configuring the new service process by using the compiling tool, the global kernel module, the process loader, and the memory allocation module can be implemented by the following steps.

[0039] 581、 The business code in the new business process is defined by a compiling tool, and relative offsets are used for access and jump. In this step, it is required to specify in the compiling tool that the new business process cannot use fixed virtual addresses, so that all business code segments in the new business process use relative offsets for access and jump.

[0040] 582、 The virtual address interval is allocated to the new business process by a global kernel module. In this step, the global kernel module is responsible for globally managing the virtual address intervals of the business processes participating in sharing, to ensure that the page tables of the business processes do not overlap, that is, the virtual address intervals allocated to the business processes do not overlap. That is, the virtual address interval allocated to the new business process by the global kernel module does not overlap with the virtual address intervals of the existing business processes. It should be understood that the virtual address interval size corresponds to the virtual address interval corresponding to one page table entry of the top-level page table of the current system page table. For example, assuming that the current system page table is a 4-level page table, one page table entry of the top-level page table of the 4-level page table corresponds to a 512G virtual address interval, and each business process is allocated a maximum of 512G virtual address interval, and they do not overlap with each other.

[0041] 583、 The new business process is started according to the virtual address interval allocated to the new business process. In this step, S83 O The process starting tool is used to start the business processes participating in sharing. Before starting the new business process, the starting tool communicates with the global kernel module and determines the virtual address interval available to the new business process.

[0042] 584、 The memory mapping parameters of the new business process are configured by the memory allocation module according to the virtual address interval allocated to the new business process. In this step, the memory allocation module is used to allocate memory mapping parameters to the new business process and limit the virtual address interval of the new business process. It should be understood that the mapping beyond the virtual address interval will fail.

[0043] S85、 The business code of the new business process is mapped to the virtual address interval of the new business process by the process loader according to the memory mapping parameters. In this step, when the new business process is started, the process loader maps the business code, process file, stack, heap and other memory resources of the business process to the specified virtual address interval according to the memory mapping parameters. Based on the above configuration process, a specific example is used for illustrative description. FIG. 9 is a flowchart of embodiment seven of the business processing method based on the page table provided by the present disclosure. Please refer to FIG. 9. The configuration of the new business process can be achieved by the following process:

[0044] 591、 The startup tool is started up.

[0045] 592、 The startup tool applies to the global kernel module for allocating a virtual address interval for a new service process.

[0046] 593、 The kernel interface is called to load the new service process.

[0047] 594、 The memory mapping parameters of the new service process are configured through the memory allocation module.

[0048] 595、 The service code of the new service process is mapped to the virtual address interval of the new service process through the process loader.

[0049] 596、 Start a new service process, and exit the starting tool. The page table-based service processing method shown in any of the foregoing embodiments can realize that the proxy process accesses the resource of the service process by the service process sharing its page table with the proxy process, can unlimitedly access the memory space of the service process including the code and data storage memory without switching the page table register CR3, performs process-level resource switching in the user mode, effectively improves the service performance, and reduces the service overhead. The service isolation and stability are realized by limiting the use of non-overlapping virtual address intervals by the service processes. The following is an apparatus embodiment of the present disclosure, which can be used to execute the method embodiments of the present disclosure. For details not disclosed in the apparatus embodiment of the present disclosure, refer to the method embodiments of the present disclosure. FIG. 10 is a structural schematic diagram of a page table-based service processing apparatus provided by an embodiment of the present disclosure. Referring to FIG. 10, the page table-based service processing apparatus 100 includes: an obtaining module 101 configured to obtain a to-be-executed service code segment of a to-be-processed service process, a user mode context, and a first page table; a loading module 102 configured to load the to-be-executed service code segment and the user mode context by a proxy process, the proxy process being in the user mode; and an executing module 103 configured to execute the to-be-executed service code segment according to the first page table and the user mode context by the proxy process, and generate an execution result. In a possible implementation, the executing module 103 is specifically configured to: copy a page table entry in the first page table to a second page table of the proxy process; call the first page table according to the page table entry corresponding to the first page table in the second page table by the proxy process; and execute the to-be-executed service code segment according to the first page table and the user mode context by the proxy process, and generate the execution result. In a possible implementation, the executing module 103 is specifically configured to: execute the to-be-executed service code segment according to the first page table and the user mode context by the proxy process; if an exception occurs in the execution process, cache and mark the current user mode context of the to-be-processed service process by the proxy process, the mark being used to indicate that the current user mode context exists the exception; load the current user mode context by the to-be-processed service process; and continue to execute the to-be-executed service code segment according to the first page table, the current user mode context, and the mark by the to-be-processed service process, and generate the execution result. In a possible implementation, the exception includes a software and hardware exception or an error occurring when accessing the kernel mode resource.In a possible implementation, when the label indicates that the exception is an error occurring when accessing the kernel state resource, the execution module 103 is specifically configured to: back up, by the to-be-processed business process, an instruction pointer register of the current user state context to a position before the kernel state resource is accessed, to obtain a processed user state context; and re-access, by the to-be-processed business process, the kernel state resource according to the first page table and the processed user state context, to continue to execute the to-be-executed business code segment, to obtain an execution result. In a possible implementation, the loading module 102 is specifically configured to: load, by the agent process, a user state context of the agent process. In a possible implementation, when an exception occurs in the process in which the agent process executes the to-be-executed business code segment, the agent process is switched from the user state to the kernel state, and after the current user state context is loaded by the to-be-processed business process, the business processing apparatus 100 based on a page table further includes: the loading module 102, which is further configured to load, by the agent process, a user state context of the agent process; and the control module, which is configured to control the agent process to be switched from the kernel state to the user state. In a possible implementation, the second page table is a multi-level page table, and a top-level page table of the second page table is configured to store a page table entry of the business process; correspondingly, the execution module 103 is specifically configured to: copy the page table entry in the first page table to the top-level page table of the second page table. In a possible implementation, when the label indicates that the exception is a software and hardware exception, the execution module 103 is specifically configured to: continue to execute, by the to-be-processed business process, the to-be-executed business code segment according to the first page table, the current user state context, and the label, to generate an execution result; and control the to-be-processed business process to be switched from the kernel state to the user state. In a possible implementation, before the to-be-executed business code segment of the to-be-processed business process, the user state context, and the first page table are obtained, the business processing apparatus 100 based on a page table further includes a configuration module, which is configured to: configure, by a compilation tool, a global kernel module, a process loader, and a memory allocation module, a new business process. In a possible implementation, the configuration module is specifically configured to: limit, by the compilation tool, a business code in the new business process, to use a relative offset for access and jump; allocate, by the global kernel module, a virtual address interval for the new business process; the virtual address interval allocated for the new business process does not overlap with a virtual address interval of an existing business process; start the new business process according to the virtual address interval allocated for the new business process; configure, by the memory allocation module, a memory mapping parameter of the new business process according to the virtual address interval allocated for the new business process; and map, by the process loader, the business code of the new business process to the virtual address interval of the new business process according to the memory mapping parameter.The page table-based service processing apparatus provided by the embodiments of the present disclosure can implement the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here. It should be noted that the division of each module of the above apparatus is only a logical division of functions, and all or part of the modules can be integrated into one physical entity, or can be physically separated. Moreover, all or part of the modules can be integrated together or independently implemented. The processing element can be an integrated circuit with signal processing capability. In the implementation process, each step of the above method or each module can be completed by the integrated logic circuit of hardware or the instruction of software in the processing element. FIG. 11 is a structural schematic diagram of the second electronic device embodiment provided by the embodiments of the present disclosure. As shown in FIG. 11, the electronic device 10 can include a processor 111 and a memory 112. The processor 111, the memory 112, and each part are connected to each other through a system bus 113. The memory 112 stores computer execution instructions. The processor 111 executes the computer execution instructions stored in the memory 112, so that the processor 111 executes the page table-based service processing method shown in the above method embodiments. Optionally, each device of the electronic device 10 can be connected through the system bus 113. Optionally, the electronic device 10 can further include a communication interface for interacting with other devices. It should be understood that the processor 111 can be a CPU, and can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application-specific integrated circuits (Application Specific Integrated Circuit, ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the present disclosure can be directly embodied as hardware processor execution, or executed by a combination of hardware and software modules in the processor. The system bus 113 can be a peripheral component interconnect (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc.The system bus 113 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is shown in the figure, but it does not mean that there is only one bus or only one type of bus. The memory can include a random access memory (RAM) and can also include a non-volatile memory (NVM), for example, at least one disk memory. The electronic device provided by the embodiments of the present disclosure can be used to execute the page table-based service processing method provided by any one of the above-mentioned method embodiments, and the implementation principles and technical effects are similar, which will not be described here. Accordingly, the present disclosure provides a computer-readable storage medium, which stores computer execution instructions, and when the computer execution instructions are executed by the processor, the page table-based service processing method of the above-mentioned method embodiments is implemented. Accordingly, the present disclosure can also provide a computer program product, which includes a computer program, and when the computer program is executed by the processor, the page table-based service processing method shown in the above-mentioned method embodiments can be implemented. Those skilled in the art should understand that the embodiments of the present disclosure can be provided as a method, a system, or a computer program product. Therefore, the present disclosure can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present disclosure can be in the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer usable program code. The present disclosure is described with reference to flowcharts and / or block diagrams of methods, apparatuses, and computer program products according to embodiments of the present disclosure. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce means for implementing the functions specified in one or more flows in the flowcharts and / or one or more blocks in the block diagrams. These computer program instructions can also be stored in a computer-readable memory that can cause the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including instruction means, which implements the functions specified in one or more flows in the flowcharts and / or one or more blocks in the block diagrams.These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart and / or block diagram block or blocks. In one typical configuration, the electronic device includes one or more processors, input / output interfaces, network interfaces, and memory. The memory, which can include both volatile and non-volatile memory, can be implemented using a computer-readable medium. Computer-readable media include both volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer-readable media include, but are not limited to, phase change memory (PRAM), SRAM, dynamic random access memory (DRAM), other types of RAM, read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disks (DVDs) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information for access by a computing device. In accordance with the teachings herein, a computer-readable medium does not include a transitory medium. Also, the terms "data processing apparatus" and "computing device" encompass all apparatus, devices, and machines for processing data, including by way of example a programmable processor, a computer, or multiple processors or computers. The apparatus can include, in addition to processors or computers, other devices such as a member of the family of programmable consumer electronics, mobile devices, multimedia devices, video game consoles or boards, a handheld device, an embedded computer, a microprocessor, a system on a chip, a field programmable gate array, etc. The apparatus can also include, in addition to processors or computers, other devices such as a member of the family of programmable consumer electronics, mobile devices, multimedia devices, video game consoles or boards, a handheld device, an embedded computer, a microprocessor, a system on a chip, a field programmable gate array, etc. The apparatus can also include, in addition to processors or computers, other devices such as a member of the family of programmable consumer electronics, mobile devices, multimedia devices, video game consoles or boards, a handheld device, an embedded computer, a microprocessor, a system on a chip, a field programmable gate array, etc. The apparatus can also include, in addition to processors or computers, other devices such as a member of the family of programmable consumer electronics, mobile devices, multimedia devices, video game consoles or boards, a handheld device, an embedded computer, a microprocessor, a system on a chip, a field programmable gate array, etc. The apparatus can also include, in addition to processors or computers, other devices such as a member of the family of programmable consumer electronics, mobile devices, multimedia devices, video game consoles or boards, a handheld device, an embedded computer, a microprocessor, a system on a chip, a field programmable gate array, etc. The apparatus can also include, in addition to processors or computers, other devices such as a member of the family of programmable consumer electronics, mobile devices, multimedia devices, video game consoles or boards, a handheld device, an embedded computer, a microprocessor, a system on a chip, a field programmable gate array, etc. The apparatus can also include, in addition to processors or computers, other devices such as a member of the family of programmable consumer electronics, mobile devices, multimedia devices, video game consoles or boards, a handheld device, an embedded computer, a microprocessor, a system on a chip, a field programmable gate array, etc. The apparatus can also include, in addition to processors or computers, other devices such as a member of the family of programmable consumer electronics, mobile devices, multimedia devices, video game consoles or boards, a handheld device, an embedded computer, a microprocessor, a system on a chip, a field programmable gate array, etc. The apparatus can also include, in addition to processors or computers, other devices such as a member of the family of programmable consumer electronics, mobile devices, multimedia devices, video game consoles or boards, a handheld device, an embedded computer, a microprocessor, a system on a chip, a field programmable gate array, etc. The apparatus can also include, in addition to processors or computers, other devices such as a member of the family of programmable consumer electronics, mobile devices, multimedia devices, video game consoles or boards, a handheld device, an embedded computer, a microprocessor, a system on a chip, a field programmable gate array, etc. The apparatus can also include, in addition to processors or computers, other devices such as a member of the family of programmable consumer electronics, mobile devices, multimedia devices, video game consoles or boards, a handheld device, an embedded computer, a microprocessor, a system on a chip, a field programmable gate array, etc.

Claims

CLAIM 1. A method of processing a service based on a page table, wherein, The method comprises: obtaining a to-be-executed business code segment, a user mode context and a first page table of a to-be-processed business process; loading the to-be-executed business code segment and the user mode context by a proxy process, the proxy process being in a user mode; and executing the to-be-executed business code segment according to the first page table and the user mode context by the proxy process, to generate an execution result.

2. The method of claim 1, wherein, The executing the to-be-executed business code segment according to the first page table and the user mode context by the proxy process, to generate an execution result, comprises: copying a page table entry in the first page table to a second page table of the proxy process; calling the first page table according to a page table entry corresponding to the first page table in the second page table by the proxy process; executing the to-be-executed business code segment according to the first page table and the user mode context by the proxy process, to generate the execution result.

3. The method according to claim 1 or 2, wherein, The executing the to-be-executed business code segment according to the first page table and the user mode context by the proxy process, to generate the execution result, comprises: executing the to-be-executed business code segment according to the first page table and the user mode context by the proxy process; if an exception occurs in the execution process, caching and marking a current user mode context of the to-be-processed business process by the proxy process, the marking being used to indicate that the current user mode context exists an exception; loading the current user mode context by the to-be-processed business process; and continuing to execute the to-be-executed business code segment according to the first page table, the current user mode context and the marking by the to-be-processed business process, to generate the execution result.

4. The method according to claim 3, wherein, The exception comprises a software and hardware exception or an error occurring when accessing a kernel mode resource.

5. The method according to claim 4, wherein, When the marking indicates that the exception is an error occurring when accessing the kernel mode resource, the continuing to execute the to-be-executed business code segment according to the first page table, the current user mode context and the marking by the to-be-processed business process, to generate the execution result, comprises: rolling back an instruction pointer register of the current user mode context to a position before accessing the kernel mode resource by the to-be-processed business process, to obtain a processed user mode context; and re-accessing the kernel mode resource according to the first page table and the processed user mode context by the to-be-processed business process, to continue to execute the to-be-executed business code segment, to obtain the execution result.

6. The method according to any one of claims 1 to 5, wherein, The method further comprises: loading a user mode context of the proxy process by the proxy process.

7. The method according to any one of claims 3 to 5, wherein, When an exception occurs in the process that the agent process executes the to-be-executed business code segment, the agent process is switched from user mode to kernel mode, and after the current user mode context is loaded by the to-be-processed business process, the method further comprises: loading a user mode context of the agent process by the agent process; and controlling the agent process to switch from kernel mode to user mode.

8. The method according to claim 2, wherein, The second page table is a multi-level page table, and a top-level page table of the second page table is used to store page table entries of a business process. Correspondingly, the copying of the page table entries in the first page table to the second page table of the agent process comprises: copying the page table entries in the first page table to a top-level page table of the second page table.

9. The method according to claim 4, characterized by, When the flag indicates that the exception is the software and hardware exception, the method further comprises: continuing to execute the to-be-executed business code segment by the to-be-processed business process according to the first page table, the current user mode context and the flag, to generate the execution result; and controlling the to-be-processed business process to switch from kernel mode to user mode.

10. The method according to any one of claims 1 to 9, wherein, Before the to-be-executed business code segment, the user mode context and the first page table of the to-be-processed business process are acquired, the method further comprises: configuring a new business process by a compiling tool, a global kernel module, a process loader and a memory allocation module. 1 1. The method of claim 10, wherein, The configuring of the new business process by the compiling tool, the global kernel module, the process loader and the memory allocation module comprises: limiting business code in the new business process by the compiling tool to be accessed and jumped by using a relative offset; allocating a virtual address interval for the new business process by the global kernel module; wherein the virtual address interval allocated for the new business process does not overlap with a virtual address interval of an existing business process; starting the new business process according to the virtual address interval allocated for the new business process; configuring a memory mapping parameter of the new business process by the memory allocation module according to the virtual address interval allocated for the new business process; and mapping business code of the new business process to the virtual address interval of the new business process by the process loader according to the memory mapping parameter.

12. A page table based service processing apparatus, wherein, The device comprises: an acquisition module, configured to acquire a to-be-executed service code segment, a user state context and a first page table of a to-be-processed service process; a loading module, configured to load the to-be-executed service code segment and the user state context through an agent process, the agent process being in a user state; and an execution module, configured to execute the to-be-executed service code segment according to the first page table and the user state context through the agent process, and generate an execution result.

13. An electronic device, comprising: A processor, a memory, and computer-executed instructions stored on the memory and executable on the processor, wherein the processor, when executing the computer-executed instructions, is configured to implement the method according to any one of claims 1 to 11.

14. A computer-readable storage medium, wherein, The computer-readable storage medium stores computer-executed instructions, and the computer-executed instructions, when executed by a processor, are configured to implement the method according to any one of claims 1 to 11.

15. A computer program product comprising a computer program, wherein, The computer program, when executed by a processor, is configured to implement the method according to any one of claims 1 to 11. ​

Citation Information

Patent Citations

  • Method and system for deploying specified application based on host machine operating system

    CN114153557A

  • VEX - virtual extension framework

    CN1722092A

  • Method and apparatus for controlling a computer system

    US5537539A