System service calling method and computer device

By merging system service processes into the address space of the same user process and replacing IPC with function calls, the performance bottleneck in user-mode system service calls is solved, enabling fast and secure system service calls, improving performance and maintaining application flexibility.

WO2025227765A1PCT designated stage Publication Date: 2025-11-06HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/140242
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-04-28
Filing Date
2024-12-18
Publication Date
2025-11-06

AI Technical Summary

Technical Problem

In existing technologies, user-space system service calls suffer from performance bottlenecks due to inter-process communication (IPC). The slow speed of IPC becomes a bottleneck in the entire service process.

Method used

By merging different system service processes into the address space of the same user process and replacing IPC with function calls, the system services can run quickly and securely without modifying the source code of the system service processes.

Benefits of technology

By bypassing the IPC process, the performance of system service calls is improved, enabling fast and secure system service calls, and enhancing the flexibility and versatility of applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024140242_06112025_PF_FP_ABST
    Figure CN2024140242_06112025_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a system service calling method and a computer device, applicable to the technical field of computer user mode service calling. The method comprises: determining n system service processes on the basis of a user process; copying respective target information segments (such as code segments / data segments) of the n system service processes into n address spaces having preset ranges in the user process; and when the user process, which has merged the target information segments, calls a first process (the first process belongs to the n system service processes), performing service calling on the first process in a function calling manner in the user process. The present application merges different system service processes into the address space of the same process (i.e., the user process), thereby facilitating mutual calling; the IPC performance bottleneck problem during user service calling is solved, and the performance is improved without an IPC process; in addition, the present application does not need to perform code modification on an original system service process, and thus is conducive to wide use and has application universality.
Need to check novelty before this filing date? Find Prior Art

Description

A system service calling method and a computer device

[0001] The present application claims priority from the Chinese patent application No. 202410529113.4 filed on April 28, 2024, and entitled "A system service calling method and a computer device", the whole content of which is incorporated herein by reference. TECHNICAL FIELD

[0002] The present application relates to the technical field of computer user state service calling, in particular to a system service calling method and a computer device. BACKGROUND

[0003] In a computer system, the operating system kernel provides some services that need to be completed by the operating system for users. The users can request these services from the operating system by accessing the requirements provided by the operating system, and pass parameters and return values according to the regulations. This behavior is called system service calling, or simply system calling. Users can add, delete or modify the functions of the operating system kernel according to their own needs, so that the functions of the operating system are more in line with the needs of the users. This behavior is called kernel extension. Compared with the system services integrated into the operating system kernel, it is easier to develop and has better security.

[0004] In order to realize the user state system service calling, the industry generally adopts the following way: the user of the service (i.e. the user process) passes parameters and required data to the service program (i.e. the system service process) in a prescribed form through inter process communication (IPC), and the service program processes based on the parameters and data passed, and returns the results to the user of the service through IPC after the processing is completed.

[0005] The rate of the above service calling through IPC is limited by the performance of IPC, and the rate of IPC is often slow, which makes it a bottleneck of the whole service process. This is because process switching (i.e. between the user process and the system service process) is needed in the IPC process, and the process switching needs to handle a lot of complex and tedious things, so the time of the IPC process is difficult to be further reduced. SUMMARY

[0006] The application provides a system service calling method and a computer device, which are used for merging different system service processes into the address space of the same process (i.e., a user process) to facilitate mutual calling, solving the IPC performance bottleneck problem of user system service calling, and realizing performance improvement by bypassing the IPC process (because the execution time of the IPC calling is still longer than that of the function calling, and the time length of thousands of clock cycles is the bottleneck of the system service calling).

[0007] Based on this, the embodiments of the application provide the following technical solutions:

[0008] In the first aspect, the application first provides a system service calling method, which specifically includes the following steps: first, a computer device determines n system service processes to be merged according to a current user process (which can be referred to as a first user process), n≥1, the n system service processes can be determined by analyzing the code of the first user process by the user, or can be determined directly by the computer device according to the type of the first user process, and the application does not limit this. Then, the computer device further copies the target information segment of each of the n system service processes determined above into the address space of n preset ranges (i.e., a memory space between addresses a and b, such as a memory space with addresses of 1000-2000) in the first user process to obtain a second user process, and one system service process corresponds to one preset range of address space. It should be noted that the sizes of the n preset ranges of address space can be the same or different, and the application does not limit this. Finally, in the case of calling the first process in the second user process, the first process is called in the second user process by using the function calling mode, and the first process is one of the n system service processes.

[0009] In the above embodiments of the application, the functions originally implemented in the programmable kernel are placed in the user state (i.e., the user process), that is, different system service processes are merged into the address space of the same process, to realize the rapid and safe running of the system service. The application solves the IPC performance bottleneck problem of the user process system calling by converting the IPC calling into the function calling mode, and realizes the performance improvement by bypassing the IPC process. In addition, the application does not need to modify the source code of the system service process, and can realize the functions of the programmable kernel, which is more flexible and convenient in application.

[0010] In a possible implementation of the first aspect, after copying the target information segments of the n system service processes into the n preset range of address spaces in the first user process, the method further includes: recording the state information of the n system service processes in n pre-allocated management units (also referred to as management structures), one system service process corresponding to one management unit.

[0011] In the above embodiments of the present application, in addition to pre-allocating n preset range of address spaces for the n system service processes, n management units are also pre-allocated for the n system service processes, and each management unit records relevant information of each system service process when running, for subsequent function calling.

[0012] In a possible implementation of the first aspect, the state information can be at least one of the following: 1) the start address and / or end address of the target information segment of each system service process in the second user process (i.e., the specific location of the target information segment in the allocated preset range of address space); 2) the data size of the target information segment of each system service process (i.e., the size of the occupied memory of the target information segment in the allocated preset range of address space); 3) the function and / or function number corresponding to the target information segment of each system service process (e.g., how many functions, the function name, function number, etc.), one specific function corresponding to one function implementation; 4) the value of the register corresponding to each system service process.

[0013] In the above embodiments of the present application, it is specified that the state information can be which type of information, which is universal.

[0014] In a possible implementation of the first aspect, an implementation of the service calling to the first process in the second user process through function calling can be: in the second user process, according to the state information recorded in the first management unit, the service calling to the first process is implemented through function calling, wherein the first management unit is the management unit corresponding to the first process.

[0015] In the above embodiments of the present application, the address of the function to be called is obtained according to the state information recorded in the first management unit corresponding to the second user process, so as to realize the jump execution, and the fast and safe running of the system service is realized.

[0016] In a possible implementation manner of the first aspect, after the n system service processes are determined according to the first user process, the method further includes: performing address isolation processing (such as Software Fault Isolation, SFI) on the n system service processes, so that an address space in which each system service process runs is limited to a range of a specified size.

[0017] In the above-mentioned embodiments of the present application, the purpose of the address isolation processing is to ensure that the running logic of the code of the system service process only uses the address space in the range of the specified size, so that the running address space of the system service process is limited to the range of the specified size, and it is ensured that the target information segment will not have an address conflict with the code of other processes after being copied to the first user process, thereby avoiding process crashes.

[0018] In a possible implementation manner of the first aspect, after the n system service processes are determined according to the first user process, the method further includes: modifying the link library of each of the n system service processes, and converting an inter-process communication (IPC) call into a function call.

[0019] In the above-mentioned embodiments of the present application, by modifying the link library used by the system service process, the execution logic of the specified IPC in the process is converted into a function call, so that the IPC call in the system service call is converted into a function call without changing the source code of the process, and the merged process call logic is met.

[0020] In a possible implementation manner of the first aspect, after the n system service processes are determined according to the first user process, the method further includes: allocating a process number to each system service process in the second user process, and the process number is used to identify the corresponding system service process.

[0021] In the above-mentioned embodiments of the present application, the process number is used as the unique identity of the system service process in the second user process, and is used to accurately identify and call the corresponding system service process in subsequent operations, thereby improving the accuracy.

[0022] In a possible implementation manner of the first aspect, after the target information segment of each of the n system service processes is copied to the n preset range of address spaces in the first user process, the method further includes: in the case that a second process calls a third process, the service call to the third process can be completed by a forwarding function in the second user process, and the second process and the third process are any two of the n system service processes.

[0023] In the above-mentioned embodiments of the present application, the system service processes can also realize mutual calling of system services through the forwarding function, and have flexibility.

[0024] In a possible implementation of the first aspect, the target information segment of each system service process to be copied can be a target code segment (also referred to as a key code segment), a target data segment (also referred to as a key data segment), or a combination of the target code segment and the target data segment, and the present application does not limit the type of the target information segment.

[0025] In the above-mentioned embodiments of the present application, the type of the target information segment to be copied is specifically described, and the present application has wide applicability.

[0026] The second aspect of the present application provides a computer device having a function of implementing the method of the above-mentioned first aspect or any one of the possible implementation manners of the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned function.

[0027] The third aspect of the present application provides a computer device, which can include a memory, a processor, and a bus system, wherein the memory is used to store a computer program (also referred to as a program or computer readable instruction), and the processor is used to call the program stored in the memory to execute the method of the first aspect of the present application or any one of the possible implementation manners of the first aspect.

[0028] The fourth aspect of the present application provides a computer readable storage medium, which stores instructions, and when the instructions are run on a computer, the computer can execute the method of the above-mentioned first aspect or any one of the possible implementation manners of the first aspect.

[0029] The fifth aspect of the present application provides a computer program or a computer program product containing instructions, and when the computer program or the computer program product is run on a computer, the computer executes the method of the above-mentioned first aspect or any one of the possible implementation manners of the first aspect.

[0030] The sixth aspect of the present application provides a chip, comprising at least one processor and at least one interface circuit, the interface circuit and the processor being coupled, the at least one interface circuit being configured to perform a transceiving function and send instructions to the at least one processor, and the at least one processor being configured to run a computer program or instructions, which have a function of implementing the method of the first aspect or any possible implementation manner of the first aspect, the function being implemented by hardware, software or a combination of hardware and software, and the hardware or software comprising one or more modules corresponding to the above function. In addition, the interface circuit is configured to communicate with other modules outside the chip.

[0031] In some implementations of the present application, some of the one or more processors can be implemented by means of special hardware to implement some steps in the above method, for example, processing related to a neural network model can be implemented by a special neural network processor or a graphics processor.

[0032] The method provided by the embodiments of the present application can be implemented by one chip or by multiple chips in cooperation. BRIEF DESCRIPTION OF DRAWINGS

[0033] Fig. 1 is a schematic diagram of a system architecture provided by the embodiments of the present application;

[0034] Fig. 2 is a schematic diagram of an implementation form of a system service calling method in platform software and server hardware provided by the embodiments of the present application;

[0035] Fig. 3 is a schematic diagram of a flow of a system service calling method provided by the embodiments of the present application;

[0036] Fig. 4 is an example diagram of a component structure of a system service calling method provided by the embodiments of the present application;

[0037] Fig. 5 is an implementation flowchart of step (1) provided by the embodiments of the present application;

[0038] Fig. 6 is an implementation flowchart of step (2) provided by the embodiments of the present application;

[0039] Fig. 7 is an implementation flowchart of step (3) provided by the embodiments of the present application;

[0040] Fig. 8 is an implementation flowchart of step (4) provided by the embodiments of the present application;

[0041] Fig. 9 is an implementation flowchart of step (5) provided by the embodiments of the present application;

[0042] Fig. 10 is a schematic diagram of a computer device provided by the embodiments of the present application;

[0043] FIG. 11 is a structural schematic diagram of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION

[0044] The embodiment of the present application provides a system service calling method and a computer device, which are used for placing functions originally implemented in a programmable kernel in a user state (i.e., a user process), i.e., combining different system service processes into an address space of the same process, so as to realize fast and safe running of the system service. The embodiment of the present application solves the IPC performance bottleneck problem of the user process when making a system call by converting an IPC call into a function call, so as to realize performance improvement by bypassing the IPC process. In addition, the embodiment of the present application can realize the functions of the programmable kernel without modifying the source code of the system service process, and is more flexible and convenient in application.

[0045] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the terms used in this way can be interchanged under appropriate circumstances, which is only a distinguishing way adopted in the description of the embodiments of the present application for the objects with the same properties in the description. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, so that the processes, methods, systems, products or devices containing a series of units do not have to be limited to those units, but can include other units not clearly listed or inherent to the processes, methods, products or devices.

[0046] The embodiments of the present application are described below with reference to the drawings. Those skilled in the art can know that, with the development of technology and the appearance of new scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.

[0047] First, the system architecture to which the method of the embodiment of the present application is applied and the overall process are described, and details can be referred to FIG. 1, which is a schematic diagram of a system architecture according to an embodiment of the present application. The system architecture can include a user process (User Process) 101, a system service process (Server Process) 102, an operating system kernel (kernel) 103, an application program (Application, APP) 104, a file system (File System, FS) 105, a driver 106, etc. The user process 101 is a user process that combines target information segments (also referred to as key information segments) of the system service process 102. The system service process 102 can be one or multiple, which is not limited by the present application, and FIG. 1 is only a schematic diagram.

[0048] The functions of each unit / module in the system architecture shown in FIG. 1 are introduced as follows:

[0049] (1) User process 101

[0050] The user process 101 is a process in the user state, which is a user of the system service in the present application, and can also be called a caller. The user process 101 is a user process that merges the target information segment of the system service, and the user process 101 performs address isolation (i.e., system service process (SFIed) in FIG. 1) on the target information segment of the original system service process 102, which can be SFI, and then merges it into the user process 101 itself, to realize fast calling of the system service through function calling.

[0051] (2) System service process 102

[0052] The system service process 102 is a service program that provides a system service in the present application, and is an original system service process, which is a process that initially waits for a user process to call and provide a service function.

[0053] (3) Operating system kernel 103

[0054] The operating system kernel 103 provides basic IPC communication functions and the like for users.

[0055] (4) APP 104

[0056] The APP 104 is a third-party application program on the hardware device in the present application, and provides an Internet portal for users to meet their needs.

[0057] (5) FS 105

[0058] In a computer device, the FS is a method for managing and organizing data. It defines the naming, storage, and access methods of files and directories. The file system can operate on hard disks, flash memories, or other storage media, enabling users to create, read, modify, and delete files.

[0059] (6) Driver 106

[0060] The driver 106 is a small piece of code added to the operating system, which contains information about hardware devices. With this information, the computer device can communicate with other devices. The driver is a configuration file written by the hardware manufacturer according to the operating system, and without the driver, the hardware in the computer cannot work.

[0061] It should be noted that in the embodiments of the present application, the system architecture of FIG. 1 is only schematic, and the deployment manner of each unit is not limited.

[0062] The product implementation form of the present application is to combine multiple processes into one process, and keep the normal running of the process, and the original multiple processes can call each other, and the calling between the original multiple processes will be changed from IPC calling to function calling (func call).

[0063] Specifically, referring to FIG. 2, FIG. 2 is a schematic diagram of the implementation form of the calling method of the system service provided by the embodiment of the present application in the platform software and the server hardware, the product implementation can be divided into three steps of before combination, during combination and after combination, which will be introduced as follows:

[0064] In the combination preparation, the user process determines n (n≥1) system service processes needed in the running of the user process, and allocates corresponding management structure bodies (one target service process corresponds to one management structure body) for the target services to be pulled. At the same time, the target information segments (such as target code segments and target data segments) of the system service processes complete address protection through address isolation to prevent address conflict with the system service processes after mapping, and replace the link libraries of the system service processes and modify the implementation of IPC to convert the IPC flow into a function calling flow.

[0065] In the combination process, first, the address space information of the processes is read from the system service processes according to the system service process list determined before the combination, the positions of the target code segments, target data segments and other structures of the system service processes to be combined are determined, then the specified segments are read and copied from the system service processes to the address space pre-allocated in the user process according to the address information, and the information of each pulled service is recorded in the user process for subsequent calling. Then in the operating system kernel, the virtual address range of the process needs to be limited to specify the range of the start address and the end address to prevent address space conflict of the combined process, and for the stateful service processes, the state information is synchronized to the original system service processes by modifying the page fault handling flow in the operating system kernel.

[0066] After the combination is completed, the user process can determine the addresses of the functions and data structures of the system service processes according to the address data of the system service processes recorded in the combination and jump to call. The calling between two or more mapped system service processes provides a dedicated switch function in the user state to handle the jump, and the function receives the target process and the application programming interface (API) in the service calling to determine the address and jump to execute for the service process.

[0067] On the basis of the system architecture, the calling method of the system service provided by the embodiment of the application is introduced below. For details, refer to FIG. 3, which is a flowchart of the calling method of the system service provided by the embodiment of the application. Specifically, the method can include the following steps:

[0068] 301. Determine n system service processes according to the first user process, n≥1.

[0069] First, the computer device determines n system service processes to be merged according to the current user process (which can be referred to as the first user process).

[0070] It should be noted that this step is performed before the process merging. In this step, the first user process needs to determine which user-mode service processes frequently called in the critical processing function, that is, the n system service processes. The n system service processes can be determined by analyzing the code of the first user process or by directly determining the type of the first user process. The application does not limit this.

[0071] It should be noted that in some embodiments of the application, after the n system service processes are determined, the n system service processes need to be address isolated (such as SFI) to limit the address space in which each system service process runs to a specified size window. The address isolation process is also performed before the process merging. The purpose of the address isolation process is to ensure that the running logic of the code of the system service process will only use the address space within the specified size range, so that the running address space of the system service process is limited within the specified size range, ensuring that the target information segment in step 302 is not address conflicted with the code of other processes after being copied to the first user process, avoiding process crashes.

[0072] It should also be noted that in some embodiments of the application, the link libraries used by each system service process need to be modified to convert the specified IPC implementation into a function calling flow, so that the original IPC processing flow in the system service process is changed to a function calling flow.

[0073] 302. Copy the target information segment of each of the n system service processes to the n preset range address space in the first user process to obtain a second user process, and one system service process corresponds to one preset range address space.

[0074] Then, the computer device further copies the determined target information segments of the n system service processes into n preset range address spaces (i.e. a memory space between address a and address b, such as a memory space between address 1000 and 5000) in the first user process to obtain a second user process, one system service process corresponding to one preset range address space. Specifically, the address space information of the processes is read from the system service processes to determine the existing positions of the target information segments of the system service processes to be merged in the current service processes. Then, according to the read address space information, the specified information segments are read from the system service processes and copied into the pre-allocated address spaces in the first user process. The execution process of step 302 is the merging process of the above-mentioned embodiment corresponding to FIG. 2. The n preset range address spaces are pre-allocated by the computer device when the n system service processes are determined in step 301.

[0075] It should be noted that the sizes of the n preset range address spaces can be the same or different, which is not limited in the present application.

[0076] As an example, it is assumed that three system service processes (i.e. n = 3) are determined according to step 301, which are process A, process B and process C. Then, the computer device allocates three preset range address spaces for the three system service processes in the first user process, which are address space a (such as a memory space between address 1000 and 3000), address space b (such as a memory space between address 3001 and 6000) and address space c (such as a memory space between address 6001 and 9000). In this example, the sizes of the address spaces allocated for process A, process B and process C are the same. In actual applications, the sizes of the address spaces allocated can also be different, for example, address space a can be a memory space between address 1000 and 3000, address space b can be a memory space between address 3001 and 7000, and address space b can be a memory space between address 7001 and 8000. The specific allocation is determined by the actual application scenario, which is not limited in the present application.

[0077] It should be noted that in some embodiments of the present application, in addition to pre-allocating n preset range address spaces for the n system service processes, n management units (also referred to as management structures) can also be pre-allocated for the n system service processes, one system service process corresponding to one management unit. After the computer device copies the target information segments of the n system service processes into the n preset range address spaces in the first user process, the computer device can further record the state information of the n system service processes in the pre-allocated n management units, and record the relevant information of the system service processes at runtime in each management unit for subsequent function calls. These state information can be read out when the computer device performs address isolation on the system service processes, and then the read information is used to complete process merging, and the new address information of the target information segment of the merged system service process is recorded in this step.

[0078] Specifically, in the embodiments of the present application, the state information can be at least any one of the following: 1) the start address and / or end address of the target information segment corresponding to each system service process in the second user process (i.e. the specific location of the target information segment in the allocated preset range address space); 2) the data size of the target information segment corresponding to each system service process (i.e. the size of the memory occupied by the target information segment in the allocated preset range address space); 3) the function and / or function number corresponding to the target information segment corresponding to each system service process (such as how many functions, the function name, function number, etc.), a specific function corresponding to the implementation of one function; 4) the value of the register corresponding to each system service process.

[0079] It should be noted that in some embodiments of the present application, the copied target information segment of each system service process can be a target code segment (also referred to as a key code segment), or a target data segment (also referred to as a key data segment), or a target code segment and a target data segment, which is not limited in the present application. The target data segment is the data required by the target code segment at runtime. It should be noted here that the determination method of the target code segment / data segment can be that each system service process marks which code or data is the key code segment / data segment by itself, and integrates these key code segments / data segments together in advance, so as to facilitate direct copying when needed subsequently.

[0080] It is also necessary to point out that in some embodiments of the present application, the n system service processes can be identified based on the process number in the second user process, that is, each system service process is assigned a process number in advance in the second user process, which serves as the unique identity of the system service process in the second user process, for accurately identifying and calling the corresponding system service process in subsequent operations. It should be noted that the process number is only an example, and in actual application, an identity code (Identity, ID) such as a unique code, a special number, a unique character, etc. can be assigned as long as it can realize the function of uniquely identifying the corresponding system service process, which is not limited in the present application.

[0081] 303、In the case where the second user process calls the first process, the first process is called for service in the second user process by means of function call, the first process being one of the n system service processes.

[0082] Finally, the computer device completes subsequent system service calls to realize functions by means of function call according to the above information. This step is executed after the merging is completed. In the embodiments of the present application, the call can be divided into:

[0083] (1) User process calls system service process.

[0084] That is, the case where the second user process calls the first process, wherein the first process is one of the n system service processes. In this case, the first process is called for service in the second user process by means of function call. For example, the first process is called for service in the second user process by means of function call according to the state information recorded in the first management unit, which is the management unit corresponding to the first process. That is, in this step, the address of the function to be called is obtained according to the state information recorded in the second user process management unit, so as to realize jump execution.

[0085] (2) System service process calls system service process.

[0086] That is, in the case where the second process calls the third process, the service call to the third process can be completed by means of the forwarding function in the second user process, wherein the second process and the third process are any two of the n system service processes.

[0087] Since each system service process is in an address isolation state at this time, the mutual call between the two merged system service processes is completed by means of the forwarding function in the second user process, which receives the process number and parameters of the target process called by the system service process, and helps the system service process to complete address jump and pass back the function return value by accessing the state information recorded in the management unit.

[0088] To facilitate the understanding of the above process, the following is an example of a specific example, as shown in Figure 3, the embodiment of the above corresponding to the method of calling a system service provided by the embodiment of the application, one component structure example of Figure 4, the example is a case of converting the md5 calculation of the system service process (hereinafter referred to as the target process) from IPC call to function call. The role of the md5 service process is to receive a piece of data content, calculate the md5 value of the piece of data and return the result to the caller. The embodiment of the application converts the calling mode of the service process from the original IPC call to the function call after merging into the same process. The specific implementation steps are as follows:

[0089] (I) determine the process number of the target process, and read the address space information of the target process.

[0090] Please refer to Figure 5, Figure 5 is the implementation flowchart of step (I), which can include the following steps:

[0091] 501, determine the process number of the md5 service process.

[0092] This step first determines the process number of the md5 service process.

[0093] 502, read the address distribution information of the md5 service process.

[0094] Then, read the address distribution (i.e. the location of the target code segment / data segment) of the md5 service process as the operation information for the next step.

[0095] 503, allocate a management unit for the md5 service process.

[0096] At the same time, allocate a corresponding management unit (i.e. management structure) for the md5 service process to be pulled through the user process.

[0097] (II) address isolation processing of the code of the md5 service process in the compilation stage, and modifying its link library to change the implementation of specific IPC.

[0098] Please refer to Figure 6, Figure 6 is the implementation flowchart of step (II), which can include the following steps:

[0099] 601, address isolation of the md5 service process.

[0100] First, address isolation of the md5 service process, such as SFI.

[0101] 602, record the new address distribution information at the location of the address distribution information.

[0102] After the code segment of md5 is isolated in address, the new address distribution information of the target code segment / data segment to be copied is recorded at the position of recording the address distribution information.

[0103] 603、md5 service process enters hibernation to wait for merging.

[0104] md5 service process enters hibernation to wait for subsequent merging.

[0105] This step (two) is used to ensure the safety of the process after merging. After the md5 service process is isolated in address, the memory range used by the md5 code segment during runtime can be limited to a fixed address interval. In subsequent merging, the md5 service process will be copied to a pre-allocated address space of the user process to run, so that the running of the md5 service process and the original user process do not interfere with each other in address, to ensure the normal running of the process. At the same time, the link library used by the md5 service process is modified to convert the implementation of the specified IPC into a function call process, so that the original IPC processing process in the md5 service process is changed to the required function call process.

[0106] (three) sequentially copy each code segment / data segment in the md5 service process to the pre-allocated memory space of the user process.

[0107] For details, please refer to FIG. 7, which is an implementation flowchart of step (three), which can include the following steps (i.e. for each address space, the following operations are performed in sequence):

[0108] 701、allocate address space in user mode.

[0109] First, pre-allocate address space for the code segment / data segment to be copied in user mode.

[0110] 702、configure the permissions of the newly allocated address space.

[0111] and configure the corresponding permissions for the pre-allocated address space.

[0112] 703、read the data of the specified segment of the md5 service process.

[0113] Then, read the data of the specified address space (i.e. the specified segment) of the md5 service process.

[0114] 704、copy the data to the pre-allocated address space of the user process.

[0115] Finally, the read data of the specified address space is copied into the address space pre-allocated by the user, and the address allocation range of the subsequent process is limited in the system operation kernel, the starting size of the virtual address is specified, and address conflict is prevented when the service process applies for memory allocation in subsequent execution.

[0116] (iv) Record the address segment information of all merged service processes for subsequent calling.

[0117] For details, please refer to Figure 8, which is an implementation flowchart of step (iv), which can include the following steps:

[0118] 801, Record the address segment information.

[0119] Record all memory segment address information in a series of tables (i.e. management units), and the recorded content can include function address information in the original service process function segment and data segment, global variable address information, etc.

[0120] 802, The service calling obtains the target address by looking up the table and realizes the jump.

[0121] After that, the subsequent service calling and the calling between system services obtain the target address by looking up the table and perform the jump execution.

[0122] (v) Implement the corresponding lookup table and jump function in the user process to provide the implementation of service calling and inter-service calling.

[0123] For details, please refer to Figure 9, which is an implementation flowchart of step (v), which can include the following steps:

[0124] 901, Implement the service jump function.

[0125] This step implements a special service jump function.

[0126] 902, When the service calling is performed, the jump function address is pushed to the bottom of the stack for service calling.

[0127] The address of the jump function is pushed to the bottom of the stack before the user process performs service calling, and the inter-service calling is implemented through the processing function at the bottom of the stack during service execution.

[0128] 903, The jump function completes the receiving parameter and lookup table jump operation to realize the service calling.

[0129] The processing function finds the address of the target function according to the process number and the calling function number of the target process, and passes the received parameters to the target function to realize the service calling.

[0130] Based on the above embodiments, in order to better implement the above scheme of the embodiments of the present application, the following further provides a related device for implementing the above scheme. Referring to FIG. 10, FIG. 10 is a schematic diagram of a computer device provided by an embodiment of the present application. The computer device 1000 can specifically include a determination module 1001, a merging module 1002, and a service calling module 1003. The determination module 1001 is configured to determine n system service processes according to a first user process, where n≥1. The merging module 1002 is configured to copy target information segments of the n system service processes to n preset range address spaces in the first user process respectively to obtain a second user process, and one system service process corresponds to one preset range address space. The service calling module 1003 is configured to, in the case that the second user process calls a first process, perform service calling on the first process in the second user process by means of function calling, and the first process is one of the n system service processes.

[0131] In a possible design, the merging module 1002 is further configured to, after copying the target information segments of the n system service processes to the n preset range address spaces in the first user process respectively, record state information of the n system service processes in n pre-allocated management units, and one system service process corresponds to one management unit.

[0132] In a possible design, the state information at least includes any one of the following:

[0133] a start address and / or an end address of the target information segment corresponding to each of the system service processes in the second user process;

[0134] a data size of the target information segment corresponding to each of the system service processes;

[0135] a function and / or a function number corresponding to the target information segment corresponding to each of the system service processes;

[0136] a value of a register corresponding to each of the system service processes.

[0137] In a possible design, the service calling module 1003 is specifically configured to, in the second user process, perform service calling on the first process by means of function calling according to the state information recorded in a first management unit, and the first management unit is a management unit corresponding to the first process.

[0138] In a possible design, the determination module 1001 is further configured to, after determining the n system service processes according to the first user process, perform address isolation processing on the n system service processes, so that an address space in which each of the system service processes runs is limited in a specified size range.

[0139] In a possible design, the determining module 1001 is further configured to: after determining the n system service processes according to the first user process, update a link library of the n system service processes, and convert an inter-process communication (IPC) call into a function call.

[0140] In a possible design, the determining module 1001 is further configured to: after determining the n system service processes according to the first user process, allocate a process number to each of the system service processes in the second user process, where the process number is used to identify the corresponding system service process.

[0141] In a possible design, the service calling module 1003 is further configured to: in the case that a second process calls a third process, complete the service calling to the third process through a forwarding function in the second user process, where the second process and the third process are any two of the n system service processes.

[0142] In a possible design, the target information segment includes: a target code segment, and / or a target data segment, where the target data segment is data required by the target code segment at runtime.

[0143] It should be noted that the information interaction and execution process between the modules / units in the computer device 1000 are based on the same design, and details can be referred to the description of the method embodiments in the foregoing method embodiments of the present application, which will not be repeated here.

[0144] Next, another computer device provided by the embodiments of the present application is introduced. Please refer to FIG. 11, which is a structural schematic diagram of a computer device provided by the embodiments of the present application. The computer device 1100 can be deployed with the modules of the computer device 1000 described in the corresponding embodiment of FIG. 10, to realize the functions of the computer device 1000 in the corresponding embodiment of FIG. 10. Specifically, the computer device 1100 is implemented by one or more servers. The computer device 1100 can be quite different due to different configurations or performances, and can include one or more central processing units (CPU) 1122 and a memory 1132, one or more storage media 1130 (for example, one or more mass storage devices) for storing application programs 1142 or data 1144. The memory 1132 and the storage media 1130 can be temporary storage or persistent storage. The programs stored in the storage media 1130 can include one or more modules (not shown in the figure), and each module can include a series of instruction operations in the computer device 1100. Further, the central processing unit 1122 can be configured to communicate with the storage media 1130 and execute a series of instruction operations in the storage media 1130 on the computer device 1100.

[0145] The computer device 1100 can also include one or more power supplies 1126, one or more wired or wireless network interfaces 1150, one or more input and output interfaces 1158, and / or one or more operating systems 1141, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0146] In the embodiments of the present application, the central processing unit 1122 is configured to execute the steps performed by the computer device in the corresponding embodiments of FIG. 5 or FIG. 6. For example, the central processing unit 1122 can be configured to: determine n system service processes according to a user process, copy target information segments (such as code segments / data segments) of the n system service processes to n preset range address spaces in the user process, and perform service calling on a first process (the first process belongs to the n system service processes) in the user process by means of function calling when the user process calling the first process is combined with the target information segments.

[0147] It should be noted that the central processing unit 1122 performs the above steps in a specific manner, which is based on the same concept as the above method embodiments of the present application, and brings the same technical effects as the above embodiments of the present application. For details, please refer to the description of the method embodiments in the foregoing method embodiments of the present application, which will not be repeated here.

[0148] It should be noted that the apparatus embodiments described above are merely illustrative, and the units described as separate units can or can not be physically separate, and the units displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment. In addition, the connection relationship between the modules in the apparatus embodiment provided in the present application indicates that there is a communication connection between them, which can be implemented as one or more communication buses or signal lines.

[0149] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be realized by means of software and the necessary general hardware, and of course can also be realized by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. Generally, functions completed by computer programs can be easily realized by corresponding hardware, and the specific hardware structure for realizing the same function can also be various, such as analog circuit, digital circuit or special circuit, etc. However, for the present application, software program implementation is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of software products, which are stored in readable storage media, such as computer floppy disks, U disks, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic or optical disks, etc., including a plurality of instructions for making a computer device (which can be a personal computer, a training device, or a network device, etc.) execute the methods described in various embodiments of the present application.

[0150] In the above embodiments, all or part can be realized by software, hardware, firmware or any combination thereof. When realized by software, it can be realized in the form of a computer program product in whole or in part.

[0151] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from one website, computer, training device or data center to another website, computer, training device or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be stored by the computer or a data storage device such as a training device, a data center, etc. integrated with one or more available media sets. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)), etc.

Claims

1. A method of invoking a system service, characterized by, The method comprises the following steps: determining n system service processes according to a first user process, n≥1; copying target information segments of the n system service processes respectively to n preset range address spaces in the first user process to obtain a second user process, one system service process corresponding to one preset range address space; in the case that the second user process calls a first process, performing service call on the first process in the second user process by means of function call, the first process being one of the n system service processes.

2. The method of claim 1, wherein, After the step of copying the target information segments of the n system service processes respectively to the n preset range address spaces in the first user process, the method further comprises: recording state information of the n system service processes in n pre-allocated management units, one system service process corresponding to one management unit.

3. The method of claim 2, wherein, The state information at least comprises any one of the following: a start address and / or an end address of the target information segment corresponding to each of the system service processes in the second user process; a data size of the target information segment corresponding to each of the system service processes; a function and / or a function number corresponding to the target information segment corresponding to each of the system service processes; a value of a register corresponding to each of the system service processes.

4. The method according to any one of claims 2-3, characterized in that, The step of performing service call on the first process in the second user process by means of function call comprises: in the second user process, performing service call on the first process by means of function call according to the state information recorded in a first management unit, the first management unit being the management unit corresponding to the first process.

5. The method according to any one of claims 1-4, characterized in that, After the step of determining the n system service processes according to the first user process, the method further comprises: performing address isolation processing on the n system service processes so that the address space in which each of the system service processes runs is limited within a specified size range.

6. The method according to any one of claims 1-5, characterized in that, After the step of determining the n system service processes according to the first user process, the method further comprises: updating the link library of the n system service processes to convert inter-process communication (IPC) call into function call.

7. The method according to any one of claims 1 to 6, characterized in that, After the step of determining the n system service processes according to the first user process, the method further comprises: allocating a process number to each of the system service processes in the second user process, the process number being used to identify the corresponding system service process.

8. The method according to any one of claims 1-7, characterized in that, After the step of copying the target information segments of the n system service processes respectively to the n preset range address spaces in the first user process, the method further comprises: in the case that a second process calls a third process, performing service call on the third process by means of a forwarding function in the second user process, the second process and the third process being any two of the n system service processes.

9. The method according to any one of claims 1-8, characterized in that, The target information segment comprises: a target code segment, and / or a target data segment, the target data segment being data required by the target code segment during runtime.

10. A computer device, comprising: The method comprises the following steps: determining n system service processes according to a first user process, n≥1; The merging module is configured to copy the target information segments of the n system service processes into n preset address spaces in the first user process, to obtain a second user process, and one system service process corresponds to one preset address space. The service calling module is configured to, in the case that the second user process calls a first process, perform service calling on the first process in the second user process by means of function calling, and the first process is one of the n system service processes.

11. The apparatus of claim 10, wherein, The merging module is further configured to: After the copying of the target information segments of the n system service processes into the n preset address spaces in the first user process, record state information of the n system service processes in n pre-allocated management units, and one system service process corresponds to one management unit.

12. The apparatus of claim 11, wherein, The state information at least includes any one of: a start address and / or an end address of the target information segment corresponding to each system service process in the second user process; a data size of the target information segment corresponding to each system service process; a function and / or a function number corresponding to the target information segment corresponding to each system service process; a value of a register corresponding to each system service process.

13. The apparatus of any one of claims 11-12, wherein, The service calling module is specifically configured to: In the second user process, perform service calling on the first process by means of function calling according to the state information recorded in a first management unit, and the first management unit is the management unit corresponding to the first process.

14. The apparatus of any one of claims 10-13, wherein, The determining module is further configured to: After the determination of the n system service processes according to the first user process, perform address isolation processing on the n system service processes, so that the address space in which each system service process runs is limited within a specified size range.

15. The apparatus of any one of claims 10-14, wherein, The determining module is further configured to: After the determination of the n system service processes according to the first user process, update the link libraries of the n system service processes, and convert inter-process communication (IPC) calling into function calling.

16. The apparatus of any one of claims 10-15, wherein, The determining module is further configured to: After the determination of the n system service processes according to the first user process, allocate a process number to each system service process in the second user process, and the process number is used to identify the corresponding system service process.

17. The apparatus of any one of claims 10-16, wherein, The service calling module is further configured to: In the case that a second process calls a third process, perform service calling on the third process by means of a forwarding function in the second user process, and the second process and the third process are any two of the n system service processes.

18. The apparatus of any one of claims 10-17, wherein, The target information segment includes: a target code segment, and / or a target data segment, and the target data segment is data required by the target code segment at runtime. 19.A computer device, comprising a processor and a memory, wherein the processor is coupled to the memory, and the computer device is configured to perform the method in any one of claims 1-9. The memory is configured to store a program. The processor is configured to execute the program in the memory, so that the computer device performs the method in any one of claims 1-9.

20. A computer storage medium, comprising, A computer program product comprising computer readable instructions to implement the method of any of claims 1-9 when executed by a processor.

21. A computer program product, characterised in that, A computer program product comprising computer readable instructions to implement the method of any of claims 1-9 when executed by a processor.

22. A chip comprising a processor and a data interface, characterized in that A processor to read instructions stored on a memory via a data interface to implement the method of any of claims 1-9.

Citation Information

Patent Citations

  • Method for accelerating inter-process communication of microkernel by utilizing multi-hardware characteristics

    CN113064697A

  • Inter-process communication method and device, Internet of Things operating system and Internet of Things equipment

    CN114356591A

  • Inter-process function calling method and related equipment

    CN116048827A

  • Inter-Manycore Communications Method and System

    US20160041923A1

  • Providing system services

    US20230367869A1