Method, device, equipment and storage medium for inter-process communication

By configuring the attribute cache area in the D-Bus bus, the read-only attributes of the service process are cached and the attribute value is directly obtained from the cache area, which solves the problems of long inter-process communication time and large I/O resource usage, and achieves more efficient communication and lower interface lag.

CN113961368BActive Publication Date: 2025-08-22PRANUS BEIJING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111223348.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-20
Publication Date
2025-08-22
Estimated Expiration
2041-10-20

AI Technical Summary

Technical Problem

In the prior art, the D-Bus bus scheme results in a long inter-process communication time and occupies a large amount of I/O resources, mainly because four communications are required for each access process.

Method used

Configure the attribute cache area in the D-Bus bus to cache the read-only attributes of the service process, directly obtain the attribute value from the cache instead of repeated requests, reducing I/O operations.

Benefits of technology

Optimizes the communication efficiency between processes, shortens the response time, and reduces the chance of interface lag.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113961368B_ABST
    Figure CN113961368B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a method, device, electronic device and storage medium for inter-process communication, which relate to the field of operating systems. Among them, a method for inter-process communication is applied to a D-Bus bus in a terminal, and the D-Bus bus is configured with an attribute cache area. The method specifically includes: receiving a request message sent by a client process for requesting access to a target service process; when the request message is used to request access to the read-only attribute of the target service process, querying the attribute cache area according to the read-only attribute of the target service process, wherein the attribute cache area caches the read-only attribute of at least one service process; when the query result is not empty, feedback is given to the client process. The method for inter-process communication provided by the embodiments of the present application reduces I / O operations on the bus, shortens response time, and thus optimizes communication between processes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of operating systems, and more specifically, to a method, apparatus, device, and storage medium for inter-process communication. Background Art

[0002] Currently, the most widely used inter-process communication solution is D-Bus. D-Bus is an inter-process communication mechanism optimized for desktop environments, supporting one-to-one and one-to-many peer-to-peer communication between processes. When providing access to server processes, D-Bus can only act as a router. Specifically, each client process accesses D-Bus, which forwards the request to the server. The server then responds to D-Bus, which then forwards the response to the client process. This means that each access requires four rounds of communication, which consumes a significant amount of I / O resources. Furthermore, these four rounds of communication increase communication time.

[0003] Therefore, how to reduce communication time and utilization of I / O resources and improve the efficiency of inter-process communication is a technical problem that needs to be solved urgently. Summary of the Invention

[0004] The purpose of the embodiments of the present application is to solve the problem of how to optimize inter-process communication.

[0005] According to one aspect of an embodiment of the present application, a method for inter-process communication is provided. The method is applied to a D-Bus bus in a terminal, wherein the D-Bus bus is configured with an attribute buffer, and comprises:

[0006] Receive a request message sent by a client process for requesting access to a target service process;

[0007] When the request message is used to request access to the read-only attribute of the target service process, querying the attribute cache area according to the read-only attribute of the target service process, wherein the attribute cache area caches the read-only attribute of at least one service process;

[0008] When the query result is not empty, feedback is given to the client process.

[0009] According to another aspect of an embodiment of the present application, a device for inter-process communication is provided, the device comprising:

[0010] The transceiver module is used to receive a request message sent by a client process for requesting access to a target service process;

[0011] a query module, configured to query the attribute cache area according to the read-only attribute of the target service process when the request message is used to request access to the read-only attribute of the target service process, wherein the attribute cache area caches the read-only attribute of at least one service process;

[0012] The transceiver module is further configured to provide feedback to the client process when the query result is not empty.

[0013] According to another aspect of an embodiment of the present application, an electronic device is provided, which includes: a memory, a processor, and a computer program stored in the memory, and the processor executes the computer program to implement the steps of the method of inter-process communication shown in one aspect of an embodiment of the present application.

[0014] According to another aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the steps of the method for inter-process communication shown in one aspect of an embodiment of the present application are implemented.

[0015] According to another aspect of an embodiment of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps of the method for inter-process communication shown in one aspect of an embodiment of the present application.

[0016] The beneficial effects of the technical solution provided by the embodiments of the present application are:

[0017] An embodiment of the present application provides a method for inter-process communication, which configures an attribute cache based on the D-Bus bus and caches the read-only attributes of multiple service processes. If the cached read-only attributes contain attribute values ​​of the read-only attributes required by the client process, the required attribute values ​​are directly obtained from the attribute cache and fed back to the client process, without having to forward the request message to the target service process to obtain the required attribute values. This operation not only reduces the I / O operations on the bus, but also shortens the response time, thereby optimizing inter-process communication. In addition, since most of the applications using the D-Bus bus are interface applications, shortening the response time also reduces the chance of interface freezes. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments of the present application.

[0019] Figure 1 A schematic diagram of a process for obtaining attributes provided in an embodiment of the present application;

[0020] Figure 2 A schematic diagram of another process for obtaining attributes provided in an embodiment of the present application;

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

[0022] Figure 4 A schematic diagram of the structure of an inter-process communication device provided in an embodiment of the present application;

[0023] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The following describes the embodiments of the present application in conjunction with the accompanying drawings. It should be understood that the embodiments described below in conjunction with the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.

[0025] Those skilled in the art will understand that, unless otherwise stated, the singular forms "one", "said" and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components (but do not exclude implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the present technical field. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, the element may be directly connected or coupled to the other element, or may refer to a connection relationship between the element and the other element through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" indicates implementation as "A", or implementation as "A", or implementation as "A and B".

[0026] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0027] First, several terms involved in this application are introduced and explained:

[0028] D-Bus: A mechanism that follows the D-Bus protocol and is responsible for handling inter-process communication, used to handle communication between processes. In the D-Bus mechanism, there is at least one Daemon process (Daemon process, also known as a daemon process, usually runs for a long time in the background of the system. It cannot interact with the foreground because it has no control terminal. The Daemon process is generally used as a system service; a Daemon process represents a bus), and all communications between application processes are distributed and managed through the Daemon process. Specifically, any application process or service process that needs to communicate through D-Bus must first connect to the Daemon process and register its own name (which can be the identifier of the application or service) to the Daemon process. After that, the Daemon process will send messages and data to the corresponding application process as needed. It should be noted that the bus referred to in the embodiment of the present application may include a data bus, an address bus, a control bus, an extension bus and a local bus, etc. It should be noted that the D-Bus bus referred to in the embodiment of the present application is a bus that complies with the D-Bus mechanism. In addition, when an application process or service process needs to access certain services, the Daemon process will also start the corresponding service process.

[0029] A bus application scenario: After a terminal device boots up, it creates a daemon process, effectively creating a bus. When an application or service process connects to the bus, a connection is established between the application or service and the bus. An application or service process can contain multiple objects, or instances of objects. Each object contains many interfaces (interface functions that can be used to adjust or retrieve application or service properties). These interfaces represent all the communication methods of an application or service process. The D-Bus mechanism supports two types of communication: signal (broadcast signal), a one-to-many communication method where any application process can send a message to other application processes via the bus, but the other application processes do not reply; and method (service process method), a one-to-one communication method where one application process sends a message to another application process via the bus (i.e., one application process calls a method on another application process), and the other application process is required to reply to the first application process.

[0030] Client process / service process: In this embodiment of the present application, any application process or service process on a terminal device can be a client process or a service process. A process can be a service process at one moment and a client process at the next, that is, the process can switch back and forth between the two identities of client process and service process.

[0031] See also Figure 1 In the embodiment of the present application, a schematic diagram of a process for obtaining attributes is provided. In the diagram, client process 1 needs to obtain attributes of service process 1, and client process 2 needs to obtain attributes of service process 2.

[0032] Specifically, client process 1 accesses the D-Bus bus; the D-Bus bus forwards the access request to service process 1; service process 1 then responds to the D-Bus bus, and the response carries the value of the attribute that client process 1 wants to access; the bus again feeds the response message back to client process 1.

[0033] Specifically, when the corresponding attributes in service process 2 are updated, service process 2 sends a message to the D-Bus bus in the form of a signal. The D-Bus bus broadcasts according to the signal. Client process 2 actually monitors the signal and makes corresponding adjustments when it hears the signal.

[0034] As can be seen from this, when a client process accesses the attributes provided by a service process via D-Bus, the D-Bus only acts as a relay. Furthermore, the attributes provided by most service processes are rarely updated, and even when they are, the updated attributes are broadcast via signals. Therefore, when a client process accesses a service process, four communications are required, which consumes a large amount of I / O resources and further increases inter-process communication time.

[0035] The present application provides a method, device, electronic device and storage medium for inter-process communication, which are intended to solve the above technical problems in the prior art.

[0036] The following describes several exemplary embodiments to illustrate the technical solutions of the embodiments of the present application and the technical effects produced by the technical solutions of the present application. It should be noted that the following embodiments can refer to, draw on, or combine with each other, and the same terms, similar features, and similar implementation steps in different embodiments will not be repeated.

[0037] See also Figure 2 , this application embodiment provides another process diagram for obtaining attributes. Figure 2In the present invention, the D-Bus bus is configured with an attribute cache area. The D-Bus bus is a system service of the terminal device. The terminal device is configured with multiple applications or services, such as a lock screen application, a food delivery application, a map application, a password service, a location service, etc. After the operating system running on the terminal device is started, the D-Bus bus is initialized. The aforementioned applications or services start corresponding processes in response to customer needs, and the processes communicate with each other via the D-Bus bus. It should be noted that the embodiments of the present application do not impose any restrictions on the services or applications running on the terminal device.

[0038] See also Figure 3 , the embodiment of the present application provides a flow chart of a method for inter-process communication, which is applied to Figure 2 The D-Bus bus shown in . The method includes:

[0039] S110, receiving a request message sent by a client process for requesting access to a target service process;

[0040] S120, when the request message is used to request access to the read-only attribute of the target service process, query the attribute cache area according to the read-only attribute of the target service process, wherein the attribute cache area caches the read-only attribute of at least one service process;

[0041] The request message carries the identifier of the read-only attribute of the target service process. Specifically, when the request message is used to request access to the read-only attribute of the target service process, the attribute cache is queried based on the identifier of the read-only attribute of the target service process carried in the request message. The attribute cache stores the identifiers and attribute values ​​of the read-only attributes of multiple service processes. In the description of the embodiments of the present application, "multiple" and "at least one" can be understood as synonyms, that is, one or more as commonly referred to.

[0042] Generally, the ways to access a service process are divided into two categories: Set and Get. Among them, when accessing a service process in Set mode, access to the service process means modifying or adjusting the value of a certain attribute of the service process, or calling a certain service provided by the service process. The process of calling the service involves modifying the attribute; and when accessing a service process in Get mode, access to the service process means obtaining the corresponding attribute value of the service process. Therefore, when accessing a service process in Get mode, the attribute corresponding to the accessed Interface is called a read-only attribute. Among them, the name of the Interface can be used as an identifier of the read-only attribute, and the identifier is unique. Although the read-only attribute in the embodiment of the present application indicates that the attribute can be obtained through the Get method, it does not mean that the attribute cannot be modified through the Set method.

[0043] See also Figure 2 In the example shown, the terminal device can be a mobile phone. The client process can be the lock screen application process on the mobile phone, and the service process can be the password service process on the mobile phone. Currently, the lock screen application process on the mobile phone is running, and a lock screen interface is set on the mobile phone's main interface. The user enters a pre-boot command, which pops up an interface for entering a password. After receiving the pre-boot command, the lock screen application process needs to obtain the current power-on password input method set on the terminal device. Power-on password input methods can include keyboard input, nine-square grid input, fingerprint input, etc. The lock screen application process then sends a message to the D-Bus bus requesting access to the password service to obtain the power-on password input method. The password service not only provides the current power-on password input method, but also provides services for parsing and verifying power-on passwords entered using different input methods. For example, when the input method is the nine-square grid input method, after receiving the user's input trajectory on the nine-square grid, a corresponding string is generated based on the trajectory. This string is then randomly verified. Because the password input method is a property that won't change in the short term, the D-Bus bus stores it in a property buffer. After receiving the request message, the D-Bus bus queries the property buffer for the password input method. Since the lock screen application process re-layouts the main interface after obtaining the password input method, reducing I / O operations allows the lock screen application to update the main interface in a timely manner.

[0044] Furthermore, client processes on mobile devices can also include food delivery apps, map apps, social networking apps, and so on. These apps may access the mobile device's geolocation service to obtain current location information. Without an attribute cache, these apps would repeatedly send messages to the geolocation service via the D-Bus bus to obtain and provide feedback. With an attribute cache, the D-Bus bus provides feedback directly based on the current location information cached in the attribute cache. Therefore, the attribute cache reduces I / O operations and shortens feedback time.

[0045] In a possible implementation, before receiving a request message sent by a client process for requesting access to a target service process, the method further includes:

[0046] After any process in the terminal is registered as a service process, the read-only attribute of the service process is obtained; and the obtained read-only attribute is cached in the attribute cache area.

[0047] Specifically, after a process establishes a connection with the bus, it initiates a registration request to the D-Bus bus to register as a service process. After the D-Bus bus identifies the service process, it accesses multiple read-only attributes of the service process and caches the identifiers and attribute values ​​of the obtained read-only attributes in the attribute cache.

[0048] For example, after determining the service process, the D-Bus accesses all interfaces of the service process that support the Get method, thereby obtaining corresponding attribute values, and saving the interface names and corresponding attribute values ​​in a one-to-one correspondence.

[0049] S130: When the query result is not empty, feedback is given to the client process.

[0050] In a possible implementation, providing feedback to the client process may specifically include:

[0051] The attribute value of the read-only attribute of the target service process is obtained from the attribute buffer area; and the attribute value of the read-only attribute of the target service process is fed back to the client process.

[0052] Continuing with the above example, when the power-on password input method cached in the attribute cache is a nine-square grid, the D-Bus bus reports the power-on password input method to the lock screen application process. Upon receiving the "nine-square grid" input method, the lock screen application process refreshes the main interface and displays a nine-square grid. After receiving the trajectory information entered by the user on the nine-square grid, the lock screen application process sends a message to the D-Bus bus requesting access to the password service process to verify the trajectory information. After receiving the trajectory information, the password service process parses it to obtain a string, which is the power-on password. The password service process then randomly verifies the power-on password. If the verification is successful, a verification success message is sent back to the D-Bus bus. If the verification fails, a verification failure message is sent back. The D-Bus bus reports the received information to the lock screen application, which, upon receiving the verification success message, moves the process to the background. It should be pointed out that the interaction process between the lock screen application process and the password service process is only used as an example to illustrate the process of the embodiment of the present application, and cannot constitute a restriction on the applications or services that can be included in the terminal device of the embodiment of the present application.

[0053] An embodiment of the present application provides a method for inter-process communication, which configures an attribute cache based on a D-Bus bus, and the attribute cache caches the read-only attributes of multiple service processes. If the cached read-only attributes include the read-only attributes required by the client process, the attribute value of the required read-only attribute is directly obtained from the attribute cache and fed back to the client process, without forwarding the request message to the target service process to obtain the required attribute value. This operation not only reduces the I / O operations on the bus, but also shortens the response time, thereby optimizing inter-process communication. In addition, since most of the applications using the D-Bus bus are interface applications, shortening the response time also reduces the chance of interface freezes.

[0054] The present application also provides a possible implementation method, which further includes:

[0055] A corresponding attribute change signal is configured for any read-only attribute cached in the attribute cache area, wherein the attribute change signal is used to indicate a change in an attribute value of the any read-only attribute.

[0056] Specifically, the configured attribute change signal can use a unified signal identifier, but the attribute change signal should also provide the identifier of the service or application corresponding to the attribute and the identifier of the attribute. Usually, after the application process or service process establishes a connection with the D-Bus bus, the D-Bus bus will assign them a unique identifier and record it in a table. The D-Bus bus determines the client process and service process based on the recorded identifier and performs message forwarding operations. Regarding the technical means by which the D-Bus bus assigns identifiers to client processes and service processes, reference can be made to the existing technology. Due to space limitations, we will not elaborate on this here.

[0057] In a possible implementation, when a read-only attribute of a service process is changed, an attribute change signal is sent to the D-Bus bus. Therefore, the method further includes:

[0058] When the attribute change signal is received, the read-only attribute carried in the attribute change signal is acquired; the attribute value of the corresponding read-only attribute in the attribute buffer is updated according to the attribute change signal, and the attribute value is broadcast.

[0059] Specifically, when the D-Bus receives a property change signal, it obtains the service process identifier, the read-only property identifier, and the read-only property value carried in the property change signal. Based on the service process identifier and the read-only property identifier carried in the signal, it determines the read-only property cached in the property cache, and then replaces the cached property value with the read-only property value carried in the signal. After the update is complete, a new change signal is created based on the service process identifier, the read-only property identifier, and the read-only property value carried, and the signal is broadcasted so that other processes are notified.

[0060] In addition, in the prior art, the client process also performs a corresponding attribute monitoring operation. After receiving the broadcast signal, the client process makes corresponding adjustments based on the attribute value of the new read-only attribute.

[0061] For example, a system runs multiple applications that utilize geolocation services, primarily for obtaining the device's current geolocation information, such as social networking applications and food delivery services. When the geolocation sensor of a terminal device monitored by the geolocation service process indicates a change in the current geolocation information, the geolocation service process sends a property change message to the D-Bus, carrying the new current geolocation information. The D-Bus then updates the stored current geolocation information and broadcasts it. Upon receiving the broadcast signal, the client process monitoring the current geolocation information obtains the new current geolocation information carried in the broadcast signal, or sends a request message to the D-Bus bus to obtain the current geolocation information.

[0062] Although the attribute cache area caches most of the read-only attributes, there will always be some read-only attributes that are not backed up in time. Therefore, when performing a query operation, it is very likely that the query result will be empty. Therefore, the embodiment of the present application also provides a possible implementation method to solve this technical problem.

[0063] When the query result is empty, forward the request message to the target service process; receive a response message fed back by the target service process; update the read-only attribute of the target service process in the attribute cache according to the response message, and feed back to the client process.

[0064] An embodiment of the present application provides an inter-process communication method that, when a read-only attribute is not cached in the attribute cache, can also obtain the read-only attribute by forwarding a request message to a service process. After receiving a response signal from the target service process, the cache is updated and feedback is provided to the client process. This solves the problem of how to provide feedback when the read-only attribute is not cached in the attribute cache.

[0065] See also Figure 4 The embodiment of the present application also provides a schematic diagram of the structure of an inter-process communication device. The device 400 is applied to the D-Bus bus of the terminal, and the D-Bus bus is configured with an attribute cache de-area. The device 400 includes a cache attribute module 410, a transceiver module 420, and a query module 430, wherein:

[0066] The transceiver module 420 is used to receive a request message sent by a client process for requesting access to a target service process;

[0067] a query module 430 configured to query the attribute cache area according to the read-only attribute of the target service process when the request message is used to request access to the read-only attribute of the target service process, wherein the attribute cache area caches the read-only attribute of at least one service process;

[0068] The transceiver module 420 is further configured to provide feedback to the client process when the query result is not empty.

[0069] In one possible implementation, before receiving a request message sent by a client process for requesting access to a target service process, the cache attribute module 410 may be configured to:

[0070] After any process in the terminal is registered as a service process, the read-only attribute of the service process is obtained; and the obtained read-only attribute is cached in the attribute cache area.

[0071] In a possible implementation, the cache attribute module 410 may also be used to:

[0072] A corresponding attribute change signal is configured for any read-only attribute cached in the attribute cache area, wherein the attribute change signal is used to indicate a change in an attribute value of the any read-only attribute.

[0073] In a possible implementation, the cache attribute module 410 may also be used to:

[0074] When the attribute change signal is received, the read-only attribute carried in the attribute change signal is acquired; the attribute value of the corresponding read-only attribute in the attribute buffer is updated according to the attribute change signal, and the attribute value is broadcast.

[0075] In one possible implementation, the transceiver module 420 may also be used to:

[0076] When the query result is empty, forward the request message to the target service process; receive a response message fed back by the target service process; update the read-only attribute of the target service process in the attribute cache according to the response message, and feed back to the client process.

[0077] In a possible implementation, the transceiver module 420, in providing feedback to the client process, is specifically configured to:

[0078] The attribute value of the read-only attribute of the target service process is obtained from the attribute buffer area; and the attribute value of the read-only attribute of the target service process is fed back to the client process.

[0079] The device of the embodiment of the present application can execute the method provided by the embodiment of the present application, and its implementation principle is similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed functional description of each module of the device, please refer to the description in the corresponding method shown in the previous text, and will not be repeated here.

[0080] In an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory. The processor executes the above-mentioned computer program to implement the steps of a method for inter-process communication. Compared with the existing technology, it can achieve: reducing I / O operations on the bus, shortening the response time, and thus optimizing inter-process communication.

[0081] See also Figure 5 , the embodiment of the present application also provides a specific example of an electronic device, Figure 5 The electronic device 5000 shown includes: a processor 5001 and a memory 5003. The processor 5001 and the memory 5003 are connected, for example, via a bus 5002. Optionally, the electronic device 5000 may further include a transceiver 5004, which may be used for data exchange between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the number of transceivers 5004 is not limited to one, and the structure of the electronic device 5000 does not constitute a limitation on the embodiments of the present application.

[0082] Processor 5001 can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 5001 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0083] The bus 5002 may include a path for transmitting information between the above components. The bus 5002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 5002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0084] The memory 5003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store computer programs and can be read by a computer, without limitation here.

[0085] The memory 5003 is used to store the computer program for executing the embodiments of the present application, and the execution is controlled by the processor 5001. The processor 5001 is used to execute the computer program stored in the memory 5003 to implement the steps shown in the above method embodiments.

[0086] The electronic devices include but are not limited to bus devices.

[0087] An embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it can implement the steps and corresponding content of an inter-process communication method provided in an embodiment of the present application.

[0088] An embodiment of the present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, it can implement the steps and corresponding contents of an inter-process communication method provided in an embodiment of the present application.

[0089] It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the order of implementation of these steps is not limited to the order indicated by the arrows. Unless otherwise clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart can include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage in these sub-steps or stages can also be executed at different times respectively. Under different scenarios at the execution time, the execution order of these sub-steps or stages can be flexibly configured according to demand, and the embodiment of the present application does not limit this.

[0090] The above description is only an optional implementation method for some implementation scenarios of this application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of this application, the use of other similar implementation methods based on the technical ideas of this application also falls within the protection scope of the embodiments of this application.

Claims

1. A method for inter-process communication, characterized in that: A D-Bus bus is applied to a terminal, wherein the D-Bus bus is configured with an attribute buffer area, and the method includes: receiving a request message sent by a client process for requesting access to a target service process, wherein the request message carries an identifier of a read-only attribute of the target service process; When the request message is used to request access to a read-only attribute of the target service process, querying the attribute cache area according to the identifier of the read-only attribute of the target service process, wherein the attribute cache area caches the identifier and attribute value of the read-only attribute of at least one service process; When the query result is not empty, the attribute value of the read-only attribute of the target service process is fed back to the client process.

2. The method according to claim 1, characterized in that Before receiving the request message sent by the client process for requesting access to the target service process, the method further includes: After any process in the terminal is registered as a service process, obtaining the read-only attribute of the service process; The obtained read-only attributes are cached in the attribute cache area.

3. The method according to claim 1, characterized in that The method further comprises: A corresponding attribute change signal is configured for any read-only attribute cached in the attribute cache area, wherein the attribute change signal is used to indicate a change in an attribute value of the any read-only attribute.

4. The method according to claim 3, characterized in that The method further comprises: When the attribute change signal is received, obtaining the read-only attribute carried in the attribute change signal; The attribute value of the corresponding read-only attribute in the attribute buffer is updated according to the attribute change signal and broadcasted.

5. The method according to claim 1, wherein The method further comprises: When the query result is empty, forwarding the request message to the target service process; Receive a response message fed back by the target service process; The read-only attribute of the target service process in the attribute cache is updated according to the response message, and feedback is given to the client process.

6. The method according to any one of claims 1 or 5, characterized in that The attribute cache area further caches the attribute value of the read-only attribute of the at least one service process, and the feedback to the client process includes: Acquire the attribute value of the read-only attribute of the target service process from the attribute cache; Feedback the attribute value of the read-only attribute of the target service process to the client process.

7. An inter-process communication device, characterized in that: A D-Bus bus applied to a terminal, wherein the D-Bus bus is configured with an attribute buffer area, and the device comprises: a transceiver module, configured to receive a request message sent by a client process for requesting access to a target service process, wherein the request message carries an identifier of a read-only attribute of the target service process; a query module configured to query the attribute cache area according to the identifier of the read-only attribute of the target service process when the request message is used to request access to the read-only attribute of the target service process, wherein the attribute cache area caches the identifier and attribute value of the read-only attribute of at least one service process; The transceiver module is further configured to feed back the attribute value of the read-only attribute of the target service process to the client process when the query result is not empty.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.