Inter-Process Communication Method, Device, Internet of Things Operating System, and Internet of Things Device

By copying the target service code for inter-process communication to kernel space for execution in the Internet of Things operating system, the number of switching between user state and kernel state is reduced, and the efficiency and resource utilization of inter-process communication is improved.

CN114356591BActive Publication Date: 2025-07-11ALIBABA GROUP HOLDING LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011099580.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-14
Publication Date
2025-07-11
Estimated Expiration
2040-10-14

AI Technical Summary

Technical Problem

In the Internet of Things operating system, frequent switching between user states and kernel states is required when communicating between processes, resulting in inefficient communication.

Method used

By switching the first process from the user state to the kernel state, copying the target service code to the kernel space for execution, obtaining the result data, and then switching back to the user state, reducing the number of switching times between the user state and the kernel state.

Benefits of technology

Improves the efficiency of inter-process communication and reduces the use of system memory resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114356591B_ABST
    Figure CN114356591B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides an inter-process communication method, apparatus, Internet of Things operating system, and Internet of Things device. The method includes: when a first process calls a second process in user mode, switching the first process from the user mode to the kernel mode; determining target service code corresponding to the second process in the user space of the user mode; copying the target service code to the kernel space in the kernel mode; when executing service result data obtained by executing the target service code in the kernel mode, switching the first process from the kernel mode to the user mode, so that the first process obtains the service result data in the user mode. The embodiment of the present application reduces the occupation of system memory resources and improves the inter-process communication efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of computer technologies, and in particular, to an inter-process communication method, an inter-process communication device, an Internet of Things operating system, an Internet of Things device, an electronic device, and a storage medium. Background Art

[0002] In an Internet of Things operating system, during the process of a process performing IPC (Inter-Process Communication), since the user spaces of processes are independent of each other and cannot directly access each other, a process needs to switch back and forth between the user mode and the kernel mode to obtain the service result data of the process with which it communicates, so as to implement inter-process communication. It can be seen that currently, when performing inter-process communication, it is necessary to switch back and forth between the user mode and the kernel mode, and the inter-process communication efficiency is low. Summary of the Invention

[0003] Embodiments of the present application provide an inter-process communication method to improve the inter-process communication efficiency.

[0004] Correspondingly, embodiments of the present application further provide an inter-process communication device, an Internet of Things operating system, an Internet of Things device, an electronic device, and a storage medium to ensure the implementation and application of the above method.

[0005] To solve the above problems, embodiments of the present application disclose an inter-process communication method, and the method includes:

[0006] When a first process calls a second process in the user mode, switch the first process from the user mode to the kernel mode;

[0007] Determine the target service code corresponding to the second process in the user space of the user mode;

[0008] Copy the target service code to the kernel space in the kernel mode;

[0009] When executing the service result data obtained by executing the target service code in the kernel mode, switch the first process from the kernel mode to the user mode, so that the first process obtains the service result data in the user mode.

[0010] Optionally, the step of when a first process calls a second process in the user mode and switches the first process from the user mode to the kernel mode includes:

[0011] When a first process calls a second process in the user mode, trigger an interrupt instruction;

[0012] Based on the interrupt instruction, switch the first process from the user mode to the kernel mode.

[0013] Optionally, before the first process switches from the user mode to the kernel mode when the first process calls the second process in the user mode, the method further includes:

[0014] Obtain the context information of the first process, and save the context information to a specified user space in the user mode.

[0015] Optionally, when the first process obtains the service result data obtained by executing the service code in the kernel mode and switches from the kernel mode to the user mode, the first process obtaining the service result data in the user mode includes:

[0016] When obtaining the service result data obtained by executing the service code in the kernel mode, trigger an interrupt return instruction.

[0017] Based on the interrupt return instruction, switch the first process from the kernel mode to the user mode, so that the first process obtains the service result data in the user mode.

[0018] Optionally, the first process is used to obtain context information from a specified user space in the user mode, and restore to the state in the user mode before calling the second process, so as to obtain the service result data in the user mode.

[0019] Optionally, before the first process switches from the user mode to the kernel mode when the first process calls the second process in the user mode, the method further includes:

[0020] Set a specified kernel space in the kernel space of the kernel mode, where the specified kernel space is used to store target service code.

[0021] Optionally, the specified kernel space is set corresponding to different types of chips.

[0022] An embodiment of the present application also discloses an inter-process communication device, and the device includes:

[0023] A first switching module, configured to switch the first process from the user mode to the kernel mode when the first process calls the second process in the user mode;

[0024] A determination module, configured to determine target service code corresponding to the second process in the user space of the user mode;

[0025] A copy module, configured to copy the target service code to the kernel space of the kernel mode;

[0026] A second switching module, configured to switch the first process from the kernel mode to the user mode when executing service result data obtained by executing the target service code in the kernel mode, so that the first process obtains the service result data in the user mode.

[0027] An embodiment of the present application further discloses an Internet of Things operating system, including a first process and a second process. Among them, the first process is used for:

[0028] When calling the second process in the user mode, switch from the user mode to the kernel mode;

[0029] Determine the target service code in the user space of the second process in the user mode;

[0030] Copy the target service code to the kernel space in the kernel mode;

[0031] When executing service result data obtained by executing the target service code in the kernel mode, switch from the kernel mode to the user mode to obtain the service result data in the user mode.

[0032] An embodiment of the present application further discloses an Internet of Things device, including a first process and a second process. Among them, the first process is used for:

[0033] When calling the second process in the user mode, switch from the user mode to the kernel mode;

[0034] Determine the target service code in the user space of the second process in the user mode;

[0035] Copy the target service code to the kernel space in the kernel mode;

[0036] When executing service result data obtained by executing the target service code in the kernel mode, switch from the kernel mode to the user mode to obtain the service result data in the user mode.

[0037] An embodiment of the present application further discloses an electronic device, including: a processor; and a memory, on which executable code is stored. When the executable code is executed, the processor is caused to execute one or more of the methods in the embodiments of the present application.

[0038] An embodiment of the present application further discloses one or more machine-readable media, on which executable code is stored. When the executable code is executed, the processor is caused to execute one or more of the methods in the embodiments of the present application.

[0039] Compared with the prior art, the embodiments of the present application have the following advantages:

[0040] In the embodiment of the present application, when the first process calls the second process in the user mode, it switches from the user mode to the kernel mode, and copies the target service code in the user space of the second process in the user mode to the kernel space in the kernel mode. After obtaining the service result data by executing the target service code in the kernel mode, it switches from the kernel mode to the user mode, so that the first process obtains the service result data of the second process in the user mode, realizing the communication between the first process and the second process. Since the target service code of the second process in the embodiment of the present application is executed in the kernel mode, the number of switches between the user mode and the kernel mode of the first process is reduced, and at the same time, the occupation of system memory resources is reduced, improving the inter-process communication efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions of the present application, the accompanying drawings required for the description of the present application will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0042] Figure 1 is a flowchart of the steps of an embodiment of an inter-process communication method of the present application;

[0043] Figure 2 is a schematic structural diagram of an inter-process communication architecture of the present application;

[0044] Figure 3 is a schematic diagram of implementing inter-process communication in a related solution;

[0045] Figure 4 is a schematic diagram of implementing inter-process communication of the present application;

[0046] Figure 5 is a block diagram of the structure of an embodiment of an inter-process communication device of the present application;

[0047] Figure 6 is a schematic structural diagram of a device provided in an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0048] To make the above objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0049] Refer to Figure 1 , which shows a flowchart of the steps of an embodiment of an inter-process communication method of the present application, and specifically may include the following steps:

[0050] Step 102, when the first process calls the second process in the user mode, switch the first process from the user mode to the kernel mode.

[0051] Among them, the embodiments of the present invention can be applied to the Internet of Things operating system. Specifically, it can be applied to Internet of Things devices such as shared cars, smart homes, mobile phones, and tablets.

[0052] In a specific implementation, an application has a corresponding process. A process is a running activity for implementing various functions of the application. Therefore, the communication between applications can be regarded as inter-process communication. Among them, since the resources of operating systems such as the Internet of Things operating system are limited, if there are too many operations to access resources, it will inevitably consume too many resources. If these operations are not distinguished, it is very likely to cause conflicts in resource access. Therefore, in order to reduce the access and usage conflicts of limited resources, different execution levels are assigned to different operations.

[0053] In the Internet of Things operating system, there are two running levels: user mode (Kernel mode) and kernel mode (Usermode), which are used to distinguish the execution levels of different processes. Specifically, the kernel mode is a state with more resources, or a state with more access to resources, so it is also called the privileged state. Relatively speaking, the user mode is a non-privileged state, and the accessed resources will be restricted. If a process runs in the kernel mode, the process can access any resource of the computer, and its resource access permission is not restricted. However, if a process runs in the user mode, its resource requirements will be restricted in various ways. For example, access operations such as reading data from the hard disk or obtaining input from the keyboard need to enter the kernel mode. If you want to access data in the application, such as chat data, it can be done in the user mode without entering the kernel mode. Among them, the user mode has a corresponding user space, and the kernel mode has a corresponding kernel space. When a process runs in the kernel space, it is in the kernel mode, and when the process runs in the user space, it is in the user mode.

[0054] Each process has its own user space in the user mode. The global variables of any process cannot be obtained in another process. Therefore, to exchange data between processes, it is necessary to enter the kernel mode, that is, inter-process communication needs to be carried out in the kernel mode. In the embodiment of the present application, the first process is the calling process, and the second process is the called process. When the first process needs to call the second process in the user mode, that is, when the first process and the second process perform inter-process communication, the first process is switched from the user mode to the kernel mode.

[0055] In an embodiment of the present application, step 102 may include the following steps: when the first process calls the second process in the user mode, an interrupt instruction is triggered; based on the interrupt instruction, the first process is switched from the user mode to the kernel mode.

[0056] In an embodiment of the present application, when the first process calls the second process, an interrupt instruction is triggered, so that the first process switches from the user mode to the kernel mode based on the interrupt instruction. The first process can switch to the kernel mode through system calls. Specifically, embodiments of the present invention can use other methods such as a software interrupt instruction like int 80H, so as to switch the first process from the user mode to the kernel mode.

[0057] Among them, each process has two stacks, a kernel-mode stack and a user-mode stack, which are stored in the kernel space and the user space respectively. When switching from the user mode to the kernel mode, stack switching is required, from the user stack to the kernel stack.

[0058] Step 104, determine the target service code corresponding to the second process in the user space of the user mode.

[0059] In an embodiment of the present application, the target service code is a piece of program code in the user space of the user mode of the second process, that is, the program code corresponding to the service result data that the first process hopes to obtain from the second process. Among them, the target service code of the second process is saved in the user space of the second process.

[0060] Step 106, copy the target service code to the kernel space of the kernel mode.

[0061] In an embodiment of the present application, after determining the target service code, the target service code can be read from the user space and then copied (service map) to the kernel space of the kernel mode. Among them, the hardware real-time synchronization mechanism for implementing the copying of the target service code can be diverse, and embodiments of the present application do not limit this. For example, an optional implementation solution is to use DMA (Direct Memory Access) to continuously copy and synchronize from the target service code to the kernel space of the kernel mode.

[0062] In an embodiment of the present application, the method may further include the following steps: set a specified kernel space in the kernel space of the kernel mode, and the specified kernel space is used to store the target service code.

[0063] In specific implementation, a specified kernel space is set in the kernel space of the kernel mode, and this specified kernel space is specifically used to store the target service code of the process. It should be noted that the specified kernel space in the kernel mode of the embodiments of the present application is set corresponding to different types of chips. This is because different processes are program codes written by different users. Therefore, in theory, target service codes of any size may appear. If all the processes written by users are to be satisfied, then a sufficiently large kernel space needs to be customized in the kernel mode. However, if the occupied kernel space is too large, it will lead to low resource utilization.

[0064] Therefore, in the embodiments of the present application, for different types of chips in advance, program characteristics running on different types of chips are collected and analyzed, commonalities are extracted, and thus a most reasonable kernel space is analyzed and obtained as the specified kernel space, so as to ensure the normal use of most users without occupying too many resources.

[0065] Step 108, when executing the service result data obtained by executing the target service code in the kernel mode, switch the first process from the kernel mode to the user mode, so that the first process obtains the service result data in the user mode.

[0066] In the embodiments of the present application, after copying the target service code of the second process to the kernel space in the kernel mode, the target service code can be executed in the kernel mode to obtain the corresponding service result data. After obtaining the service result data, the first process is switched from the kernel mode to the user mode again.

[0067] In an embodiment of the present application, step 108 may include the following steps: when executing the service result data obtained by executing the target service code in the kernel mode, trigger an interrupt return instruction, and based on the interrupt return instruction, switch the first process from the kernel mode to the user mode, so that the first process obtains the service result data in the user mode.

[0068] In the embodiments of the present application, after obtaining the service result data of the target service code in the kernel mode, an interrupt return instruction can be triggered, and then the first process can be switched from the kernel mode to the user mode based on the interrupt return instruction. After switching the first process from the kernel mode to the user mode, the first process can obtain the service result data of the target service code of the second process in the user mode.

[0069] In an embodiment of the present application, before step 102, the method may further include the following steps: obtain the context information of the first process and save the context information to a specified user space in the user mode.

[0070] Among them, before the first process enters the kernel mode, it is necessary to save the scene first, and then switch from the user mode to the kernel mode, so that after the execution in the kernel mode is completed, it can return to the user mode to restore the scene. Specifically, before the first process enters the kernel mode, obtain the information related to the scene of the first process, that is, the context information. Among them, the context information may include information in general-purpose registers, floating-point registers, address space registers (ttbr0_el1 and ttbr1_el1), and other registers. Save the context information of the foregoing registers to the specified user space, and then refresh the values in the registers, and execute the first process in the kernel mode.

[0071] In an embodiment of the present application, the first process is used to obtain context information from a specified user space in the user state, and restore to the state in the user state before calling the second process, so that the first process obtains the service result data in the user state.

[0072] After the first process finishes executing in the kernel state, it will switch from the kernel state to the user state. At this time, the previously saved context information can be obtained from the specified user space and written back to the corresponding register, so as to restore to the state before entering the kernel state. Then, the service result data can be obtained in the user state, realizing inter-process communication between the first process and the second process.

[0073] In an embodiment of the present application, when the first process calls the second process in the user state, the first process is switched from the user state to the kernel state, and the target service code in the user space of the second process in the user state is copied to the kernel space in the kernel state. After obtaining the service result data by executing the target service code in the kernel state, it is switched from the kernel state to the user state, so that the first process obtains the service result data of the second process in the user state, realizing communication between the first process and the second process. Since the target service code of the second process in the embodiment of the present application is executed in the kernel state, the number of switches between the user state and the kernel state of the first process is reduced, and at the same time, the occupation of system memory resources is reduced, improving the inter-process communication efficiency.

[0074] To better illustrate the embodiments of the present application, specific examples are used for illustration below. Refer to Figure 2 , which is a schematic diagram of the architecture of inter-process communication of the present application. In an Internet of Things operating system, the Internet of Things operating system includes a user state and a kernel state, and may include a first process and a second process. The first process and the second process cannot directly communicate in the user state. Therefore, when the first process calls the second process, it first determines the target service code corresponding to the service result data of the second process to be called, maps the target service code to the kernel state, then switches the first process to the kernel state, and calls the target service code in the kernel state to obtain the service result data. Thus, after switching the first process back to the user state, the service result data of the second process can be obtained in the user state.

[0075] Refer to Figure 3, shown is a schematic diagram of current inter - process communication, including a first process (P1), a second process (P2), and the target service code (service) of P2. In the related solution, P1 often needs to enter the kernel mode to execute in the kernel mode. When P1 needs to perform inter - process communication with P2, it returns to the user mode to execute the service result data of P2's service, then enters the kernel mode again. P1 obtains the service result data in the kernel mode, and finally P1 switches back to the user mode to obtain the service result data in the user mode. It can be seen that in the related solution, in order to achieve inter - process communication, multiple user - mode and kernel - mode switches are required, resulting in a large amount of resource occupation and very low efficiency.

[0076] Referring to Figure 4 , shown is a schematic diagram of an inter - process communication implementation of the present application, including a first process (P1), a second process (P2), and the target service code (service) of P2. In the embodiment of the present application, when P1 needs to perform inter - process communication with P2, it needs to enter the kernel mode, and at the same time copy P2's service to the kernel space, then execute P2's service in the kernel mode to obtain the service result data, and then switch to the user mode. P1 can obtain the service result data of P2's service in the user mode. It can be seen that in the embodiment of the present application, inter - process communication only needs to perform a system call, enter the kernel mode, directly run the target service code in the kernel mode, and then return to the user mode after obtaining the service result data of the target service code in the kernel mode, avoiding multiple user - mode and kernel - mode switches, not only occupying less resources, but also improving the operation efficiency.

[0077] In summary, in the embodiment of the present application, the first process starts running in the user mode and uses the user stack. When performing inter - process communication with the second process, the target service code of the second process is transferred to the kernel mode, so that it can switch to the kernel stack to execute the target service code. After executing the target service code, the first process returns to the user mode, so that the first process can obtain the service result data of the target service code in the user mode. The embodiment of the present application occupies a small amount of kernel space, so that it can utilize the underlying hardware characteristics of the chip to achieve the exchange of program operation efficiency through the kernel space.

[0078] It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present application are not limited by the described action sequence, because according to the embodiments of the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential for the embodiments of the present application.

[0079] Based on the above embodiments, an inter-process communication device is further provided in an embodiment of the present application, which is applied to electronic devices of the Internet of Things operating system such as Internet of Things devices and servers.

[0080] Referring to Figure 5 , a structural block diagram of an embodiment of an inter-process communication device of the present application is shown, which may specifically include the following modules:

[0081] The first switching module 502 is configured to switch the first process from the user mode to the kernel mode when the first process calls the second process in the user mode;

[0082] The determination module 504 is configured to determine the target service code corresponding to the second process in the user space of the user mode;

[0083] The copy module 506 is configured to copy the target service code to the kernel space in the kernel mode;

[0084] The second switching module 508 is configured to switch the first process from the kernel mode to the user mode when executing the service result data obtained by the target service code in the kernel mode, so that the first process obtains the service result data in the user mode.

[0085] Optionally, the first switching module 502 includes: an interrupt instruction triggering sub-module, configured to trigger an interrupt instruction when the first process calls the second process in the user mode; a first switching sub-module, configured to switch the first process from the user mode to the kernel mode based on the interrupt instruction.

[0086] Optionally, the device further includes: a saving module, configured to obtain the context information of the first process and save the context information to a specified user space in the user mode.

[0087] Optionally, the second switching module 508 includes: an interrupt return instruction triggering sub-module, configured to trigger an interrupt return instruction when executing the service result data obtained by the service code in the kernel mode; a second switching sub-module, configured to switch the first process from the kernel mode to the user mode based on the interrupt return instruction, so that the first process obtains the service result data in the user mode.

[0088] Optionally, the first process obtains the service result data in the user mode, including: obtaining the context information for the first process from a specified user space in the user mode; the first process restores to the state in the user mode before the first process calls the second process according to the context information, so that the first process obtains the service result data in the user mode.

[0089] Optionally, the device further includes: a specified kernel space setting module, configured to set a specified kernel space in the kernel space of the kernel mode, where the specified kernel space is used to store target service code.

[0090] Optionally, the specified kernel space is correspondingly set based on different types of chips.

[0091] In summary, in the embodiment of the present application, when the first process calls the second process in the user mode, it switches from the user mode to the kernel mode, copies the target service code in the user space of the second process in the user mode to the kernel space of the kernel mode, and after obtaining the service result data by executing the target service code in the kernel mode, it switches from the kernel mode to the user mode, so that the first process obtains the service result data of the second process in the user mode, realizing communication between the first process and the second process. Since the target service code of the second process in the embodiment of the present application is executed in the kernel mode, the number of switches between the user mode and the kernel mode of the first process is reduced, and at the same time, the occupation of system memory resources is reduced, improving the inter-process communication efficiency.

[0092] The embodiment of the present application further provides an Internet of Things operating system, including a first process and a second process, where the first process is configured to:

[0093] When calling the second process in the user mode, switch from the user mode to the kernel mode;

[0094] Determine the target service code in the user space of the second process in the user mode;

[0095] Copy the target service code to the kernel space of the kernel mode;

[0096] When obtaining the service result data by executing the target service code in the kernel mode, switch from the kernel mode to the user mode to obtain the service result data in the user mode.

[0097] The embodiment of the present application further provides an Internet of Things device, including a first process and a second process, where the first process is configured to:

[0098] When calling the second process in the user mode, switch from the user mode to the kernel mode;

[0099] Determine the target service code in the user space of the second process in the user mode;

[0100] Copy the target service code to the kernel space of the kernel mode;

[0101] When obtaining the service result data by executing the target service code in the kernel mode, switch from the kernel mode to the user mode to obtain the service result data in the user mode.

[0102] An embodiment of the present application also provides a non-volatile readable storage medium, in which one or more modules (programs) are stored. When the one or more modules are applied to a device, the device can be caused to execute instructions (instructions) for each method step in the embodiments of the present application.

[0103] Embodiments of the present application provide one or more machine-readable media, on which instructions are stored. When executed by one or more processors, an electronic device is caused to execute one or more of the methods as described in the above embodiments. In the embodiments of the present application, the electronic device includes various types of devices such as terminal devices, servers (clusters), etc.

[0104] Embodiments of the present disclosure can be implemented as a device configured with any suitable hardware, firmware, software, or any combination thereof. The device may include electronic devices such as terminal devices, servers (clusters), etc. Figure 6 Exemplary device 600 that can be used to implement the various embodiments described in the present application is schematically shown.

[0105] For one embodiment, Figure 5 Exemplary device 600 is shown, which has one or more processors 602, a control module (chipset) 604 coupled to at least one of the (one or more) processors 602, a memory 606 coupled to the control module 604, a non-volatile memory (NVM) / storage device 608 coupled to the control module 604, one or more input / output devices 610 coupled to the control module 604, and a network interface 612 coupled to the control module 604.

[0106] Processor 602 may include one or more single-core or multi-core processors, and processor 602 may include any combination of general-purpose processors or dedicated processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, device 600 can function as the terminal device, server (cluster), etc. described in the embodiments of the present application.

[0107] In some embodiments, device 600 may include one or more computer-readable media (such as memory 606 or NVM / storage device 608) having instructions 614, and one or more processors 602 combined with the one or more computer-readable media and configured to execute instructions 614 to implement modules and thus perform the actions described in the present disclosure.

[0108] For one embodiment, the control module 604 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 602 and / or any suitable device or component communicating with the control module 604.

[0109] The control module 604 may include a memory controller module to provide an interface to the memory 606. The memory controller module can be a hardware module, a software module, and / or a firmware module.

[0110] The memory 606 may be used, for example, to load and store data and / or instructions 614 for the device 600. For one embodiment, the memory 606 may include any suitable volatile memory, e.g., suitable DRAM. In some embodiments, the memory 606 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).

[0111] For one embodiment, the control module 604 may include one or more input / output controllers to provide an interface to the NVM / storage device 608 and the input / output device(s) 610.

[0112] For example, the NVM / storage device 608 may be used to store data and / or instructions 614. The NVM / storage device 608 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact discs (CDs) drives, and / or one or more digital versatile discs (DVDs) drives).

[0113] The NVM / storage device 608 may include storage resources that are physically part of a device on which the device 600 is mounted, or it may be accessible by the device without being part of the device. For example, the NVM / storage device 608 may be accessed via the input / output device(s) 610 over a network.

[0114] The input / output device(s) 610 may provide an interface for the device 600 to communicate with any other suitable device. The input / output device 610 may include communication components, audio components, sensor components, etc. The network interface 612 may provide an interface for the device 600 to communicate over one or more networks. The device 600 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, e.g., access a wireless network based on a communication standard such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication.

[0115] For one embodiment, at least one of the (one or more) processors 602 may be logically packaged with one or more controllers (e.g., memory controller modules) of the control module 604. For one embodiment, at least one of the (one or more) processors 602 may be logically packaged with one or more controllers of the control module 604 to form a system-in-package (SiP). For one embodiment, at least one of the (one or more) processors 602 may be logically integrated with one or more controllers of the control module 604 on the same die. For one embodiment, at least one of the (one or more) processors 602 may be logically integrated with one or more controllers of the control module 604 on the same die to form a system-on-chip (SoC).

[0116] In various embodiments, the device 600 can be, but is not limited to, a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.) and other terminal devices. In various embodiments, the device 600 may have more or fewer components and / or a different architecture. For example, in some embodiments, the device 600 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application specific integrated circuit (ASIC), and a speaker.

[0117] Among them, a main control chip can be used as the processor or control module in the detection device, sensor data, location information, etc. are stored in the memory or NVM / storage device, the sensor group can be used as an input / output device, and the communication interface can include a network interface.

[0118] For the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For the relevant parts, refer to the partial description of the method embodiments.

[0119] Each embodiment in this specification is described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, refer to each other.

[0120] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as the combination of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal devices generate for implementation in the processFigure 1 one or more processes and / or blocks Figure 1 means for the functions specified in one or more blocks

[0121] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including an instruction means that implements the processes Figure 1 one or more processes and / or blocks Figure 1 the functions specified in one or more blocks

[0122] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, such that a series of operation steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable terminal device provide for implementing the processes Figure 1 one or more processes and / or blocks Figure 1 the steps of the functions specified in one or more blocks

[0123] Although the preferred embodiments of the embodiments of the present application have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application

[0124] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or terminal device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "including an..." does not exclude the presence of additional identical elements in the process, method, article or terminal device including the said element

[0125] The above has introduced in detail a method and apparatus for inter-process communication, an Internet of Things operating system, an Internet of Things device, an electronic device, and a storage medium provided by the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation on the present application.

Claims

1. An inter-process communication method, characterized in that, The method includes: When the first process calls the second process in user mode, switching the first process from the user mode to the kernel mode; the first process and the second process each have different user spaces in the user mode; Determining the target service code corresponding to the second process in the user space of the user mode, where the target service code is the program code corresponding to the service result data that the first process expects to obtain from the second process; Copying the target service code to the kernel space in the kernel mode; When executing the service result data obtained by executing the target service code in the kernel mode, switching the first process from the kernel mode to the user mode, so that the first process obtains the service result data in the user mode.

2. The method according to claim 1, characterized in that The step of "when the first process calls the second process in user mode, switching the first process from the user mode to the kernel mode" includes: When the first process calls the second process in user mode, triggering an interrupt instruction; Based on the interrupt instruction, switching the first process from the user mode to the kernel mode.

3. The method according to claim 1, wherein Before the step of "when the first process calls the second process in user mode, switching the first process from the user mode to the kernel mode", the method further includes: Obtaining the context information of the first process and saving the context information to a specified user space in the user mode.

4. The method according to claim 3, characterized in that, The step of "when executing the service result data obtained by executing the service code in the kernel mode, switching the first process from the kernel mode to the user mode, so that the first process obtains the service result data in the user mode" includes: When executing the service result data obtained by executing the service code in the kernel mode, triggering an interrupt return instruction, Based on the interrupt return instruction, switching the first process from the kernel mode to the user mode, so that the first process obtains the service result data in the user mode.

5. The method according to claim 3 or 4, characterized in that, The first process is used to obtain context information from a specified user space in the user mode and restore to the state in the user mode before the first process calls the second process, so as to obtain the service result data in the user mode.

6. The method according to claim 1, characterized in that, Before the step of "when the first process calls the second process in user mode, switching the first process from the user mode to the kernel mode", the method further includes: Setting a specified kernel space in the kernel space of the kernel mode, where the specified kernel space is used to store the target service code.

7. The method according to claim 6, characterized in that, The specified kernel space is set corresponding to different types of chips.

8. An inter-process communication device, characterized in that, The device includes: A first switching module, configured to switch the first process from the user mode to the kernel mode when the first process calls the second process in the user mode; the first process and the second process each have different user spaces in the user mode; A determining module, configured to determine the target service code corresponding to the second process in the user space of the user mode, where the target service code is the program code corresponding to the service result data that the first process expects to obtain from the second process; A copying module, configured to copy the target service code to the kernel space in the kernel mode; A second switching module for switching the first process from the kernel mode to the user mode when executing the service result data obtained by executing the target service code in the kernel mode, so that the first process obtains the service result data in the user mode.

9. An Internet of Things operating system, characterized in that, Comprising a first process and a second process, wherein the first process is configured to: When calling the second process in the user mode, switch from the user mode to the kernel mode; the first process and the second process each have different user spaces in the user mode; Determine the target service code in the user space of the second process in the user mode, where the target service code is the program code corresponding to the service result data that the first process expects to obtain from the second process; Copy the target service code to the kernel space in the kernel mode; When executing the service result data obtained by executing the target service code in the kernel mode, switch from the kernel mode to the user mode to obtain the service result data in the user mode.

10. An Internet of Things device, characterized in that, Comprising a first process and a second process, wherein the first process is configured to: When calling the second process in the user mode, switch from the user mode to the kernel mode; the first process and the second process each have different user spaces in the user mode; Determine the target service code in the user space of the second process in the user mode, where the target service code is the program code corresponding to the service result data that the first process expects to obtain from the second process; Copy the target service code to the kernel space in the kernel mode; When executing the service result data obtained by executing the target service code in the kernel mode, switch from the kernel mode to the user mode to obtain the service result data in the user mode.

11. An electronic device, characterized in that, Comprising: A processor; And A memory storing executable code, which when executed causes the processor to execute the method according to one or more of claims 1-8.

12. One or more machine-readable media storing executable code, which when executed causes a processor to execute the method according to one or more of claims 1-8.

Citation Information

Patent Citations

  • Dynamic running method for security kernel service of tristate operating system in Feiteng CPU

    CN105022954A