Inter-process communication method, apparatus, device, medium and program product of microkernel
By optimizing the microkernel IPC mechanism, adopting a power bypass and communication protection key mechanism, and combining lightweight task switching, the problem of limited microkernel performance was solved, and the system performance in high-frequency communication scenarios was improved.
Patent Information
- Application Number
- CN202510684811.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2026-11-27
AI Technical Summary
The existing microkernel IPC mechanism has low task switching efficiency, which limits the performance of the microkernel and becomes a bottleneck for the overall system performance, especially in high-frequency communication scenarios.
An IPC fast path optimization scheme based on power bypass is adopted, which combines a communication protection key mechanism and a lightweight task switching mechanism to optimize the inter-process communication process and reduce unnecessary power verification and register switching overhead.
It significantly improves the performance of the microkernel in high-frequency communication scenarios, reduces IPC latency and context switching overhead, and enhances the system's response speed and throughput.
Smart Images

Figure CN123178111A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a microkernel-based inter-process communication method, apparatus, device, medium, and program product. Background Technology
[0002] A microkernel is an operating system architecture that retains only core functionalities such as inter-process communication (IPC), scheduling, and memory management. IPC is a set of mechanisms provided by the operating system that enable different processes to exchange data or synchronize. In a microkernel architecture, IPC is the primary method for calling system services. System services are a set of core functions provided by the operating system, including process management, file systems, and network communication. In a microkernel architecture, system services typically interact through IPC. However, in the context of ubiquitous computing (a computing paradigm that emphasizes the omnipresence of computing devices and services, enabling users to access computing resources seamlessly in their daily environments, achieving highly intelligent and seamless information processing), the coupling between system services is high, interactions are frequent, and most are process calls. Existing microkernel IPC mechanisms suffer from low task switching efficiency, which limits microkernel performance to the existing microkernel IPC mechanism, becoming a bottleneck for overall system performance. Summary of the Invention
[0003] This invention provides a method, apparatus, device, medium, and program product for inter-process communication in a microkernel, which addresses the shortcomings of existing microkernel IPC mechanisms in microkernel performance. This application optimizes the task switching process, which can improve the efficiency of task switching during inter-process communication, reduce the additional burden of inter-process communication, and thus improve the performance of the microkernel in high-frequency communication scenarios.
[0004] This invention provides a microkernel-based inter-process communication method, applicable to a microkernel operating system. The inter-process communication method of this application includes the following steps: Obtain the access request initiated by the first system service process against the second system service process, wherein the access request includes system call parameters; Read the value of the preset register when the first system service process is suspended, save the read value to the data structure associated with the first system service in memory, and load the system call parameters into the pre-agreed general-purpose register; Read the value of the preset register when the second system service process is suspended from the data structure associated with the second system service in memory, and load the read value into the preset register; Control of the central processing unit is transferred to the second system service process. The second system service process processes the access request according to the system call parameters recorded in the general-purpose register and saves the processing result to the general-purpose register. The processing result is used by the first system service process after it resumes operation. After processing the access request, the value of the preset register when the first system service process is suspended is read from the data structure associated with the first system service in memory, the read value is loaded into the preset register, and the control of the central processing unit is transferred to the first system service process to restore the running state of the first system service process.
[0005] According to the inter-process communication method provided in this application, after obtaining the access request initiated by the first system service process for the second system service process, the method further includes: Obtain the communication key carried in the call request, and verify the validity of the communication key according to the preset communication key agreed upon between the first system service process and the second system service process; If the verification result shows that the communication key is valid, it is determined that the first system service process has the permission to access the second system service process through the target mode, where the target mode is a mode that does not include permission verification. The step of reading the value of the preset register when the first system service process is suspended includes: If the first system service process has permission to access the second system service process through the target mode, read the value of the preset register when the first system service process is suspended.
[0006] According to the inter-process communication method provided in this application, the preset register includes a stack pointer register, an instruction pointer register, and a page table register. Reading the value of the preset register when the first system service process is suspended includes: Read the value recorded in the stack pointer register, which indicates the stack top position used when the first system service process was suspended; Read the value recorded in the instruction pointer register, which represents the address of the next instruction to be executed when the first system service process is suspended; Read the value of the page table recorded in the page table register, which points to the page table describing the virtual memory address space of the first system service process.
[0007] According to the inter-process communication method provided in this application, before obtaining the access request initiated by the first system service process for the second system service process, the method further includes: Obtain the registration request for the communication channel in the target mode sent by the second system service process; In response to the registration request, the preset communication key is generated based on the second system service process and the access permissions of the second system service process. The access permissions of the second system service process indicate that the first system service process is allowed to access the second system service process through the communication channel in the target mode. The preset communication key is assigned to the first system service process.
[0008] According to the inter-process communication method provided in this application, both the first system service process and the second system service process are independent user-mode processes on the microkernel operating system.
[0009] The present invention also provides a microkernel inter-process communication device, comprising the following modules: The first acquisition module is used to acquire access requests initiated by the first system service process against the second system service process; The storage module is used to read the value of a preset register when the first system service process is suspended, save the read value to a data structure associated with the first system service in memory, and load the system call parameters in the access request into a pre-agreed general-purpose register. The first loading module is used to read the value of the preset register when the second system service process is suspended from the data structure associated with the second system service in memory, and load the read value into the preset register; The processing module is used to transfer control of the central processing unit to the second system service process. The second system service process is used to process the access request according to the system call parameters recorded in the general-purpose register, and save the processing result to the general-purpose register. The processing result is used by the first system service process after it resumes operation. The second loading module is used to, after completing the processing of the access request, read the value of the preset register when the first system service process is suspended from the data structure associated with the first system service in memory, load the read value into the preset register, and hand over the control of the central processing unit to the first system service process to restore the running state of the first system service process.
[0010] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a microkernel inter-process communication method as described above.
[0011] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a microkernel inter-process communication method as described above.
[0012] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a microkernel inter-process communication method as described above.
[0013] Implementing the inter-process communication method of this application, the microkernel first obtains the access request initiated by the first system service process against the second system service process. Next, it reads the value of a preset register when the first system service process was suspended, saves the read value to memory, and loads the system call parameters from the access request into a pre-agreed general-purpose register. Then, it reads the pre-saved value of the preset register when the second system service process was suspended from memory and loads the read value into the preset register. Next, it transfers control of the central processing unit to the second system service process, enabling the second system service process to process the access request according to the system call parameters recorded in the general-purpose register, and saves the processing result to the general-purpose register. The processing result is used by the first system service process after resuming its running state. After processing the access request, it reads the pre-saved value of the preset register when the first system service process was suspended from memory, loads the read value into the preset register, and transfers control of the central processing unit back to the first system service process to restore its running state. This application optimizes the task switching process, improving the efficiency of task switching during inter-process communication, reducing the additional burden of inter-process communication, and thus improving the performance of the microkernel in high-frequency communication scenarios. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0015] Figure 1 This is a flowchart illustrating an embodiment of a microkernel inter-process communication method; Figure 2 This is a flowchart illustrating a conventional microkernel inter-process communication process according to an embodiment of this application; Figure 3 This is a schematic diagram illustrating the principle of inter-process communication of a system service according to an embodiment of this application; Figure 4This is a structural block diagram of a microkernel inter-process communication device according to an embodiment of this application; Figure 5 This is a schematic diagram of the physical structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0017] Figure 1 This is a flowchart illustrating an embodiment of a microkernel inter-process communication method. (Refer to...) Figure 1 The method of this application may include: Step 101: Obtain the access request initiated by the first system service process against the second system service process.
[0018] In this application, system services may include file system services, network system services, driver services, etc.
[0019] In a microkernel operating system, system services such as file system services, network system services, and driver services each run as independent user-mode processes.
[0020] To protect the core of the operating system and ensure stable system operation, the Central Processing Unit (CPU) has different operating modes. The two most common modes are Kernel Mode and User Mode. User Mode corresponds to a lower privilege level of the CPU. Code running in this mode cannot directly access most hardware resources, and the CPU instructions it can execute are also limited. Furthermore, it needs to use system calls to request the kernel (the code running in kernel mode) to help it complete sensitive operations such as accessing hardware and managing memory.
[0021] A process is a running instance of a program. When each program runs, the operating system creates a process for it, allocates independent memory space and resources, and allows it to execute tasks independently. In a microkernel architecture, a functional module that provides a specific system service operates as a process. That is, a module providing file system services operates as a file system service process, a module providing network system services operates as a network system service process, and a module providing driver services operates as a driver service process.
[0022] In step 101, if the first system service process needs to communicate with the second system service process, for example, if it needs to call a function of the second system service process, it can request access to the second system service process through a system call instruction. When the CPU executes this system call instruction, it immediately switches the execution mode from user mode to kernel mode to handle the access request from the first system service process.
[0023] The microkernel itself runs at the highest privilege level of the CPU, i.e., kernel mode. Therefore, the microkernel has the authority to access all hardware resources and execute all privileged CPU instructions, thus enabling it to manage the entire system. Consequently, a microkernel operating system can handle access requests initiated by a first system service process against a second system service process.
[0024] Step 102: Read the value of the preset register when the first system service process is suspended, save the read value to the data structure associated with the first system service in memory, and load the system call parameters in the access request into the pre-agreed general-purpose register.
[0025] Registers are high-speed storage units inside the CPU used to temporarily store instructions, data, and address information. Common types include general-purpose registers (used for arithmetic and data access), stack pointer registers, instruction registers, and page table registers.
[0026] In this application, the preset registers include the stack pointer register, the instruction pointer register, and the page table register.
[0027] Page tables are structures used by the operating system to manage virtual memory. They map virtual addresses to physical addresses, enabling processes to use a larger address space than the actual physical memory and achieving address isolation between processes.
[0028] Accordingly, step 102 may include: Read the value recorded in the stack pointer register, which indicates the stack top position used when the first system service process was suspended; Read the value recorded in the instruction pointer register, which represents the address of the next instruction to be executed when the first system service process is suspended; Read the value of the page table recorded in the page table register, which points to the page table describing the virtual memory address space of the first system service process.
[0029] In this application, after reading the values representing the stack top position used when the first system service process is suspended, the address of the next instruction to be executed when the first system service process is suspended, and the page table pointing to the virtual memory address space of the first system service process, these values are saved to the data structure associated with the first system service in memory.
[0030] In this application, the following steps need to be performed before step 101: Obtain the registration request for the communication channel in the target mode sent by the second system service process; In response to the registration request, a preset communication key is generated based on the second system service process and its access permissions. The access permissions of the second system service process indicate that the first system service process is allowed to access the second system service process through the communication channel in the target mode. Assign a preset communication key to the first system service process.
[0031] The target mode is the mode that does not include capability verification. A capability is an access control mechanism that represents a process's access rights to system resources (such as memory, ports, devices, etc.). When a microkernel uses a capability model to ensure secure access to resources, only processes holding the corresponding capabilities can perform controlled operations.
[0032] In this application, the microkernel operating system includes a key management module for dynamically managing communication permissions between system service processes. When a system service process registers a communication channel, it generates a unique Communication Protection Key (CPK) based on the process identity and permission policy, and records information such as the key's lifecycle, access permissions, and bound process.
[0033] In this application, the second system service process allows the first system service process to access the second system service process using a non-authority authentication method. Therefore, it can initiate a registration request for the communication channel. The key management module responds to this registration request, generates a communication protection key (i.e., a preset communication key), and assigns this communication protection key to the first system service process. Thus, in subsequent processes, the first system service process does not need to undergo authorization authentication when accessing the second system service process, thereby significantly reducing IPC latency.
[0034] In this application, after step 101 and before step 102, the following may also be included: Obtain the communication key carried in the call request, and verify the validity of the communication key according to the preset communication key agreed upon between the first system service process and the second system service process; If the verification result shows that the communication key is valid, it is determined that the first system service process has the permission to access the second system service process through the target mode.
[0035] Accordingly, step 102 may include: If the first system service process has permission to access the second system service process through the target mode, read the value of the preset register when the first system service process is suspended.
[0036] In this application, when the first system service process initiates an IPC request, the microkernel operating system first authenticates it using a communication protection key (CPK) to ensure that only the process holding the valid key can access the second system service process. The CPK mechanism avoids the redundant calculations of traditional permission verification and provides more flexible permission management capabilities, ensuring both efficiency and security in communication between system service processes.
[0037] Step 103: Read the value of the preset register when the second system service process is suspended from the data structure associated with the second system service in memory, and load the read value into the preset register.
[0038] Specifically, in the data structures associated with the second system service in memory, the value indicating the stack top position used when the second system service process is suspended is loaded into the stack pointer register, the value indicating the address of the next instruction to be executed when the second system service process is suspended is loaded into the instruction pointer register, and the value pointing to the page table describing the virtual memory address space of the second system service process is loaded into the page table register.
[0039] Step 104: Transfer control of the central processing unit to the second system service process. The second system service process is used to process access requests according to the system call parameters recorded in the general-purpose register, and save the processing results to the general-purpose register. The processing results are used by the first system service process after it resumes operation.
[0040] In this application, after completing step 103, the CPU switches to user mode and transfers control to the second system service process. The second system service process processes the access request according to the system call parameters from the access request recorded in the general-purpose register, and saves the processing result to the general-purpose register for use by the first system service process after resuming its running state.
[0041] Step 105: After completing the processing of the access request, read the value of the preset register when the first system service process is suspended from the data structure associated with the first system service in memory, load the read value into the preset register, and transfer the control of the central processing unit to the first system service process to restore the running state of the first system service process.
[0042] Since the values of the preset registers when the first system service process is suspended have been pre-recorded in memory in step 102, the values representing the state of the first system service process when it is suspended can be directly read from the data structure associated with the first system service in memory, and the read values are loaded into the preset registers. Specifically, the value representing the stack top position used by the first system service process when it is suspended is loaded into the stack pointer register, the value representing the address of the next instruction to be executed when the first system service process is suspended is loaded into the instruction pointer register, and the value pointing to the page table describing the virtual memory address space of the first system service process is loaded into the page table register. Then, control of the central processing unit is transferred to the first system service process to restore the running state of the first system service process.
[0043] In microkernel operating systems, processes corresponding to system services such as file system services, network system services, and driver services interact with each other through IPC mechanisms. However, in the context of ubiquitous computing, the coupling between various system services is high, interactions are frequent, and most are procedure calls. Their performance is limited by the existing microkernel IPC mechanism, becoming a bottleneck for the overall system performance.
[0044] Currently, mainstream microkernels typically employ a power mechanism to implement inter-process communication (IPC) to ensure security and access control. Powers point to specific system objects and restrict access permissions. In a power-based operating system, a process must provide the corresponding power to perform operations on the target object. For example, the widely accepted microkernel seL4 uses an endpoint-based symmetric communication model. An endpoint is a type of power in seL4, which can be viewed as a port of a message queue. Communication processes interact by sending messages to the endpoint, such as... Figure 2 As shown. However, this model suffers from significant performance issues in process call scenarios between system services. Unlike ordinary inter-process communication, the communicating parties between system services are fixed and clearly identifiable, and are usually trusted by each other. However, existing microkernel IPC mechanisms, such as seL4, do not utilize this characteristic, but instead always perform a complete validity check, resulting in additional computational overhead. Due to the frequent calls to system services, this additional overhead is particularly significant in high-throughput scenarios, limiting the overall performance of the IPC mechanism and affecting the system's interaction efficiency. Figure 2This is a flowchart illustrating a traditional microkernel inter-process communication process in one embodiment of this application.
[0045] exist Figure 2 In this code, Thread 1 and Thread 2 represent two independent threads (or processes). Thread 1 can be considered a client process, and Thread 2 a server process. Running and Blocked represent the process states, with Running indicating execution, meaning the process is currently using the CPU to execute its own code (e.g., ...). Figure 1 (As shown by the wavy lines in the image), Blocked indicates that the process is blocked / waiting, meaning it is paused in execution because it is waiting for an event (such as a message or a reply), and does not consume CPU time. Send(epX_cap, ...) indicates a send operation, where the process calls the send function provided by the kernel to send a message through a specific communication point (Endpoint, abbreviated as ep). epX_cap is the capability required to access communication point X. Wait(epX_cap, ...) indicates a wait / receive operation, where the process calls the wait function provided by the kernel to wait for a message to arrive at a specified communication point, and also needs to provide the corresponding capability epX_cap. The hourglass-shaped graphic in the middle represents the communication point or the mechanism in the kernel used for synchronization and message passing, and the arrows indicate the direction of message passing.
[0046] To design an efficient inter-process communication mechanism suitable for system services, this application proposes a fast path optimization scheme for IPC based on permission bypass. This scheme, based on the microkernel's inherent trust relationship with system processes, reconstructs the IPC access control logic, removing unnecessary permission verification while ensuring security, thereby reducing communication overhead. In the traditional seL4 IPC mechanism, each communication requires checking whether the process holds legitimate permissions, resulting in additional instruction execution and access permission verification. This application directly bypasses these redundant checks, providing a low-latency system call execution flow along the communication path, making process calls between system services more efficient.
[0047] While removing permission verification, this application also designs a Communication Protection Key (CPK) mechanism to ensure the security of inter-process communication. This mechanism adds a key management module to the microkernel to dynamically manage communication permissions between system processes. When a system process registers a communication channel, it generates a unique communication protection key based on the process's identity and permission policy, and records information such as the key's lifecycle, access permissions, and bound process. When a process initiates an IPC request, the microkernel first performs authentication via the CPK, ensuring that only the process holding the valid key can access the target service. The CPK mechanism avoids the redundant calculations of traditional permission verification while providing more flexible permission management capabilities, making communication between system services both efficient and secure.
[0048] Furthermore, this application proposes a lightweight task switching mechanism to reduce unnecessary context switching overhead during IPC. In traditional task switching, the microkernel typically needs to completely save and restore the state of all registers, leading to high CPU resource consumption. The optimized scheme in this application only switches critical registers, including the stack pointer register, instruction register, and page table register, ensuring minimal state switching overhead. Simultaneously, system call parameters are passed directly through general-purpose registers, avoiding the use of additional memory buffers and thus reducing unnecessary data copy operations. This mechanism optimizes high-frequency IPC interactions between system services, making task switching more efficient.
[0049] Figure 3 This is a schematic diagram illustrating inter-process communication of a system service according to an embodiment of this application. (Refer to...) Figure 3 The Client process is the first system service process that initiates the access request, and the Server process is the second system service process that handles the access request. Arrow 1 indicates that the Server process pre-registers the communication channel and obtains a communication protection key. After successful registration, the Client process and the Server process can achieve fast communication. Fastpath represents the fast communication channel. Arrow 2 indicates that the first system service process needs to call the second system service process to handle the add(i,j) service. i and j are system call parameters recorded in a general-purpose register. Arrow 3 indicates the lightweight task switching mechanism provided in this application. Arrow 4 indicates that the processing result is saved to a general-purpose register, and the Client process can use the processing result after resuming its running state. The weight matrix and weight space in the lower right corner represent the complex weight verification process in traditional schemes.
[0050] In summary, the innovative aspects of this application include at least: (1) Fast synchronous IPC path based on power bypass: In-depth analysis of the original IPC model of the microkernel that relies on the power mechanism identifies redundant operations and additional legality checks, which lead to a decrease in communication efficiency. The communication path is reconstructed to reasonably avoid unnecessary power verification steps, so that system calls can complete data transmission and inter-process interaction more directly and efficiently, thereby reducing IPC latency and improving the overall system response speed and throughput.
[0051] (2) Communication Protection Key: A communication protection key was designed to ensure communication security while removing privileges. A key management module was added to the kernel to allocate keys and record relevant information when system processes register for communication. Upon receiving a communication request, the validity of the key is checked to ensure communication security.
[0052] (3) Lightweight Task Switching: A lightweight and fast task switching mechanism was designed to minimize the overhead of IPC context switching. The microkernel only switches critical registers during this process, including the stack pointer register, instruction register, and page table register. At the same time, other general-purpose registers are used to directly pass function parameters, avoiding additional memory access and data copy operations, making the switching process more efficient.
[0053] Test results show that this application can reduce the latency of IPC calls to 544 clock cycles (approximately 0.141 microseconds), reducing communication overhead by 44.8% compared to the native seL4's power mechanism approach. This optimization significantly improves the interaction efficiency between system services, resulting in a substantial improvement in microkernel performance in high-frequency communication scenarios. Furthermore, experiments further verify that this application not only reduces the additional burden of inter-process communication but also optimizes the task switching process, effectively reducing the overhead of context switching.
[0054] Overall, the optimization scheme proposed in this application improves the throughput and response speed of the microkernel, making the microkernel operating system more suitable for ubiquitous computing applications with high throughput and low latency, and providing new ideas for the further development of microkernel architecture.
[0055] The microkernel inter-process communication device provided by the present invention will be described below. The microkernel inter-process communication device described below and the microkernel inter-process communication method described above can be referred to in correspondence.
[0056] Figure 4 This is a structural block diagram of a microkernel inter-process communication device according to an embodiment of this application, with reference to... Figure 4 The inter-process communication device of the microkernel in this application may include: The first acquisition module 401 is used to acquire an access request initiated by the first system service process against the second system service process, wherein the access request includes system call parameters; The storage module 402 is used to read the value of the preset register when the first system service process is suspended, save the read value to the data structure associated with the first system service in memory, and load the system call parameters into the pre-agreed general-purpose register; The first loading module 403 is used to read the value of the preset register when the second system service process is suspended from the data structure associated with the second system service in memory, and load the read value into the preset register; Processing module 404 is used to transfer control of the central processing unit to the second system service process. The second system service process is used to process the access request according to the system call parameters recorded in the general-purpose register and save the processing result to the general-purpose register. The processing result is used by the first system service process after it resumes operation. The second loading module 405 is used to, after completing the processing of the access request, read the value of the preset register when the first system service process is suspended from the data structure associated with the first system service in memory, load the read value into the preset register, and transfer the control of the central processing unit to the first system service process.
[0057] The inter-process communication device 400 provided in this application also includes: The second acquisition module is used to acquire the communication key carried in the call request, and to verify the validity of the communication key according to the preset communication key agreed upon between the first system service process and the second system service process. The determining module is used to determine, if the verification result shows that the communication key is valid, that the first system service process has the permission to access the second system service process through the target mode, wherein the target mode is a mode that does not include permission verification. The storage module includes: The first reading submodule is used to read the value of a preset register when the first system service process is suspended, provided that the first system service process has permission to access the second system service process through the target mode.
[0058] According to the inter-process communication device 400 provided in this application, the preset register includes a stack pointer register, an instruction pointer register, and a page table register, and the storage module 402 includes: The second reading submodule is used to read the value recorded in the stack pointer register, which represents the stack top position used when the first system service process is suspended; The third reading submodule is used to read the value recorded in the instruction pointer register, which represents the address of the next instruction to be executed when the first system service process is suspended; The fourth read submodule is used to read the value of the page table recorded in the page table register, which points to the page table describing the virtual memory address space of the first system service process.
[0059] The inter-process communication device 400 provided in this application also includes: The third acquisition module is used to acquire the registration request for the communication channel in the target mode sent by the second system service process; The key management module is used to respond to the registration request and generate the preset communication key according to the second system service process and the access permissions of the second system service process. The access permissions of the second system service process indicate that the first system service process is allowed to access the second system service process through the communication channel in the target mode. The allocation module is used to allocate the preset communication key to the first system service process.
[0060] According to the inter-process communication device 400 provided in this application, the first system service process and the second system service process are both independent user-mode processes on the microkernel operating system.
[0061] Figure 5 This is a schematic diagram of the physical structure of an electronic device according to an embodiment of this application, as shown below. Figure 5 As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communications interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a microkernel inter-process communication method, which includes: Obtain the access request initiated by the first system service process against the second system service process, wherein the access request includes system call parameters; Read the value of the preset register when the first system service process is suspended, save the read value to the data structure associated with the first system service in memory, and load the system call parameters into the pre-agreed general-purpose register; Read the value of the preset register when the second system service process is suspended from the data structure associated with the second system service in memory, and load the read value into the preset register; Control of the central processing unit is transferred to the second system service process. The second system service process processes the access request according to the system call parameters recorded in the general-purpose register and saves the processing result to the general-purpose register. The processing result is used by the first system service process after it resumes operation. After completing the processing of the access request, the value of the preset register when the first system service process is suspended is read from the data structure associated with the first system service in memory, the read value is loaded into the preset register, and the control of the central processing unit is transferred to the first system service process.
[0062] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0063] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is able to execute a microkernel inter-process communication method provided by the above methods, the method comprising: Obtain the access request initiated by the first system service process against the second system service process, wherein the access request includes system call parameters; Read the value of the preset register when the first system service process is suspended, save the read value to the data structure associated with the first system service in memory, and load the system call parameters into the pre-agreed general-purpose register; Read the value of the preset register when the second system service process is suspended from the data structure associated with the second system service in memory, and load the read value into the preset register; Control of the central processing unit is transferred to the second system service process. The second system service process processes the access request according to the system call parameters recorded in the general-purpose register and saves the processing result to the general-purpose register. The processing result is used by the first system service process after it resumes operation. After processing the access request, the value of a pre-saved preset register (pre-stored when the first system service process is suspended) is read from the data structure associated with the first system service in memory, the read value is loaded into the preset register, and control of the central processing unit is transferred to the first system service process. In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program that, when executed by a processor, implements a microkernel inter-process communication method provided by the methods described above, the method comprising: Obtain the access request initiated by the first system service process against the second system service process, wherein the access request includes system call parameters; Read the value of the preset register when the first system service process is suspended, save the read value to the data structure associated with the first system service in memory, and load the system call parameters into the pre-agreed general-purpose register; Read the value of the preset register when the second system service process is suspended from the data structure associated with the second system service in memory, and load the read value into the preset register; Control of the central processing unit is transferred to the second system service process. The second system service process processes the access request according to the system call parameters recorded in the general-purpose register and saves the processing result to the general-purpose register. The processing result is used by the first system service process after it resumes operation. After completing the processing of the access request, the value of the preset register when the first system service process is suspended is read from the data structure associated with the first system service in memory, the read value is loaded into the preset register, and the control of the central processing unit is transferred to the first system service process.
[0064] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0065] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0066] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A microkernel-based inter-process communication method, characterized in that, The inter-process communication method includes: Obtain the access request initiated by the first system service process against the second system service process, wherein the access request includes system call parameters; Read the value of the preset register when the first system service process is suspended, save the read value to the data structure associated with the first system service in memory, and load the system call parameters into the pre-agreed general-purpose register; Read the value of the preset register when the second system service process is suspended from the data structure associated with the second system service in memory, and load the read value into the preset register; Control of the central processing unit is transferred to the second system service process. The second system service process processes the access request according to the system call parameters recorded in the general-purpose register and saves the processing result to the general-purpose register. The processing result is used by the first system service process after it resumes operation. After processing the access request, the value of the preset register when the first system service process is suspended is read from the data structure associated with the first system service in memory, the read value is loaded into the preset register, and the control of the central processing unit is transferred to the first system service process.
2. The inter-process communication method according to claim 1, characterized in that, After obtaining the access request initiated by the first system service process for the second system service process, the method further includes: Obtain the communication key carried in the call request, and verify the validity of the communication key according to the preset communication key agreed upon between the first system service process and the second system service process; If the verification result shows that the communication key is valid, it is determined that the first system service process has the permission to access the second system service process through the target mode, where the target mode is a mode that does not include permission verification. The step of reading the value of the preset register when the first system service process is suspended includes: If the first system service process has permission to access the second system service process through the target mode, read the value of the preset register when the first system service process is suspended.
3. The inter-process communication method according to claim 1, characterized in that, The preset registers include a stack pointer register, an instruction pointer register, and a page table register. Reading the value of the preset registers when the first system service process is suspended includes: Read the value recorded in the stack pointer register, which indicates the stack top position used when the first system service process was suspended; Read the value recorded in the instruction pointer register, which represents the address of the next instruction to be executed when the first system service process is suspended; Read the value of the page table recorded in the page table register, which points to the page table describing the virtual memory address space of the first system service process.
4. The inter-process communication method according to claim 2, characterized in that, Before obtaining the access request initiated by the first system service process for the second system service process, the method further includes: Obtain the registration request for the communication channel in the target mode sent by the second system service process; In response to the registration request, the preset communication key is generated based on the second system service process and the access permissions of the second system service process. The access permissions of the second system service process indicate that the first system service process is allowed to access the second system service process through the communication channel in the target mode. The preset communication key is assigned to the first system service process.
5. The inter-process communication method according to any one of claims 1-4, characterized in that, Both the first system service process and the second system service process are independent user-mode processes on the microkernel operating system.
6. A microkernel-based inter-process communication device, characterized in that, include: The first acquisition module is used to acquire an access request initiated by the first system service process against the second system service process, wherein the access request includes system call parameters; The storage module is used to read the value of a preset register when the first system service process is suspended, save the read value to a data structure associated with the first system service in memory, and load the system call parameters into a pre-agreed general-purpose register. The first loading module is used to read the value of the preset register when the second system service process is suspended from the data structure associated with the second system service in memory, and load the read value into the preset register; The processing module is used to transfer control of the central processing unit to the second system service process. The second system service process is used to process the access request according to the system call parameters recorded in the general-purpose register, and save the processing result to the general-purpose register. The processing result is used by the first system service process after it resumes operation. The second loading module is used to, after completing the processing of the access request, read the value of the preset register when the first system service process is suspended from the data structure associated with the first system service in memory, load the read value into the preset register, and transfer the control of the central processing unit to the first system service process.
7. The microkernel inter-process communication device according to claim 6, characterized in that, Also includes: The second acquisition module is used to acquire the communication key carried in the call request after the first system service process acquires the access request initiated by the second system service process, and to verify the validity of the communication key according to the preset communication key agreed upon between the first system service process and the second system service process. The determining module is used to determine, if the verification result shows that the communication key is valid, that the first system service process has the permission to access the second system service process through the target mode, wherein the target mode is a mode that does not include permission verification. The storage module includes: The first reading submodule is used to read the value of a preset register when the first system service process is suspended, provided that the first system service process has permission to access the second system service process through the target mode.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements a microkernel inter-process communication method as described in any one of claims 1 to 5.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a microkernel inter-process communication method as described in any one of claims 1 to 5.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements a microkernel inter-process communication method as described in any one of claims 1 to 5.
