Inter-process communication method and device, electronic equipment and storage medium

By setting up shared storage space in the operating system and using precompiled associated scripts, the cumbersome data transmission and resource utilization problems of Electron inter-process communication are solved, efficient inter-process communication is achieved, and system power consumption is reduced.

CN119201486APending Publication Date: 2024-12-27VISIONVERA INFORMATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411078609.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

Electron's inter-process communication has limitations, data transmission between the main process and the child process is cumbersome, and the communication method based on CPU and memory increases system resource usage and power consumption.

Method used

By setting up a shared storage space in the operating system, storing the target data to be transmitted, and reading data from the space when needed, using precompiled associated scripts for data transmission, the direct occupation of CPU and memory is avoided, and the main process is realized Direct communication with child processes.

Benefits of technology

It reduces the system resource usage and power consumption, improves the efficiency of communication between processes, and realizes direct data transmission between the main process, child process and child process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201486A_ABST
    Figure CN119201486A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an inter-process communication method and device, electronic equipment and a storage medium. The method comprises the following steps: storing target data to be transmitted among processes in a shared storage space in the operating system; and when any process needs to call data, reading corresponding target data from the shared storage space. According to the embodiment of the invention, the communication between the host process and the sub-processes under the inter-process communication condition can be realized, the communication between the sub-processes can also be realized, and meanwhile, the power consumption of the system can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of inter-process communication, and in particular to an inter-process communication method, device, electronic device and storage medium. Background Art

[0002] Electron is a cross-platform desktop application framework built using JavaScript, HTML, and CSS. For the Electron desktop application framework, it communicates through IPC (Inter-Process Communication). However, IPC communication has data transmission limitations. Data can only be transmitted between the main process and the child process. Data transmission between child processes requires the main process as a transit station, that is, the child process sends data to the main process, and then the main process sends the data to another child process. The data transmission process is cumbersome. At the same time, IPC is a communication method based on CPU (Central Processing Unit) and memory. The cumbersome data transmission process increases the occupation of system resources and increases the power consumption of the system. Summary of the invention

[0003] In view of the above problems, embodiments of the present application are proposed to provide an inter-process communication method, device, electronic device and storage medium that overcome the above problems or at least partially solve the above problems.

[0004] In a first aspect, an embodiment of the present application provides an inter-process communication method, which is applied to an operating system installed in an electronic device, and the method includes:

[0005] Storing target data to be transmitted between processes in a shared storage space within the operating system;

[0006] When any process needs to call data, the corresponding target data is read from the shared storage space.

[0007] Optionally, the method further comprises:

[0008] Obtaining a pre-compiled association script associated with the shared storage space, wherein the association script is used to assist a process in reading corresponding target data from the shared storage space;

[0009] Storing the associated script in a preset file;

[0010] After the process is created, the script import component is called to read the associated script from the preset file and import the associated script into the process.

[0011] Optionally, a process identifier of a corresponding process is stored in a designated data bit of the target data.

[0012] When any process needs to call data, reading corresponding target data from the shared storage space includes:

[0013] The data in the shared storage space containing the process identifier of the target process is determined as target data, and the target process reads the target data.

[0014] Optionally, determining the data in the shared storage space containing the process identifier of the target process as the target data, and the target process reading the target data, includes:

[0015] Sending instruction information for reading the target data to the target process;

[0016] The target process is called to read the target data from the shared storage space according to the indication information.

[0017] Optionally, the operating system is a Vue system, and correspondingly, the shared storage space includes a Vue state management library.

[0018] Optionally, the process includes at least any one of a main process and a sub-process.

[0019] Optionally, the method further comprises:

[0020] Obtaining a process status of the process;

[0021] In a case where the process status indicates that the process is in a dormant state, waking up the process.

[0022] In a second aspect, an embodiment of the present application provides an inter-process communication device, which is applied to an operating system installed in an electronic device, and the device includes:

[0023] A target data storage module, used for storing target data to be transmitted between processes in a shared storage space within the operating system;

[0024] The target data reading module is used to read the corresponding target data from the shared storage space when any process needs to call data.

[0025] Optionally, the device further comprises:

[0026] An associated script acquisition module, used to acquire a pre-compiled associated script associated with the shared storage space, wherein the associated script is used to assist a process in reading corresponding target data from the shared storage space;

[0027] An associated script storage module, used for storing the associated script in a preset file;

[0028] The associated script import module is used to call the script import component to read the associated script from the preset file and import the associated script into the process after the process is created.

[0029] Optionally, a process identifier of a corresponding process is stored in a designated data bit of the target data.

[0030] The target data reading module comprises:

[0031] The target data reading unit is used to determine the data containing the process identifier of the target process in the shared storage space as the target data, and the target process reads the target data.

[0032] Optionally, the target data reading unit includes:

[0033] an indication information sending subunit, used for sending indication information for reading the target data to the target process;

[0034] The target data reading subunit is used to call the target process to read the target data from the shared storage space according to the indication information.

[0035] Optionally, the operating system is a Vue system, and correspondingly, the shared storage space includes a Vue state management library.

[0036] Optionally, the process includes at least any one of a main process and a sub-process.

[0037] Optionally, the device further comprises:

[0038] A process status acquisition module, used to acquire the process status of the process;

[0039] The process awakening module is used to awaken the process when the process status indicates that the process is in a dormant state.

[0040] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0041] one or more processors; and

[0042] One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, enable the device to perform any of the above-mentioned inter-process communication methods.

[0043] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program that enables a processor to execute any of the above-mentioned inter-process communication methods.

[0044] The embodiments of the present application include the following advantages:

[0045] The solution provided by the embodiment of the present application is to store the target data to be transmitted between each process in the shared storage space in the operating system, and when any process needs to call data, the corresponding target data is read from the shared storage space. The embodiment of the present application installs an operating system in an electronic device, and stores the data sent by each process in the IPC communication mode in the shared storage space of the operating system, thereby realizing communication between the main process and the sub-process, and between the sub-process and the sub-process. At the same time, IPC communication based on the operating system will not cause the occupation of the CPU and memory, avoid the occupation of the system resources of the electronic device, and effectively reduce the power consumption of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A flowchart of an inter-process communication method provided in an embodiment of the present application;

[0047] Figure 2 A flowchart of a process wake-up method provided in an embodiment of the present application;

[0048] Figure 3 A flowchart of a method for importing an associated script provided in an embodiment of the present application;

[0049] Figure 4 A flowchart of a method for reading target data provided by an embodiment of the present application;

[0050] Figure 5 A block diagram of a component import IPC process provided in an embodiment of the present application;

[0051] Figure 6 A schematic diagram of data flow in an inter-process communication mode provided in an embodiment of the present application;

[0052] Figure 7 A schematic diagram of the structure of an inter-process communication device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0054] Reference Figure 1 , shows a flowchart of the steps of an inter-process communication method provided by an embodiment of the present application, which is applied to an operating system installed in an electronic device. Figure 1 As shown, the inter-process communication method may include: step 101, step 102 and step 103.

[0055] Step 101: Storing target data to be transmitted between processes in a shared storage space within the operating system.

[0056] The embodiments of the present application can be applied to an operating system installed in an electronic device, that is, the execution subject is an operating system. In this example, the operating system can be, but is not limited to, a Vue system. Vue is a progressive JavaScript framework for building user interfaces. The Vue system is a powerful, flexible and easy-to-use front-end framework that provides developers with an efficient and convenient development experience through progressive design, responsive data binding, two-way data binding, component-based development and other features.

[0057] This embodiment can be applied to the inter-process communication scenario, where inter-process communication is IPC communication. IPC communication refers to a communication mechanism for transmitting data or signals between two or more processes (or threads).

[0058] Shared storage space refers to the data storage space in the operating system used to store data when transferring data between processes. In the specific implementation, when the operating system is a Vue system, the system state management library is the Vuex state management library. The system state management library refers to a library used to centrally manage the state of all components of an application. Vuex is a state management mode and library developed specifically for Vue.js applications. It uses centralized storage to manage the state of all components of the application, and uses corresponding rules to ensure that the state changes in a predictable way.

[0059] In this example, when performing inter-process communication, the state of the process (i.e., sleep state or wake-up state) can be obtained first. If the process is in sleep state, the process can be woken up to perform inter-process communication. Figure 2 This is described in detail as follows.

[0060] Reference Figure 2 , shows a flowchart of a process wake-up method provided by an embodiment of the present application. Figure 2 As shown, the process awakening method may include: step 201 and step 202.

[0061] Step 201: Obtain the process status of the process.

[0062] In this embodiment, when it is necessary to use a process for communication, the process status of the process can be obtained. For example, when it is necessary to use the main process, sub-process 1, sub-process 2, and sub-process 3 for communication, the process status of the main process, sub-process 1, sub-process 2, and sub-process 3 can be obtained, that is, it is determined whether the main process, sub-process 1, sub-process 2, and sub-process 3 are in a dormant state or in an awake state.

[0063] After the process status of the process is obtained, step 202 is executed.

[0064] Step 202: When the process status indicates that the process is in a dormant state, wake up the process.

[0065] After the process status of the process is obtained, it can be determined whether the process is in a dormant state according to the process status. If the process status indicates that the process is in a dormant state, the process is awakened. Specifically, it can include at least one of the following situations.

[0066] 1. When the process status indicates that all processes of the inter-process communication are in a dormant state, all processes of the inter-process communication can be woken up at the same time.

[0067] 2. When the process status indicates that some of all processes in the inter-process communication are in a dormant state, some of the dormant processes can be awakened.

[0068] It can be understood that in the case where all processes of the inter-process communication are in the awake state, no processing is required and the inter-process communication can be directly performed.

[0069] The embodiment of the present application can reduce the resource occupation of the operating system by the idle process by waking up the process for data communication when the process is in use, and control the process to be in a dormant state when the process is idle, thereby improving the resource utilization rate of the operating system. At the same time, the operating system can perform the process wake-up operation, avoiding the CPU of the electronic device from performing the wake-up operation, thereby reducing the power consumption of the CPU.

[0070] When performing inter-process communication, the target data to be transmitted between each process can be obtained and stored in a shared storage space in the operating system. The embodiment of the present application can reduce the occupation of device memory by storing the data to be transmitted between processes in a shared storage space without occupying the device memory of the electronic device.

[0071] In this embodiment, the process for performing inter-process communication may include at least one of a main process and a sub-process. In this example, the type of the process for performing inter-process communication may include at least one of the following:

[0072] 1. The processes for inter-process communication are: the main process and at least one child process.

[0073] 2. The process for inter-process communication is: at least two child processes.

[0074] It can be understood that when a process is created, a script code supporting the shared storage space of the operating system can be imported into the process, and the script code can be used to implement data transmission from the process to the shared storage space. Figure 3 This is described in detail as follows.

[0075] Reference Figure 3 , shows a flowchart of the steps of an associated script import method provided by an embodiment of the present application. Figure 3 As shown, the associated script import method may include: step 301, step 302 and step 303.

[0076] Step 301: Obtain a pre-compiled association script associated with the shared storage space, wherein the association script is used to assist a process in reading corresponding target data from the shared storage space.

[0077] In this embodiment, business personnel can pre-compile an association script associated with the shared storage space. The association script can be used to assist the process in reading the corresponding target data from the shared storage space. At the same time, the association script can also be used to instruct the process to send data to the shared storage space for storage.

[0078] After the pre-compiled associated script associated with the shared storage space is obtained, step 302 is executed.

[0079] Step 302: Store the associated script in a preset file.

[0080] The preset file can be a specified file in the Vue system for storing associated scripts.

[0081] After the pre-compiled associated script associated with the shared storage space is obtained, the associated script may be stored in a preset file.

[0082] Step 303: After the process is created, the script import component is called to read the associated script from the preset file and import the associated script into the process.

[0083] The script import component refers to a component in the operating system used to import associated scripts into a process.

[0084] After the process is created, the script import component can be called to read the associated script from the preset file and import the associated script into the process. Specifically, the associated script can be added to the IPC module of the IPC process (i.e., the main entrance of the IPC process). Figure 5As shown, the created processes include: IPC main process, IPC sub-process 1, ..., IPC sub-process n (n is a positive integer), and the script code associated with Vuex state management can be imported into the IPC main process, IPC sub-process 1, ..., IPC sub-process n by means of component import, so as to realize the association of Vuex state management with each IPC process, and then the export function can be used in Vuex state management to expose the data of inter-process communication to the main framework of the operating system, so as to realize data communication between IPC processes.

[0085] The embodiment of the present application imports the script code associated with the shared storage space into the process in advance, so that when the processes communicate, the sent data can be directly sent to the shared storage space for storage, and the data can be read from the shared storage space. This not only enables direct communication between parent-child level processes, but also enables direct communication between processes at the same level (i.e., child processes communicate directly with each other).

[0086] Of course, in a specific implementation, other methods can be used to obtain the data sent by the target to be transmitted between the processes and store them in the shared storage space. For example, an interception thread can be created in advance in the operating system, and the interception thread can monitor the data sent by the process in real time, and intercept the data sent by the process and store them in the shared storage space. At the same time, the read operation of the process can be monitored, and when the process receives the instruction of the read operation, the process is instructed to read the stored data from the shared storage space, etc.

[0087] After the target data to be transmitted between the processes are stored in the shared storage space in the operating system, step 102 is executed.

[0088] Step 102: When any process needs to call data, the corresponding target data is read from the shared storage space.

[0089] After the target data to be transmitted between the processes are stored in the shared storage space of the operating system, when any process needs to call data, the corresponding target data can be read from the shared storage space.

[0090] The embodiment of the present application installs an operating system in an electronic device and stores the data sent by each process in the inter-process communication mode through the shared storage space of the operating system, thereby realizing the communication between the main process and the sub-process, and between the sub-processes. At the same time, IPC communication based on the operating system will not cause the occupation of CPU and memory, avoid the occupation of system resources, and effectively reduce the power consumption of the system.

[0091] In a specific implementation of the present application, when a process sends target data, the process identifier of the corresponding process may be stored in a designated data position of the target data, and when the corresponding process is called to read data from a shared storage space, the data in the shared storage space containing the process identifier of the target process may be determined as the target data, and the target process is the process that reads the target data. That is, the target process is instructed to read the target data containing the process identifier of the target process from the shared storage space.

[0092] The embodiment of the present application can achieve directed data transmission and avoid data reading errors by instructing the process to read specified data from the shared storage space by adding a process identifier during inter-process communication.

[0093] In another specific implementation of the present application, when the target process reads the target data from the shared storage space, an instruction message may be sent to the target process to instruct the target process to read the target data from the shared storage space. Figure 4 This is described in detail as follows.

[0094] Reference Figure 4 , shows a flowchart of the steps of a target data reading method provided by an embodiment of the present application. Figure 4 As shown, the target data reading method may include: step 401 and step 402.

[0095] Step 401: Send instruction information for reading the target data to the target process.

[0096] In this embodiment, the operating system may send instruction information for reading target data to the target process, and the instruction information may instruct the target process to read the target data from the shared storage space.

[0097] After sending instruction information for reading target data to the target process, step 402 is executed.

[0098] Step 402: calling the target process to read the target data from the shared storage space according to the instruction information.

[0099] After sending instruction information for reading target data to the target process, the target process may be called to read the target data from the shared storage space according to the instruction information.

[0100] The embodiment of the present application can enable communicating processes to purposefully communicate data by instructing the operating system to send specific data to the process and the process to read specific data from the shared storage space, thereby achieving the purpose of inter-process communication.

[0101] The embodiment of the present application manages inter-process communication through the operating system and stores data in a shared storage space, which does not require CPU processing and does not occupy the memory of the electronic device, thereby reducing the performance consumption of IPC communication and realizing data transmission between processes of the same level.

[0102] Next, combine Figure 6 The process of script import and inter-process data transmission is described in detail as follows. Figure 6 As shown, in the main framework, the main process sends field A to child process A, and also sends field A to child process B. Then two IPC channels need to be opened (that is, two child processes).

[0103] At this time, the IPC processes are associated through state management, and field A is exposed to the main framework using export in state management, and is introduced in the entry file of IPC through component import (that is, the Vuex state management script is imported into the entry files of the main process, sub-process A, and sub-process B through component import). This method can not only reduce the performance consumption of IPC communication, but also solve the data transmission of multiple IPC sub-processes of the same level. In the specific implementation, each web interface is a sub-process. Since IPC can only transmit information at the same level, the global (state management) is introduced through component import, so that sub-processes can communicate with each other and avoid the mutual nesting of IPC communication (i.e. master-sub-A-master-sub-B).

[0104] The embodiment of the present application adopts the communication method of IPC and Vue architecture, which can effectively reduce the performance consumption of IPC communication and realize data transmission of processes at the same level.

[0105] The inter-process communication method provided in the embodiment of the present application stores the target data to be transmitted between each process in the shared storage space in the operating system, and reads the corresponding target data from the shared storage space when any process needs to call data. The embodiment of the present application installs an operating system in an electronic device, and stores the data sent by each process in the IPC communication mode in the shared storage space of the operating system, thereby realizing communication between the main process and the sub-process, and between the sub-process and the sub-process. At the same time, IPC communication based on the operating system will not cause the occupation of the CPU and memory, avoids the occupation of the system resources of the electronic device, and effectively reduces the system power consumption.

[0106] It should be noted that, for the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware 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 be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.

[0107] Reference Figure 7 , shows a schematic diagram of the structure of an inter-process communication device provided by an embodiment of the present application, which is applied to an operating system installed in an electronic device. Figure 7 As shown, the inter-process communication device 700 may include the following modules:

[0108] A target data storage module 710, used to store target data to be transmitted between processes in a shared storage space within the operating system;

[0109] The target data reading module 720 is used to read the corresponding target data from the shared storage space when any process needs to call data.

[0110] Optionally, the device further comprises:

[0111] An associated script acquisition module, used to acquire a pre-compiled associated script associated with the shared storage space, wherein the associated script is used to assist a process in reading corresponding target data from the shared storage space;

[0112] An associated script storage module, used for storing the associated script in a preset file;

[0113] The associated script import module is used to call the script import component to read the associated script from the preset file and import the associated script into the process after the process is created.

[0114] Optionally, a process identifier of a corresponding process is stored in a designated data bit of the target data.

[0115] The target data reading module comprises:

[0116] The target data reading unit is used to determine the data containing the process identifier of the target process in the shared storage space as the target data, and the target process reads the target data.

[0117] Optionally, the target data reading unit includes:

[0118] an indication information sending subunit, used for sending indication information for reading the target data to the target process;

[0119] The target data reading subunit is used to call the target process to read the target data from the shared storage space according to the indication information.

[0120] Optionally, the operating system is a Vue system, and correspondingly, the shared storage space includes a Vue state management library.

[0121] Optionally, the process includes at least any one of a main process and a sub-process.

[0122] Optionally, the device further comprises:

[0123] A process status acquisition module, used to acquire the process status of the process;

[0124] The process awakening module is used to awaken the process when the process status indicates that the process is in a dormant state.

[0125] The inter-process communication device provided in the embodiment of the present application stores the target data to be transmitted between each process in the shared storage space in the operating system, and reads the corresponding target data from the shared storage space when any process needs to call data. The embodiment of the present application installs an operating system in an electronic device, and stores the data sent by each process in the IPC communication mode in the shared storage space of the operating system, thereby realizing communication between the main process and the sub-process, and between the sub-process and the sub-process. At the same time, IPC communication based on the operating system will not cause the occupation of the CPU and memory, avoids the occupation of the system resources of the electronic device, and effectively reduces the system power consumption.

[0126] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0127] In an embodiment of the present application, an electronic device is also provided. The electronic device may include one or more processors, and one or more machine-readable media storing instructions thereon, the instructions being, for example, application programs. When the instructions are executed by the one or more processors, the processors are caused to execute any of the above-mentioned inter-process communication methods.

[0128] In an embodiment of the present application, a non-temporary computer-readable storage medium is also provided, on which a computer program is stored, and the program can be executed by a processor of an electronic device to implement any of the above-mentioned inter-process communication methods. For example, the non-temporary computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device.

[0129] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0130] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0131] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the 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 box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0132] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0133] These computer program instructions can also be loaded into a computer or other programmable data processing terminal device so that a series of operating 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 process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0134] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0135] Finally, it should be noted that, in this article, relational terms such as first and second, etc. 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 terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0136] The above is a detailed introduction to an inter-process communication method, device, electronic device and storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. An inter-process communication method, characterized in that: Applied to an operating system installed in an electronic device, the method comprises: Storing target data to be transmitted between processes in a shared storage space within the operating system; When any process needs to call data, the corresponding target data is read from the shared storage space.

2. The method according to claim 1, characterized in that The method further comprises: Obtaining a pre-compiled association script associated with the shared storage space, wherein the association script is used to assist a process in reading corresponding target data from the shared storage space; Storing the associated script in a preset file; After the process is created, the script import component is called to read the associated script from the preset file and import the associated script into the process.

3. The method according to claim 1 or 2, characterized in that: The process identifier of the corresponding process is stored in the designated data bit of the target data. When any process needs to call data, reading corresponding target data from the shared storage space includes: The data in the shared storage space containing the process identifier of the target process is determined as target data, and the target process reads the target data.

4. The method according to claim 3, characterized in that The step of determining the data in the shared storage space containing the process identifier of the target process as target data, and the target process reading the target data, comprises: Sending instruction information for reading the target data to the target process; The target process is called to read the target data from the shared storage space according to the indication information.

5. The method according to claim 3, characterized in that: The operating system is a Vue system, and correspondingly, the shared storage space includes a Vue state management library.

6. The method according to claim 3, characterized in that The process includes at least one of a main process and a sub-process.

7. The method according to claim 6, characterized in that The method further comprises: Obtaining a process status of the process; In a case where the process status indicates that the process is in a dormant state, waking up the process.

8. An inter-process communication device, characterized in that: Applicable to an operating system installed in an electronic device, the device comprises: A target data storage module, used for storing target data to be transmitted between processes in a shared storage space within the operating system; The target data reading module is used to read the corresponding target data from the shared storage space when any process needs to call data.

9. An electronic device, characterized in that: include: one or more processors; and One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, cause the apparatus to perform the inter-process communication method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer program stored therein enables the processor to execute the inter-process communication method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Cross-process communication method and system

    CN121255498A

  • A cross-process communication method and system

    CN121255498B