CN120849149A - A system service calling method and computer device - Google Patents

A system service calling method and computer device

Info

Publication number
CN120849149A
CN120849149A CN202410529113.4A CN202410529113A CN120849149A CN 120849149 A CN120849149 A CN 120849149A CN 202410529113 A CN202410529113 A CN 202410529113A CN 120849149 A CN120849149 A CN 120849149A
Authority
CN
China
Prior art keywords
system service
user
processes
user process
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410529113.4A
Other languages
Chinese (zh)
Inventor
邵子卿
周喆
吴宇明
代杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202410529113.4A priority Critical patent/CN120849149A/en
Priority to PCT/CN2024/140242 priority patent/WO2025227765A1/en
Publication of CN120849149A publication Critical patent/CN120849149A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a system service calling method and computer equipment, which can be applied to the technical field of computer user-state service calling, and comprises the following steps: determining n system service processes according to the user process, copying respective target information segments (such as code segments/data segments) of the n system service processes to n address spaces of preset ranges in the user process, and calling a first process (the first process belongs to the n system service processes) in the user process in a function calling mode when the user process combining the target information segments calls the first process. The application combines different system service processes into the address space of the same process (namely user process), thereby facilitating the mutual call, solving the IPC performance bottleneck problem when the user service is called, realizing the improvement of performance by bypassing the IPC flow, and in addition, the application does not need to modify the code of the original system service process, thereby being convenient and widely used and having the universality of application.

Description

Calling method of system service and computer equipment
Technical Field
The present application relates to the field of computer user mode service calling technology, and in particular, to a system service calling method and a computer device.
Background
In a computer system, an operating system kernel provides a user with services which need to be completed in the operating system, and the user can request the services from the operating system through access requirements provided by the operating system and transfer parameters and introduction return values according to regulations, wherein the behavior is a system service call or simply called a system call. The user can add, delete or modify the functions of the kernel of the operating system according to the own needs, so that the functions of the operating system are more in line with the needs of the user, and the behavior is kernel expansion, and compared with the system service integrated into the kernel of the operating system, the system service is easier to develop and has better safety.
In order to implement user-mode system service invocation, a general method adopted in the industry is that a user (i.e., user process) of a service transmits parameters and required data to a service program (i.e., system service process) in a specified form through inter-process communication (Inter Process Communication, IPC), the service program processes the data based on the transmitted parameters and data after being awakened, and returns a result to the user of the service through IPC after the processing is completed.
The rate of service call through the IPC is limited by the performance of the IPC, and the rate of the IPC is often slow, so that the rate becomes a bottleneck of the whole service flow, because the process (i.e. between the user process and the system service process) needs to be switched in the IPC process, the process switching needs to be processed more complicated and complicated, and the time of the IPC flow is difficult to be further reduced.
Disclosure of Invention
The application provides a calling method of system service and computer equipment, which are used for solving the problem of IPC performance bottleneck when a user calls the system service by combining different system service processes into an address space of the same process (namely a user process), and improving the performance by bypassing the flow of the IPC (because the execution time of the IPC call is longer than that of the function call and the duration of thousands of clock cycles is the bottleneck of the system service call). In addition, the application does not need to modify codes of the original system service process, thereby being convenient for wide use and having application universality.
Based on the above, the embodiment of the application provides the following technical scheme:
In a first aspect, the present application provides a method for invoking system services, where the method specifically includes that first, a computer device determines n system service processes to be merged according to a current user process (which may be referred to as a first user process), where n is greater than or equal to 1, where the n system service processes may be determined by a user analyzing a code of the first user process, or may be determined directly by the computer device according to a type of the first user process, which is not limited in the present application. And the computer equipment further copies the determined target information segments of the n system service processes to n address spaces (namely a section of memory space between the addresses a and b, such as a memory space with the addresses of 1000-2000) in the first user process, so as to obtain a second user process, wherein one system service process corresponds to one address space in the preset range. It should be noted that the size of the address spaces of the n preset ranges may be the same or different, which is not limited by the present application. And finally, under the condition that the second user process calls the first process, carrying out service call on the first process in the second user process in a function call mode, wherein the first process is one of n system service processes.
In the above embodiment of the present application, the functions that are originally needed to be implemented in the programmable kernel are placed in the user mode (i.e., user process), that is, different system service processes are combined into the address space of the same process, so as to implement the fast and safe running of the system service. The application solves the problem of IPC performance bottleneck when the user process makes system call by converting the IPC call into the function call, and realizes the improvement of the performance by bypassing the flow of the IPC. In addition, the application can realize the function of the programmable kernel without modifying the source code of the system service process, and is more flexible and convenient in application.
In a possible implementation manner of the first aspect, after copying the target information segments of each of the n system service processes into n address spaces of preset ranges in the first user process, the method may further include recording the state information of each of the n system service processes in preassigned n management units (which may also be referred to as a management structure body), where one system service process corresponds to one management unit.
In the above embodiment of the present application, in addition to pre-allocating n address spaces in a preset range for the n system service processes, n management units may be pre-allocated for the n system service processes, where relevant information during operation of each system service process is recorded in each management unit for use in a subsequent function call.
In one possible implementation manner of the first aspect, the state information may be at least any one of 1) a start address and/or an end address of the target information segment corresponding to each system service process in the second user process (i.e., a specific position of the target information segment in the address space of the respective allocated preset range), 2) a data size of the target information segment corresponding to each system service process (i.e., a size of the occupied memory of the target information segment in the address space of the respective allocated preset range), 3) a function and/or a function number (e.g., how many functions correspond to each function name, function number, etc.) corresponding to the target information segment corresponding to each system service process, one specific function corresponds to implementation of one function, and 4) a value of a register corresponding to each system service process.
In the above embodiment of the present application, it is specifically described which types of information the status information may be, and the status information is generic.
In one possible implementation manner of the first aspect, the service call is performed on the first process by a function call manner in the second user process, where the first management unit is a management unit corresponding to the first process, in the second user process, according to the state information recorded in the first management unit.
In the embodiment of the 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 that jump execution is realized, and quick and safe operation of the system service is realized.
In a possible implementation manner of the first aspect, after determining n system service processes according to the first user process, the method may further include performing address isolation processing (such as software error isolation (Software Fault Isolation, SFI)) on the n system service processes, so that an address space in which each system service process operates is limited to a range of a specified size.
In the above embodiment of the present application, the purpose of address isolation processing is to ensure that the running logic of the code of the system service process only uses 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, and it is ensured that the target information segment is copied to the first user process and does not collide with the code of other processes, thereby avoiding process crash.
In a possible implementation manner of the first aspect, after determining the n system service processes according to the first user process, the method may further include modifying a link library of each of the n system service processes to convert an inter-process communication IPC call into a function call.
In the above embodiment of the present application, by modifying the link library used by the system service process, the execution logic of the IPC specified in the process is converted into the function call, so that the IPC call in the system service call is changed into the function call without changing the source code of the process, and the merged process call logic is satisfied.
In a possible implementation manner of the first aspect, after determining n system service processes according to the first user process, the method may further include assigning a process number to each system service process in the second user process, where the process number is used to identify the corresponding system service process.
In the above embodiment of the present application, the process number is used as a unique identity of the system service process in the second user process, and is used for accurately identifying and calling the corresponding system service process in the subsequent operation, thereby improving accuracy.
In a possible implementation manner of the first aspect, after copying the target information segments of each of the n system service processes to n address spaces of preset ranges in the first user process, the method may further include, in a case that the second process calls the third process, completing service call of the third process through a forwarding function in the second user process, where the second process and the third process are any two processes in the n system service processes.
In the above embodiment of the present application, the system service processes can also realize the inter-call of the system service through the forwarding function, so that flexibility is provided.
In a possible implementation manner of the first aspect, the target information segment of each copied system service process may be a target code segment (may also be called a key code segment), a target data segment (may also be called a key data segment), and a target code segment and a target data segment, where the target data segment is data required by the target code segment in running, and the application is not limited in this respect.
In the above embodiment of the present application, the type of the copied target information piece is specifically described, and the present application has wide applicability.
A second aspect of the application provides a computer device having functionality to implement the method of the first aspect or any one of the possible implementations of the first aspect. The functions can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the functions described above.
A third aspect of the present application provides a computer device, which may comprise a memory for storing a computer program (also referred to as a program, computer readable instructions), a processor for invoking the program stored in the memory to perform the method of the first aspect or any one of the possible implementations of the first aspect of the embodiments of the application, and a bus system.
A fourth aspect of the application provides a computer readable storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the method of the first aspect or any one of the possible implementations of the first aspect.
A fifth aspect of the application provides a computer program or a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of the first aspect or any one of the possible implementations of the first aspect.
A sixth aspect of the application provides a chip comprising at least one processor and at least one interface circuit coupled to the processor, the at least one interface circuit for performing a transceiving function and for transmitting instructions to the at least one processor, the at least one processor for running a computer program or instruction having functionality to implement a method as described in the first aspect or any one of the possible implementations of the first aspect, the functionality being implemented in hardware or in software, and the hardware or software comprising one or more modules corresponding to the functionality described above. In addition, the interface circuit is used for communicating with other modules outside the chip.
In some implementations of the application, some of the one or more processors may also implement, in part, the steps of the above method by way of dedicated hardware, e.g., processing involving a neural network model may be implemented by a dedicated neural network processor or a graphics processor.
The method provided by the embodiment of the application can be realized by one chip or can be realized by cooperation of a plurality of chips.
Drawings
FIG. 1 is a schematic diagram of a system architecture according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a method for calling a system service according to an embodiment of the present application implemented in platform software and server hardware;
FIG. 3 is a flowchart of a method for calling a system service according to an embodiment of the present application;
FIG. 4 is a diagram illustrating an example of a component structure of a system service invocation method according to an embodiment of the present application;
FIG. 5 is a flowchart illustrating the implementation of step (I) according to an embodiment of the present application;
FIG. 6 is a flowchart illustrating the implementation of step (II) according to an embodiment of the present application;
FIG. 7 is a flowchart illustrating the implementation of step (III) according to an embodiment of the present application;
FIG. 8 is a flowchart illustrating the implementation of step (IV) according to an embodiment of the present application;
FIG. 9 is a flowchart of the implementation of step (fifth) according to an embodiment of the present application;
FIG. 10 is a schematic diagram of a computer device according to an embodiment of the present application;
Fig. 11 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a calling method of system service and computer equipment, which are used for placing functions which are originally needed to be realized in a programmable kernel in a user mode (namely a user process), namely combining different system service processes into an address space of the same process, so as to realize the rapid and safe operation of the system service. The application solves the problem of IPC performance bottleneck when the user process makes system call by converting the IPC call into the function call, and realizes the improvement of the performance by bypassing the flow of the IPC. In addition, the application can realize the function of the programmable kernel without modifying the source code of the system service process, and is more flexible and convenient in application.
The terms first, second and the like in the description and in the claims and in the above-described figures, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances and are merely illustrative of the manner in which embodiments of the application have been described in connection with the description of the objects having the same attributes. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of elements is not necessarily limited to those elements, but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
Embodiments of the present application are described below with reference to the accompanying drawings. As one of ordinary skill in the art can know, with the development of technology and the appearance of new scenes, the technical scheme provided by the embodiment of the application is also applicable to similar technical problems.
First, referring to fig. 1, fig. 1 is a schematic diagram of a system architecture provided by an embodiment of the present application, where the system architecture may include a User Process (User Process) 101, a system service Process (Server Process) 102, an operating system kernel (kernel) 103, an Application (APP) 104, a file system (FILE SYSTEM, FS) 105, a driver 106, and so on. The user process 101 is a user process that incorporates a target information segment (may also be referred to as a key information segment) of the system service process 102, and the system service process 102 may be one or more, which is not limited in this regard and is illustrated in fig. 1.
The following describes the functions of the units/modules in the system architecture shown in fig. 1, specifically as follows:
(1) User process 101
User process 101 is a process in a user state, and in the present application, a user who serves the system may also be referred to as a caller. The user process 101 is a user process that incorporates the target information segment of the system service, and the user process 101 performs address isolation (i.e., the system service process (SFIed) in fig. 1) on the target information segment of the original system service process 102, where the address isolation may be SFI, and then incorporates the SFI into the user process 101 itself, so as to implement quick call of the system service through function call.
(2) System service process 102
The system service process 102 is a service program for providing a system service in the present application, and the system service process 102 is an original system service process and is a process for initially waiting for a user process to call and providing a service function.
(3) Operating system kernel 103
The operating system kernel 103 provides the user with basic IPC communication functions and the like.
(4)APP 104
APP 104 is a third party application program on the hardware device of the application, provides Internet access for users, and meets the requirements of users.
(5)FS105
In a computer device, FS is a method for managing and organizing data. It defines the naming, storage and access of files and directories. The file system may operate on a hard disk, flash memory, or other storage medium, enabling users to create, read, modify, and delete files.
(6) Drive 106
Driver 106 is a small piece of code added to the operating system that contains information about the hardware device. With this information, the computer device can communicate with other devices. The driver is a configuration file written by a hardware manufacturer according to an operating system, and the hardware in the computer cannot work without the driver.
It should be noted that, in the embodiment of the present application, the system architecture of fig. 1 is merely schematic, and the deployment manner of each unit is not limited.
The product implementation form of the application is to merge a plurality of processes into the same process, keep the processes to run normally, and the original plurality of processes can be mutually called, and the calling among the original plurality of processes is converted from IPC calling to function calling (func call).
Specifically, referring to fig. 2, fig. 2 is a schematic diagram of an implementation form of a method for calling a system service in platform software and server hardware according to an embodiment of the present application, where the implementation of the product may be divided into three implementations before, during and after merging, and the following are respectively described:
In the merging preparation, the user process determines n (n is greater than or equal to 1) system service processes required in the running process of the user process, and allocates corresponding management structures for the target service to be pulled (one target service process corresponds to one management structure). Meanwhile, the target information segments (such as target code segments and target data segments) of the system service process complete address protection in an address isolation mode, address conflict between the target information segments and the system service process after mapping is prevented, a link library of each system service process is replaced, the implementation of IPC is modified, and the IPC flow is converted into a function call flow.
In the merging process, firstly, address space information of a process is read from each system service process according to a system service process list determined before merging, positions of structures such as a target code segment, a target data segment and the like of the system service process to be merged are determined, then designated segments are read and copied in the system service process according to the address information in sequence into an address space pre-allocated by a user process, and information of each pulled service is recorded in the user process for subsequent calling. Then in the kernel of the operating system, the virtual address range of the process needs to be limited, the range of the starting address and the ending address is regulated, the conflict of the address space of the combined process is prevented, and for the service process with state, the state information is synchronized to the service process of the original system by modifying the page fault processing flow in the kernel of the operating system.
After the merging is completed, the user process can determine the addresses of the functions, the data and other structures of the user process according to the address data of the system service process recorded in the merging and jump to call. And a call between two or more mapped system service processes, providing a special switch function to process jump in a user mode, wherein the function receives a target process in the service call and an application program interface (Application Programming Interface, API) called by the target process, performs table lookup for the service process to determine an address and jumps to execute.
On the basis of the system architecture, the following describes a method for calling a system service provided by the embodiment of the present application, referring to fig. 3, and fig. 3 is a schematic flow chart of the method for calling a system service provided by the embodiment of the present application, which may specifically include the following steps:
301. and determining n system service processes according to the first user process, wherein n is more than or equal to 1.
First, the computer device determines n system service processes to be consolidated according to a current user process (which may be referred to as a first user process).
It should be noted that, in this step, the first user process needs to determine those frequently called service processes in the key processing function, that is, the n system service processes, which may be determined by analyzing the code of the first user process by the user, or may be determined directly by the computer device according to the type of the first user process, which is not limited in this application.
It should be noted that, in some embodiments of the present application, after n system service processes are determined, address isolation (such as SFI) is further required for the n system service processes, so that an address space in which each system service process operates is limited to a window range with a specified size. The address isolation processing is also performed before the processes are combined, and 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 within the specified size range, so that the running address space of the system service process is limited within the specified size range, and the situation that the target information segment in step 302 is copied to the first user process and then cannot collide with the codes of other processes is avoided, and the process breakdown is avoided.
It should be further noted that, in some embodiments of the present application, the link libraries used by each system service process need to be modified to convert the designated IPC implementation into a procedure of function call, so that the original IPC processing procedure in the system service process is changed into a procedure of function call.
302. And copying the target information segments of each of the n system service processes to n address spaces of preset ranges in the first user process to obtain a second user process, wherein one system service process corresponds to one address space of the preset range.
And the computer equipment further copies the determined target information segments of the n system service processes to n address spaces (namely a section of memory space between the addresses a and b, such as a memory space with the addresses of 1000-5000) in the first user process, so as to obtain a second user process, wherein one system service process corresponds to one address space in the preset range. Specifically, address space information of the processes is read from each system service process, so that the existence position of a target information segment of the system service process to be combined in the current service process is determined. And then, according to the read address space information, reading and copying the designated information segment in each system service process to the address space pre-allocated by the first user process. The execution of step 302 is the merging process of the corresponding embodiment of fig. 2. The n pre-scoped address spaces are pre-allocated by the computer device when n system service processes are determined in step 301.
It should be noted that the size of the address spaces of the n preset ranges may be the same or different, which is not limited by the present application.
As an example, assuming that 3 system service processes (i.e., n=3) are determined according to step 301, namely process a, process B, and process C, respectively, the computer device allocates 3 preset ranges of address spaces in the first user process for the 3 system service processes, and assuming that the 3 preset ranges of address spaces are address space a (e.g., memory spaces of addresses 1000-3000), address space B (e.g., memory spaces of addresses 3001-6000), and address space C (e.g., memory spaces of addresses 6001-9000), respectively. In this example, the address space sizes allocated for process a, process B, process C are the same. In practical applications, the address spaces allocated may be different, for example, address space a may be a memory space of addresses 1000-3000, address space b may be a memory space of addresses 3001-7000, and address space b may be a memory space of addresses 7001-8000, which is determined by the practical application scenario, which is not limited in the present application.
In some embodiments of the present application, n management units (also referred to as a management structure) may be pre-allocated to the n system service processes, where one system service process corresponds to one management unit, in addition to pre-allocating n address spaces in a preset range to the n system service processes. After the computer device copies the respective target information segments of the n system service processes to the n address spaces of the preset ranges in the first user process, the state information of the n system service processes can be further recorded in the preassigned n management units, and relevant information of each system service process in running is recorded in each management unit for use in the subsequent function call. The status information can be read out when the computer equipment performs address isolation on each system service process, then the processes are combined according to the read-out information, and new address information of a target information segment of the combined system service process is recorded in the step.
Specifically, in the embodiment of the present application, the state information may be at least any one of 1) a start address and/or an end address of the target information segment corresponding to each system service process in the second user process (i.e., a specific position of the target information segment in the address space of the preset range allocated respectively), 2) a data size of the target information segment corresponding to each system service process (i.e., a size of the occupied memory of the target information segment in the address space of the preset range allocated respectively), 3) a function and/or a function number (e.g., how many functions correspond to each function, a function name, a function number, etc.) corresponding to the target information segment corresponding to each system service process, and 4) a value of a register corresponding to each system service process.
It should be noted that, in some embodiments of the present application, the target information segment of each copied system service process may 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 target code segment and a target data segment, where the target data segment is data required by the target code segment in running. It should be noted that the determination of the target code segments/data segments may be performed by marking, by each system service process itself, which codes or data are key code segments/data segments, and additionally integrating these key code segments/data segments together, so as to facilitate direct copying when needed later.
It should be further noted that, in some embodiments of the present application, the n system service processes may be identified in the second user process based on a process number, that is, a process number is pre-allocated to each system service process in the second user process, where the process number is used as a unique identity of the system service process in the second user process, and is used to accurately identify and invoke the corresponding system service process in a subsequent operation. It should be noted that the process number is only an example, and in practical application, an Identity (ID) code such as a unique code, a dedicated number, a unique character, etc. may be allocated, so long as it can implement a function of uniquely identifying a corresponding system service process, which is not limited in the present application.
303. And under the condition that the second user process calls the first process, performing service call on the first process in the second user process in a function call mode, wherein the first process is one of n system service processes.
Finally, the computer equipment completes subsequent system service call by a function call mode according to the information so as to realize the function. This step is performed after the completion of the merging. In an embodiment of the present application, the call may be divided into:
(1) The user process invokes a system service process.
I.e. the second user process invokes a first process, wherein the first process is one of the n system service processes. In this case, the service call is made to the first process by means of a function call within the second user process. For example, in the second user process, service call is performed on the first process in a function call manner according to the state information recorded in the first management unit, where the first management unit is a management unit corresponding to the first process. 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 that jump execution is realized.
(2) The system service process invokes the system service process.
Namely, under the condition that the second process calls the third process, the service call of the third process can be completed through a forwarding function in the second user process, wherein the second process and the third process are any two processes in the n system service processes.
Because each system service process is in an address isolation state at this time, the mutual call between the two combined system service processes is completed by a forwarding function in the second user process, the forwarding function receives the contents of the process number, parameters and the like of the target process called by the system service process, and the system service process is helped to complete address jump and transfer function return values by accessing the state information recorded in the management unit.
In order to facilitate understanding of the above procedure, the corresponding embodiment of fig. 3 is described below by taking a specific example as an example, referring specifically to fig. 4, fig. 4 is a diagram showing an example of a component structure of a system service calling method according to an embodiment of the present application, where an instance is a case that a call of a system service process (hereinafter referred to as a target process) of md5 computing is converted from an IPC call to a function call. The md5 service process functions to receive a piece of data content, calculate the md5 value for this 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 calling to the function calling after being combined into the same process, and the specific implementation steps are as follows:
And (one) determining the process number of the target process and reading the address space information of the target process.
Referring specifically to fig. 5, fig. 5 is a flowchart of the implementation of step (one), which may include the following steps:
501. The process number of the md5 service process is determined.
This step first determines the process number of the md5 service process.
502. And reading address distribution information of the md5 service process.
Thereafter, its address distribution (i.e. where the target code segment/data segment exists) is read in the md5 service process as the next operation information.
503. The md5 service process is assigned a management unit.
And meanwhile, corresponding management units (i.e. management structures) are allocated to the md5 service process to be pulled through the user process.
And secondly, address isolation processing is carried out on codes of the md5 service process in a compiling stage, and the implementation of specific IPC is changed by modifying a link library of the code.
Referring specifically to fig. 6, fig. 6 is a flowchart of the implementation of the step (two), which may include the following steps:
601. address isolation is performed on the md5 service process.
First, address isolation, such as SFI, is performed for the md5 service process.
602. New address distribution information is recorded at a position where the address distribution information is recorded.
After address isolation of the code segment of md5, new address distribution information of the target code segment/data segment to be copied is recorded at the position where the address distribution information is recorded.
603. Md5 service processes go to sleep waiting merge.
The md5 service process enters a dormant state waiting for subsequent merging.
The second step is to ensure the process security after the process merging. After address isolation is performed on the md5 service process, the memory range used when the md5 code segment is running can be limited in a fixed address interval, and in the subsequent merging, the md5 service process is copied to a segment of 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, and normal running of the processes is ensured. And meanwhile, modifying a link library used by the md5 service process, and converting the realization of the designated IPC into a function call flow, so that the original IPC processing flow in the md5 service process is changed into a required function call flow.
And (III) copying each code segment/data segment in the md5 service process to a memory space pre-allocated by the user process.
Referring specifically to fig. 7, fig. 7 is a flowchart of the implementation of the step (iii), which may include the following steps (i.e. the following operations are performed on each segment of address space in sequence):
701. address space is allocated in the user state.
First, an address space is pre-allocated for the code/data segments to be copied in the user state.
702. The right to newly allocate the address space is configured.
And corresponding rights are configured for the pre-allocated address space.
703. Data of the specified segment of the md5 service process is read.
Thereafter, the data (i.e., the specified segments) of the specified address space of the md5 service process is read.
704. The data is copied into a pre-allocated address space for the user process.
And finally, copying the read data in the designated address space into an address space which is pre-allocated by a user, limiting the address allocation range of the subsequent process in a system operation kernel, and defining the starting size of the virtual address to prevent address conflict of the service process in the subsequent execution when the service process applies for memory allocation.
And (IV) recording information such as address segments of all the combined service processes for subsequent calling.
Referring specifically to fig. 8, fig. 8 is a flowchart of the implementation of the step (four), which may include the following steps:
801. information such as address fields is recorded.
All memory paragraph address information is recorded in a series of tables (i.e. management units), and the recorded contents can comprise function address information, global variable address information and the like in the original service process function segment and the data segment.
802. The service call obtains the target address through looking up a table and realizes the jump.
And then, the subsequent service call and the call between the system services acquire the target address through table lookup, and jump execution is carried out.
And fifthly, corresponding table look-up and jump functions are realized in the user process, and service call and inter-service call are realized.
Referring specifically to fig. 9, fig. 9 is a flowchart of the implementation of the step (five), which may include the following steps:
901. and realizing a service jump function.
This step implements a special service hopping function.
902. When service call is made, the jump function address is pressed into the stack bottom for service call.
Before the user process makes service call, the address of the jump function is pressed in the stack bottom, and in the service execution process, the service call is realized through the processing function at the stack bottom.
903. The jump function completes the operations of receiving parameters and looking up table jump, and realizes service call.
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 meanwhile, the receiving parameters are transferred to the target function to realize service calling.
In order to better implement the above-described aspects of the embodiments of the present application on the basis of the above-described embodiments, a related apparatus for implementing the above-described aspects is also provided below. Referring specifically to fig. 10, fig. 10 is a schematic diagram of a computer device provided by an embodiment of the present application, where the computer device 1000 specifically may include a determining module 1001, a merging module 1002, and a service calling module 1003, where the determining module 1001 is configured to determine n system service processes according to a first user process, where n is greater than or equal to 1, the merging module 1002 is configured to copy respective target information segments of the n system service processes to n address spaces of a preset range in the first user process, to obtain a second user process, where one system service process corresponds to one address space of a preset range, and the service calling module 1003 is configured to call the first process in the second user process by means of a function call when the second user process calls the first process, where the first process is one of the n system service processes.
In one possible design, the merging module 1002 is further configured to record the status information of the n system service processes in the preassigned n management units after copying the respective target information segments of the n system service processes to n address spaces of preset ranges in the first user process, where one system service process corresponds to one management unit.
In one possible design, the status information includes at least any one of:
The starting address and/or the ending address of the target information segment corresponding to each system service process in the second user process;
The data size of the target information segment corresponding to each system service process;
The function and/or the function number corresponding to the target information segment corresponding to each system service process;
each of the system service processes corresponds to a value of a register.
In one possible design, the service calling module 1003 is specifically configured to, in the second user process, call the first process by a function calling manner according to the state information recorded in the first management unit, where the first management unit is a management unit corresponding to the first process.
In a possible design, the determining module 1001 is further configured to perform address isolation processing on the n system service processes after the n system service processes are determined according to the first user process, so that an address space in which each of the system service processes operates is limited to a range of a specified size.
In one possible design, the determining module 1001 is further configured to update a linked library of n system service processes after the determining of the n system service processes according to the first user process, and convert the inter-process communication IPC call into a function call.
In a possible design, the determining module 1001 is further configured to assign a process number to each of the system service processes in the second user process after the n system service processes are determined according to the first user process, where the process number is used to identify the corresponding system service process.
In one possible design, the service calling module 1003 is further configured to complete, in a case where the second process calls the third process, the service call to the third process through the forwarding function in the second user process, where the second process and the third process are any two processes in the n system service processes.
In one possible design, the target information segment includes a target code segment and/or a target data segment, which is the data that the target code segment requires at runtime.
It should be noted that, the content of information interaction and execution process between each module/unit in the computer device 1000 is based on the same concept as that of the above-described method embodiment of the present application, and specific content may be referred to the description of the above-described method embodiment of the present application, which is not repeated here.
Referring to fig. 11, fig. 11 is a schematic structural diagram of a computer device according to an embodiment of the present application, where a module of a computer device 1000 described in the corresponding embodiment of fig. 10 may be disposed on a computer device 1100, for implementing 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, where the computer device 1100 may be relatively different due to configuration or performance, and may include one or more central processing units (Central Processing Units, CPU) 1122 and a memory 1132, and one or more storage mediums 1130 (such as one or more mass storage devices) storing application programs 1142 or data 1144. Wherein the memory 1132 and the storage medium 1130 may be transitory or persistent. The program stored on the storage medium 1130 may include one or more modules (not shown), each of which may include a series of instruction operations in the computer device 1100. Still further, the central processor 1122 may be provided in communication with a storage medium 1130, executing a series of instruction operations in the storage medium 1130 on the computer device 1100.
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-output interfaces 1158, and/or one or more operating systems 1141, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, and the like.
In an embodiment of the present application, the cpu 1122 is configured to execute steps executed by the computer device in the corresponding embodiment of fig. 5 or fig. 6. For example, the CPU 1122 may be configured to determine n system service processes according to a user process, copy respective target information segments (e.g., code segments/data segments) of the n system service processes into n address spaces of preset ranges in the user process, and when the user process incorporating the target information segments invokes a first process (the first process belongs to the n system service processes), make a service call to the first process in the user process by means of a function call.
It should be noted that, the specific manner in which the cpu 1122 performs the above steps is based on the same concept as the method embodiment of the present application, and the technical effects thereof are the same as the method embodiment of the present application, and the specific details thereof may be referred to the description of the method embodiment of the present application and will not be repeated herein.
It should be further noted that the above-described apparatus embodiments are merely illustrative, and that the units described as separate units may or may not be physically separate, and that units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the drawings of the embodiment of the device provided by the application, the connection relation between the modules represents that the modules have communication connection, and can be specifically implemented as one or more communication buses or signal lines.
From the above description of the embodiments, it will be apparent to those skilled in the art that the present application may be implemented by means of software plus necessary general purpose hardware, or of course by means of special purpose hardware including application specific integrated circuits, special purpose CPUs, special purpose memories, special purpose components, etc. Generally, functions performed by computer programs can be easily implemented by corresponding hardware, and specific hardware structures for implementing the same functions can be varied, such as analog circuits, digital circuits, or dedicated circuits. But a software program implementation is a preferred embodiment for many more of the cases of the present application. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a readable storage medium, such as a floppy disk, a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random-access Memory (Random Access Memory, RAM), a magnetic disk or an optical disk of a computer, etc., including instructions for causing a computer device (which may be a personal computer, a training device, a network device, etc.) to execute the method according to the embodiments of the present application.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may 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 may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via a wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a training device, a data center, or the like that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (Solid STATE DISK, SSD)), etc.

Claims (22)

1. A method for invoking a system service, comprising:
determining n system service processes according to the first user process, wherein n is more than or equal to 1;
copying the target information segments of each of the n system service processes to address spaces of n preset ranges in the first user process to obtain a second user process, wherein one system service process corresponds to the address space of one preset range;
And under the condition that the second user process calls a first process, performing service call on the first process in the second user process in a function call mode, wherein the first process is one of the n system service processes.
2. The method of claim 1, wherein after said copying the respective pieces of target information for the n system service processes to n preset ranges of address space within the first user process, the method further comprises:
and recording the state information of the n system service processes in the preallocated n management units, wherein one system service process corresponds to one management unit.
3. The method according to claim 2, wherein the status information comprises at least any one of:
The starting address and/or the ending address of the target information segment corresponding to each system service process in the second user process;
the data size of the target information segment corresponding to each system service process;
the function and/or the function number corresponding to the target information segment corresponding to each system service process;
and the value of the register corresponding to each system service process.
4. A method according to any of claims 2-3, wherein said making a service call to said first process within said second user process by way of a function call comprises:
And in the second user process, carrying out service call on the first process in a function call mode according to the state information recorded in the first management unit, wherein the first management unit is a management unit corresponding to the first process.
5. The method according to any of claims 1-4, wherein after said determining n system service processes from the first user process, the method further comprises:
And carrying out address isolation processing on the n system service processes, so that the address space of each system service process is limited to be within the range of a specified size.
6. The method according to any one of claims 1-5, wherein after said determining n system service processes from the first user process, the method further comprises:
and updating the linked libraries of the n system service processes, and converting the IPC call of the inter-process communication into a function call.
7. The method according to any one of claims 1-6, wherein after said determining n system service processes from the first user process, the method further comprises:
and assigning a process number for each system service process in the second user process, wherein the process number is used for identifying the corresponding system service process.
8. The method according to any of claims 1-7, wherein after copying the respective pieces of target information of the n system service processes to n preset ranges of address space within the first user process, the method further comprises:
and under the condition that a second process calls a third process, completing service call of the third process through the number of rotations send a letter in the second user process, wherein the second process and the third process are any two processes in the n system service processes.
9. The method according to any one of claims 1-8, wherein the target information piece comprises:
A target code segment, and/or a target data segment, the target data segment being data required by the target code segment at runtime.
10. A computer device, comprising:
the determining module is used for determining n system service processes according to the first user process, wherein n is more than or equal to 1;
The merging module is used for copying the respective target information segments of the n system service processes to the address spaces of n preset ranges in the first user process to obtain a second user process, and one system service process corresponds to the address space of one preset range;
And the service calling module is used for calling the first process in the second user process in a function calling mode under the condition that the second user process calls the first process, and the first process is one of the n system service processes.
11. The apparatus of claim 10, wherein the merge module is further to:
after the target information segments of the n system service processes are copied to the address spaces of n preset ranges in the first user process, the state information of the n system service processes is recorded in n preassigned management units, and one system service process corresponds to one management unit.
12. The apparatus of claim 11, wherein the status information includes at least any one of:
The starting address and/or the ending address of the target information segment corresponding to each system service process in the second user process;
the data size of the target information segment corresponding to each system service process;
the function and/or the function number corresponding to the target information segment corresponding to each system service process;
and the value of the register corresponding to each system service process.
13. The device according to any of the claims 11-12, wherein the service invocation module is specifically configured to:
And in the second user process, carrying out service call on the first process in a function call mode according to the state information recorded in the first management unit, wherein the first management unit is a 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 n system service processes are determined according to the first user process, address isolation processing is performed on the n system service processes, so that an address space in which each system service process operates is limited within a range of a specified size.
15. The apparatus of any one of claims 10-14, wherein the determining module is further configured to:
after the n system service processes are determined according to the first user process, the link libraries of the n system service processes are updated, and the inter-process communication IPC call is converted into a function call.
16. The apparatus of any one of claims 10-15, wherein the determining module is further configured to:
after the n system service processes are determined according to the first user process, a process number is allocated to each system service process in the second user process, wherein the process number is used for identifying the corresponding system service process.
17. The apparatus of any one of claims 10-16, wherein the service invocation module is further configured to:
and under the condition that a second process calls a third process, completing service call of the third process through the number of rotations send a letter in the second user process, wherein the second process and the third process are any two processes in the n system service processes.
18. The apparatus according to any one of claims 10-17, wherein 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 at runtime.
19. A computer device comprising a processor and a memory, the processor being coupled to the memory, characterized in that,
The memory is used for storing programs;
The processor configured to execute the program in the memory, to cause the computer device to perform the method of any of claims 1-9.
20. A computer storage medium, characterized in that computer readable instructions are stored and when executed by a processor implement the method of any of claims 1-9.
21. A computer program product comprising computer readable instructions which, when executed by a processor, implement the method of any of claims 1-9.
22. A chip comprising a processor and a data interface, wherein the processor reads instructions stored on a memory through the data interface, performing the method of any of claims 1-9.
CN202410529113.4A 2024-04-28 2024-04-28 A system service calling method and computer device Pending CN120849149A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202410529113.4A CN120849149A (en) 2024-04-28 2024-04-28 A system service calling method and computer device
PCT/CN2024/140242 WO2025227765A1 (en) 2024-04-28 2024-12-18 System service calling method and computer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410529113.4A CN120849149A (en) 2024-04-28 2024-04-28 A system service calling method and computer device

Publications (1)

Publication Number Publication Date
CN120849149A true CN120849149A (en) 2025-10-28

Family

ID=97415351

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410529113.4A Pending CN120849149A (en) 2024-04-28 2024-04-28 A system service calling method and computer device

Country Status (2)

Country Link
CN (1) CN120849149A (en)
WO (1) WO2025227765A1 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123265B (en) * 2013-04-26 2017-12-22 华为技术有限公司 A kind of many communication method between cores and system
CN114356591B (en) * 2020-10-14 2025-07-11 阿里巴巴集团控股有限公司 Inter-process communication method, device, Internet of Things operating system, and Internet of Things device
CN113064697B (en) * 2021-04-01 2022-09-23 上海交通大学 Method for accelerating communication between microkernel processes by using multiple hardware characteristics
CN116048827B (en) * 2021-10-28 2026-02-13 华为技术有限公司 A method for inter-process function calls and related devices
US12254079B2 (en) * 2022-05-10 2025-03-18 International Business Machines Corporation Providing system services

Also Published As

Publication number Publication date
WO2025227765A1 (en) 2025-11-06

Similar Documents

Publication Publication Date Title
CN114942796B (en) Plug-in compiling and calling method, device, equipment and storage medium
CN114327777B (en) Method and device for determining global page directory, electronic equipment and storage medium
CN108062252A (en) A kind of information interacting method, method for managing object and device and system
CN116107764B (en) Data processing method and system
CN114996750B (en) Data sharing method and device
CN100487649C (en) Call method between chip
CN102667714A (en) method and system for enabling access to functionality provided by resources outside of an operating system environment
CN116560878A (en) Memory sharing method and related device
CN114327938A (en) PISA manager implementation mode under Linux system
WO2019228237A1 (en) Data processing method and computer device
CN112306539A (en) Method, system, terminal and medium for developing application layer of single chip microcomputer
CN116382713A (en) Method, system, device and storage medium for building application images
CN115729859A (en) Method and corresponding device for managing dynamic library
CN120849149A (en) A system service calling method and computer device
CN109408407B (en) Display memory allocation method and device
US12079595B2 (en) Runtime support for role types that extend underlying types
CN114880073A (en) Cloud application engine deployment method, device, equipment and storage medium for shielding Web framework for user
CN114356604A (en) Contract calling method and device, electronic equipment and storage medium
CN114168652A (en) A smart contract interaction method, device, device and storage medium
CN119862157B (en) A file resource access method, device and medium without file system platform
CN119883389B (en) Cross-module initialization operation methods, devices, storage media and program products
WO2026076977A1 (en) Data transmission method and related apparatus
CN114489662A (en) Method and device for operating Internet of things system, electronic equipment and medium
CN118445032B (en) Service providing method, apparatus, electronic device, storage medium, and computer program product
CN112488293B (en) Method and device for operating deep learning network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication