Data publishing method and device, data subscribing method and device

By establishing high-bandwidth data channels and low-latency control channels in heterogeneous systems, the problem of user-mode data being unable to be published to kernel mode is solved, and the compatibility and scalability of kernel-mode virtual devices are achieved.

CN116155984BActive Publication Date: 2026-03-24ECARX (HUBEI) TECHCO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-21
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In heterogeneous systems, existing technologies cannot publish user-space data from the data publisher to the kernel-space data subscriber, resulting in incompatibility in kernel-space virtual device development.

Method used

By establishing high-bandwidth data channels and low-latency control channels within a heterogeneous system, the kernel and user states of the data publisher are used as data subscribers. The device status is obtained using the service discovery protocol, and the target data is published and read through the data and control channels.

Benefits of technology

It enables cross-system user-mode data publishing to kernel mode, supports the development of kernel-mode virtual devices, and improves the application logic compatibility and functional scalability of the distributed soft bus.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116155984B_ABST
    Figure CN116155984B_ABST
Patent Text Reader

Abstract

The application discloses a data publishing method and device, a data subscribing method and device, the method comprises the following steps: obtaining a kernel state and a first user state created by a first device in a heterogeneous system with a data publisher, and taking the kernel state and the first user state as a data subscriber; establishing a data channel and a control channel for realizing service subscription with the data subscriber, wherein the data channel is a high-bandwidth channel, and the control channel is a low-delay channel; and publishing target data to the data subscriber through the data channel and the control channel, wherein the data subscriber is used for receiving a publishing message of the target data published by the data publisher, obtaining a channel identifier of a target data channel for transmitting the target data according to the publishing message, and determining a target physical address for caching the target data according to the channel identifier to read the target data. The application solves the technical problem that related technologies cannot realize data publishing from a user state of a data publisher to a kernel state of a data subscriber in a heterogeneous system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet of Things (IoT) technology, and more specifically, to a data publishing method and apparatus, and a data subscription method and apparatus. Background Technology

[0002] Currently, the customized distributed soft bus model (Defined Framework SoftBus, DFS) not only possesses basic capabilities such as service subscription, service discovery, and data publishing, but also supports customized "zero-copy" big data publishing capabilities across platforms, devices, and systems, enabling universal business interfaces. Most related distributed soft bus models rely on applications to implement service discovery and data publishing between publishers and multiple subscribers.

[0003] However, not all developers are willing to accept the interface reconstruction of the distributed soft bus model. Therefore, when developing kernel-mode virtual devices, the application logic that originally called the Video Hal API needs to be changed to call the above communication interface. This makes it impossible for the distributed Node to connect to the native Video business logic or publish data to the kernel space, without considering whether the business logic can be compatible.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This application provides a data publishing method and apparatus, and a data subscription method and apparatus, to at least solve the technical problem that related technologies cannot realize the publishing of data from the user space of the data publisher to the kernel space of the data subscriber in heterogeneous systems.

[0006] According to one aspect of the embodiments of this application, a data publishing method is provided, comprising: acquiring a kernel state and a first user state created by a first device located in a heterogeneous system with the data publisher, and using the kernel state and the first user state as data subscribers; establishing a data channel and a control channel for implementing service subscription with the data subscribers, wherein the data channel is a high-bandwidth channel and the control channel is a low-latency channel; publishing target data to the data subscribers through the data channel and the control channel, wherein the data subscribers are used to receive a publishing message from the data publisher to publish the target data, obtain the channel identifier of the target data channel for transmitting the target data based on the publishing message, and determine the target physical address for caching the target data based on the channel identifier, so as to read the target data.

[0007] Optionally, obtaining the kernel state and first user state created by the first device in a heterogeneous system with the data publisher, and using the kernel state and first user state as data subscribers, includes: obtaining the first device in the heterogeneous system using a service discovery protocol; creating the first user state through the first application of the first device, and creating the kernel state through the business driver initialization program corresponding to the virtual device of the first device, wherein the kernel state is located in the kernel space of the first device, and the first user state is located in the first user space of the first device; and using the kernel state and first user state as data subscribers.

[0008] Optionally, the data publisher is a second user space created by a second application of a second device within a heterogeneous system.

[0009] Optionally, a data channel and a control channel are established for implementing service subscription with the data subscriber, including: establishing a data channel and a control channel for implementing service subscription with the data subscriber, wherein the data channel includes at least one of the following: shared memory, PCIe DMA, and the control channel includes at least one of the following: RPMsg, network.

[0010] Optionally, the method further includes: using a multi-caching mechanism to cache the target data to the target physical address.

[0011] Optionally, before publishing the target data to the data subscriber via the data channel and control channel, the method further includes: sending a publication message to the data subscriber in a target format, wherein the publication message is used to notify the data subscriber to receive the target data, and the target format includes at least one of the following: broadcast or unicast.

[0012] Optionally, the data subscriber is also used to provide a standard hardware abstraction layer to the first user space so that a first application of the first device can use the target data through the standard hardware abstraction layer.

[0013] According to another aspect of the embodiments of this application, a data subscription method is also provided, including: obtaining a second user state created by a second application of a second device located in a heterogeneous system with the data subscriber, and using the second user state as a data publisher; receiving a publishing message transmitted by the data publisher; determining the channel identifier of the target data channel for publishing target data based on the publishing message, and determining the target physical address for caching target data based on the channel identifier; and reading the target data based on the target physical address.

[0014] Optionally, a service discovery protocol is used to obtain the first device in the heterogeneous system; a first user space is created through the first application of the first device, and a kernel space is created through the business driver initialization program corresponding to the virtual device of the first device, wherein the kernel space is in the kernel space of the first device, and the first user space is in the first user space of the first device; the kernel space and the first user space are used as data subscribers.

[0015] Optionally, after reading the target data based on the target physical address, the method further includes: the virtual device of the first device providing a standard hardware abstraction layer to the first user space through kernel mode; and the first application of the first device using the target data through the standard hardware abstraction layer.

[0016] According to another aspect of the embodiments of this application, a data publishing apparatus is also provided, comprising: an acquisition module, configured to acquire a kernel state and a first user state created by a first device located in a heterogeneous system with the data publisher, and to use the kernel state and the first user state as data subscribers; an establishment module, configured to establish a data channel and a control channel for implementing service subscription with the data subscribers, wherein the data channel is a high-bandwidth channel and the control channel is a low-latency channel; and a publishing module, configured to publish target data to the data subscribers through the data channel and the control channel, wherein the data subscribers are configured to receive a publishing message from the data publisher to publish the target data, acquire the channel identifier of the target data channel for transmitting the target data based on the publishing message, and determine the target physical address for caching the target data based on the channel identifier, so as to read the target data.

[0017] According to another aspect of the embodiments of this application, a data subscription device is also provided, comprising: an acquisition module, configured to acquire a second user state created by a second application of a second device located in a heterogeneous system with the data subscriber, and to use the second user state as a data publisher; a receiving module, configured to receive a publishing message transmitted by the data publisher; a determining module, configured to determine the channel identifier of the target data channel for publishing target data based on the publishing message, and to determine the target physical address for caching target data based on the channel identifier; and a reading module, configured to read the target data based on the target physical address.

[0018] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, which includes a stored program, wherein the device where the non-volatile storage medium is located executes the above-described data publishing method or data subscription method by running the program.

[0019] According to another aspect of the embodiments of this application, an electronic device is also provided, the electronic device including: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described data publishing method or data subscription method through the computer program.

[0020] In this embodiment, a kernel state and a first user state created by a first device located in a heterogeneous system with the data publisher are obtained, and the kernel state and the first user state are used as data subscribers. A data channel and a control channel are established for service subscription with the data subscriber, wherein the data channel is a high-bandwidth channel and the control channel is a low-latency channel. Target data is published to the data subscriber through the data channel and the control channel. The data subscriber receives the publication message of the target data published by the data publisher, obtains the channel identifier of the target data channel for transmitting the target data based on the publication message, and determines the target physical address for caching the target data based on the channel identifier, so as to read the target data. This enables the publication of user-space data across systems to the kernel state to support the development of kernel-space virtual devices, thereby solving the technical problem that related technologies cannot achieve the publication of data from the user state of the data publisher to the kernel state of the data subscriber in heterogeneous systems. Attached Figure Description

[0021] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0022] Figure 1 This is a flowchart of an optional data publishing method according to an embodiment of this application;

[0023] Figure 2 This is a schematic diagram of an optional data publishing process according to an embodiment of this application;

[0024] Figure 3 This is a flowchart of an optional data subscription method according to an embodiment of this application;

[0025] Figure 4 This is a schematic diagram of an optional data publishing device according to an embodiment of this application;

[0026] Figure 5 This is a schematic diagram of an optional data subscription device according to an embodiment of this application. Detailed Implementation

[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0028] It should be noted that the terms "first," "second," etc., used in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0029] To better understand the embodiments of this application, the following is a translation and explanation of some nouns or terms that appear in the description of the embodiments of this application:

[0030] User mode (User Node): This refers to a non-privileged state. In this state, the code executing is hardware-restricted and cannot perform certain operations, such as writing to the memory space of other processes, to prevent security vulnerabilities to the operating system.

[0031] Kernel mode (Kernel Node): The kernel is the core program of the operating system, providing external management calls to computer devices. The operating system code can generally be divided into two parts: the address space where the kernel resides is called kernel space, and everything outside the kernel is collectively called the external management program (EMP). The EMP mostly manages and operates on the kernel interface of peripheral devices; therefore, the address space occupied by the EMP and user processes is called the external space. A program typically spans both spaces. When executing code in kernel space, the program is said to be in kernel mode; conversely, when executing code in external space, the program is said to be in user mode.

[0032] RPMsg (Remote Processor Messaging): It defines the standard binary interface used for communication between multiple cores in a heterogeneous multicore system.

[0033] PCIe DMA (Direct Memory Access): DMA is a data transfer method of PCIe (Peripheral Component Interconnect express, a high-speed serial computer expansion bus standard). In this transfer method, data transfer is not handled by the CPU, but by a special processor DMA controller, thus consuming very little CPU resources.

[0034] Example 1

[0035] Since most of the relevant distributed soft bus models are based on application implementations to achieve service discovery and data publishing between publishers and multiple subscribers, it is impossible to guarantee that distributed nodes can connect to native business logic, let alone publish user-space node data to kernel-space nodes.

[0036] To address the aforementioned technical problems, this application provides a data publishing method. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0037] Figure 1 This is a flowchart of an optional data publishing method according to an embodiment of this application, such as... Figure 1 As shown, the method includes at least steps S102-S106, wherein:

[0038] Step S102: Obtain the kernel state and the first user state created by the first device in the heterogeneous system with the data publisher, and use the kernel state and the first user state as the data subscriber.

[0039] Optionally, the data publisher can create a second user space for a second application on a second device within a heterogeneous system. This second user space resides in the second user space of the second device.

[0040] As an optional implementation, in the technical solution provided in step S102 of the present invention, the method may include: obtaining a first device in a heterogeneous system using a service discovery protocol; creating a first user state through a first application of the first device, and creating a kernel state through a service driver initialization program corresponding to the virtual device of the first device, wherein the kernel state is in the kernel space of the first device, and the first user state is in the first user space of the first device; and using the kernel state and the first user state as data subscribers.

[0041] For example, the front-row central control system and the rear-row entertainment system in a smart cockpit are heterogeneous systems. Therefore, we will take the front-row central control system and the rear-row entertainment system in a smart cockpit as examples to explain the data subscriber and the data publisher.

[0042] When a front-seat user starts the car, the front instrument cluster and central control system start up. A second user state is created through the second application of any second device in the front central control system (such as the application corresponding to the central control display). At this time, the second user state can be used as a data publisher. Then, the rear-seat user starts the rear entertainment system, uses the service discovery protocol to obtain any first device in the rear entertainment system (such as a speaker device), and creates a first user state through the first application of the first device (such as the application corresponding to the speaker device). At the same time, the relevant business driver initialization program of the virtual device of the first device creates a kernel state. At this time, the first user state and the kernel state can be used as data subscribers.

[0043] Specifically, Figure 2 This is a schematic diagram of another optional data publishing process according to an embodiment of this application, such as... Figure 2 As shown, Device A (the second device) and Device B (the first device) are in a heterogeneous system, and a DFS (Distributed Soft Bus) channel is established between Device A and Device B.

[0044] When the system containing Device A starts up, Device A's second application creates a DFS User Node (the user space of the distributed soft bus model, i.e., the second user space) in User Space. When the system containing Device B starts up, Device B's first application creates a DFS UserNode (the user space of the distributed soft bus model, i.e., the first user space) in User Space. Simultaneously, a DFS Kernel Node (the kernel space of the distributed soft bus model) is created through the relevant business driver initialization program of Device B's Virtual Device, located in Kernel Space. At this point, Device B's DFS UserNode and DFS Kernel Node can be used as data subscribers. The DFS Driver of Device A and the DFS Driver of Device B transmit and publish data through a cross-platform, cross-device, and cross-system data channel.

[0045] Optionally, the service discovery protocol includes, but is not limited to, the RPMsg protocol.

[0046] Step S104: Establish a data channel and a control channel for service subscription with the data subscriber, wherein the data channel is a high-bandwidth channel and the control channel is a low-latency channel.

[0047] In the technical solution provided by step S104 of the present invention, after the data subscriber is determined, the data publisher and the data subscriber perceive each other and establish a data channel and a control channel between the data publisher and the data subscriber to realize service subscription. The difference between the data channel and the control channel is that the data channel is a high-bandwidth channel and the control channel is a low-latency channel.

[0048] Optionally, the data channel includes, but is not limited to, high-bandwidth channels such as memory sharing (within or between systems) and PCIe DMA; the control channel includes, but is not limited to, low-latency channels such as RPMsg (within or between systems) and network.

[0049] Step S106: The target data is published to the data subscriber through the data channel and the control channel. The data subscriber is used to receive the publication message of the target data, obtain the channel identifier of the target data channel for transmitting the target data according to the publication message, and determine the target physical address for caching the target data according to the channel identifier, so as to read the target data.

[0050] The aforementioned channel identifiers include, but are not limited to, the channel name and the channel code.

[0051] Alternatively, a multi-caching mechanism can be used to cache the target data to the target physical address.

[0052] For example, the target data is copied into 8 copies and cached accordingly in the physical addresses pre-set by the system.

[0053] As an optional implementation, before publishing the target data to the data subscriber through the data channel and control channel, a publishing message can also be sent to the data subscriber in a target form, wherein the publishing message is used to notify the data subscriber to receive the target data, and the target form includes at least one of the following: broadcast or unicast.

[0054] Specifically, when there are multiple data subscribers, the data publisher only publishes data sequentially. Therefore, the data publisher will use methods such as broadcasting or polling data subscribers to notify all data subscribers to receive the target data.

[0055] In addition, the data subscriber is also used to provide a standard hardware abstraction layer to the first user space so that the first application of the first device can use the target data through the standard hardware abstraction layer.

[0056] Depend on Figure 2It can be seen that Device B's Virtual Device integrates the acquired target data into the DFS Driver (distributed soft bus model driver) located in the Kernel Space, and provides Device HAL (standard hardware abstraction layer) to Device B's User Space (i.e., the first user space). This allows Device B's first application to use the target data through the standard hardware abstraction layer, thereby avoiding the use of the unified communication interface provided by Device B's user space.

[0057] In this embodiment, a kernel state and a first user state created by a first device located in a heterogeneous system with the data publisher are obtained, and the kernel state and the first user state are used as data subscribers. A data channel and a control channel are established for service subscription with the data subscriber, wherein the data channel is a high-bandwidth channel and the control channel is a low-latency channel. Target data is published to the data subscriber through the data channel and the control channel. The data subscriber receives the publication message of the target data published by the data publisher, obtains the channel identifier of the target data channel for transmitting the target data based on the publication message, and determines the target physical address for caching the target data based on the channel identifier, so as to read the target data. This enables the publication of user-space data across systems to the kernel state to support the development of kernel-space virtual devices, thereby solving the technical problem that related technologies cannot achieve the publication of data from the user state of the data publisher to the kernel state of the data subscriber in heterogeneous systems.

[0058] Example 2

[0059] According to an embodiment of this application, a data subscription method is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0060] Figure 3 This is a flowchart of an optional data publishing method according to an embodiment of this application, such as... Figure 3 As shown, the method includes at least steps S302-S308, wherein:

[0061] Step S302: Obtain the second user state created by the second application of the second device located in a heterogeneous system with the data subscriber, and use the second user state as the data publisher.

[0062] Optionally, a service discovery protocol is used to obtain the first device in the heterogeneous system; a first user space is created through the first application of the first device, and a kernel space is created through the business driver initialization program corresponding to the virtual device of the first device, wherein the kernel space is in the kernel space of the first device, and the first user space is in the first user space of the first device; the kernel space and the first user space are used as data subscribers.

[0063] For example, the front-row central control system and the rear-row entertainment system in a smart cockpit are heterogeneous systems. Therefore, we will take the front-row central control system and the rear-row entertainment system in a smart cockpit as examples to explain the data subscriber and the data publisher.

[0064] When a front-seat user starts the car, the front instrument cluster and central control system start up. A second user state is created through the second application of any second device in the front central control system (such as the application corresponding to the central control display). At this time, the second user state can be used as a data publisher. Then, the rear-seat user starts the rear entertainment system, uses the service discovery protocol to obtain any first device in the rear entertainment system (such as a speaker device), and creates a first user state through the first application of the first device (such as the application corresponding to the speaker device). At the same time, the relevant business driver initialization program of the virtual device of the first device creates a kernel state. At this time, the first user state and the kernel state can be used as data subscribers.

[0065] Optionally, the service discovery protocol includes, but is not limited to, the RPMsg protocol.

[0066] Step S304: Receive the publishing message transmitted by the data publisher.

[0067] Step S306: Determine the channel identifier of the target data channel for publishing the target data based on the publishing message, and determine the target physical address for caching the target data based on the channel identifier.

[0068] The aforementioned channel identifier includes, but is not limited to, the channel name and channel code. The aforementioned physical address is the physical address where the data publisher caches the target data. Optionally, the data publisher may employ a multi-caching mechanism to cache the target data at the target physical address.

[0069] Step S308: Read target data based on the target physical address.

[0070] As an optional implementation, after reading the target data based on the target physical address, the virtual device of the first device can also provide a standard hardware abstraction layer to the first user space through kernel mode; the first application of the first device uses the target data through the standard hardware abstraction layer.

[0071] Specifically, by Figure 2It can be seen that Device B's Virtual Device integrates the acquired target data into the DFS Driver (the driver of the distributed soft bus model) located in the Kernel Space, and provides Device HAL (standard hardware abstraction layer) to Device B's User Space. This allows the first application of Device B to use the target data through the standard hardware abstraction layer, thereby avoiding the use of the unified communication interface provided by Device B's user space.

[0072] In this embodiment, a second user state created by a second application on a second device located in a heterogeneous system with the data subscriber is obtained, and this second user state is used as the data publisher; a publishing message transmitted by the data publisher is received; the channel identifier of the target data channel for publishing the target data is determined based on the publishing message, and the target physical address for caching the target data is determined based on the channel identifier; the target data is read based on the target physical address. This effectively solves the interface change problem caused by application operation data in a distributed soft bus framework, and effectively improves the logical compatibility and functional scalability of distributed soft bus applications.

[0073] Example 3

[0074] According to an embodiment of this application, a data publishing apparatus for implementing the above-described data publishing method is also provided, such as... Figure 4 As shown, the data publishing device includes at least: an acquisition module 41, an establishment module 42, and a publishing module 43, wherein:

[0075] The acquisition module 41 is used to acquire the kernel state and the first user state created by the first device in the heterogeneous system with the data publisher, and to use the kernel state and the first user state as the data subscriber.

[0076] Optionally, the data publisher can create a second user space for a second application on a second device within a heterogeneous system. This second user space resides in the second user space of the second device.

[0077] As an optional implementation, the acquisition module 41 acquires the first device in the heterogeneous system using a service discovery protocol; creates a first user state through the first application of the first device, and creates a kernel state through the service driver initialization program corresponding to the virtual device of the first device, wherein the kernel state is in the kernel space of the first device, and the first user state is in the first user space of the first device; and uses the kernel state and the first user state as data subscribers.

[0078] For example, the front-row central control system and the rear-row entertainment system in a smart cockpit are heterogeneous systems. Therefore, we will take the front-row central control system and the rear-row entertainment system in a smart cockpit as examples to explain the data subscriber and the data publisher.

[0079] When a front-seat user starts the car, the front instrument cluster and central control system start up. A second user state is created through the second application of any second device in the front central control system (such as the application corresponding to the central control display). At this time, the second user state can be used as a data publisher. Then, the rear-seat user starts the rear entertainment system, uses the service discovery protocol to obtain any first device in the rear entertainment system (such as a speaker device), and creates a first user state through the first application of the first device (such as the application corresponding to the speaker device). At the same time, the relevant business driver initialization program of the virtual device of the first device creates a kernel state. At this time, the first user state and the kernel state can be used as data subscribers.

[0080] Optionally, the service discovery protocol includes, but is not limited to, the RPMsg protocol.

[0081] Establish module 42 to establish data channels and control channels for implementing service subscriptions with data subscribers.

[0082] Specifically, after the data subscriber is determined, the data publisher and the data subscriber become aware of each other and establish a data channel and a control channel between the data publisher and the data subscriber to realize the service subscription. The difference between the data channel and the control channel is that the data channel is a high-bandwidth channel and the control channel is a low-latency channel.

[0083] Optionally, the data channel includes, but is not limited to, high-bandwidth channels such as memory sharing (within or between systems) and PCIe DMA; the control channel includes, but is not limited to, low-latency channels such as RPMsg (within or between systems) and network.

[0084] The publishing module 43 is used to publish target data to the data subscriber through the data channel and the control channel. The data subscriber is used to receive the publishing message of the target data, obtain the channel identifier of the target data channel for transmitting the target data according to the publishing message, and determine the target physical address for caching the target data according to the channel identifier, so as to read the target data.

[0085] The aforementioned channel identifiers include, but are not limited to, the channel name and the channel code.

[0086] Alternatively, a multi-caching mechanism can be used to cache the target data to the target physical address.

[0087] As an optional implementation, before publishing the target data to the data subscriber through the data channel and the control channel, the publishing module 43 may also send a publishing message to the data subscriber in a target form, wherein the publishing message is used to notify the data subscriber to receive the target data, and the target form includes at least one of the following: broadcast or unicast.

[0088] Specifically, when there are multiple data subscribers, the data publisher only publishes data sequentially. Therefore, the data publisher will use methods such as broadcasting or polling data subscribers to notify all data subscribers to receive the target data.

[0089] It should be noted that each module in the data publishing device in this application embodiment corresponds one-to-one with each implementation step of the data publishing method in embodiment 1. Since embodiment 1 has been described in detail, some details not shown in this embodiment can be referred to embodiment 1, and will not be elaborated further here.

[0090] Example 4

[0091] According to an embodiment of this application, a data subscription apparatus for implementing the above-described data subscription method is also provided. Figure 5 This is a schematic diagram of an optional data subscription device according to an embodiment of this application, such as... Figure 5 As shown, the data subscription device includes at least: an acquisition module 51, a receiving module 52, a determination module 53, and a reading module 54, wherein:

[0092] The acquisition module 51 is used to acquire the second user state created by the second application of the second device in the heterogeneous system with the data subscriber, and to use the second user state as the data publisher.

[0093] Optionally, a service discovery protocol is used to obtain the first device in the heterogeneous system; a first user space is created through the first application of the first device, and a kernel space is created through the business driver initialization program corresponding to the virtual device of the first device, wherein the kernel space is in the kernel space of the first device, and the first user space is in the first user space of the first device; the kernel space and the first user space are used as data subscribers.

[0094] For example, the front-row central control system and the rear-row entertainment system in a smart cockpit are heterogeneous systems. Therefore, we will take the front-row central control system and the rear-row entertainment system in a smart cockpit as examples to explain the data subscriber and the data publisher.

[0095] When a front-seat user starts the car, the front instrument cluster and central control system start up. A second user state is created through the second application of any second device in the front central control system (such as the application corresponding to the central control display). At this time, the second user state can be used as a data publisher. Then, the rear-seat user starts the rear entertainment system, uses the service discovery protocol to obtain any first device in the rear entertainment system (such as a speaker device), and creates a first user state through the first application of the first device (such as the application corresponding to the speaker device). At the same time, the relevant business driver initialization program of the virtual device of the first device creates a kernel state. At this time, the first user state and the kernel state can be used as data subscribers.

[0096] Optionally, the service discovery protocol includes, but is not limited to, the RPMsg protocol.

[0097] The receiving module 52 is used to receive the publishing message transmitted by the data publisher.

[0098] The determination module 53 is used to determine the channel identifier of the target data channel for publishing target data based on the publishing message, and to determine the target physical address for caching target data based on the channel identifier.

[0099] The aforementioned channel identifier includes, but is not limited to, the channel name and channel code. The aforementioned physical address is the physical address where the data publisher caches the target data. Optionally, the data publisher may employ a multi-caching mechanism to cache the target data at the target physical address.

[0100] Read module 54 is used to read target data based on the target physical address.

[0101] As an optional implementation, after the reading module 54 reads the target data based on the target physical address, the virtual device of the first device can also provide a standard hardware abstraction layer to the target device through kernel mode; the first application of the first device uses the target data through the standard hardware abstraction layer.

[0102] Specifically, by Figure 2 It can be seen that Device B's Virtual Device integrates the acquired target data into the DFS Driver (the driver of the distributed soft bus model) located in the Kernel Space, and provides Device HAL (standard hardware abstraction layer) to Device B's User Space. This allows the first application of Device B to use the target data through the standard hardware abstraction layer, thereby avoiding the use of the unified communication interface provided by Device B's user space.

[0103] It should be noted that each module in the data subscription device in this embodiment corresponds one-to-one with each implementation step of the data subscription method in embodiment 2. Since embodiment 2 has been described in detail, some details not shown in this embodiment can be referred to embodiment 1, and will not be elaborated further here.

[0104] Example 5

[0105] According to an embodiment of this application, a non-volatile storage medium is also provided, which includes a stored program, wherein the device where the non-volatile storage medium is located executes the data publishing method in embodiment 1 or the data subscription method in embodiment 2 by running the program.

[0106] Optionally, the device containing the non-volatile storage medium executes the following steps by running the program: acquiring the kernel state and the first user state created by the first device in a heterogeneous system with the data publisher, and designating the kernel state and the first user state as data subscribers; establishing a data channel and a control channel for service subscription with the data subscriber, wherein the data channel is a high-bandwidth channel and the control channel is a low-latency channel; publishing the target data to the data subscriber through the data channel and the control channel, wherein the data subscriber receives the publishing message of the target data published by the data publisher, obtains the channel identifier of the target data channel for transmitting the target data based on the publishing message, and determines the target physical address for caching the target data based on the channel identifier, so as to read the target data.

[0107] Optionally, the device containing the non-volatile storage medium executes the following steps by running the program: obtaining a second user state created by a second application of a second device located in a heterogeneous system with the data subscriber, and using the second user state as the data publisher; receiving a publishing message transmitted by the data publisher; determining the channel identifier of the target data channel for publishing the target data based on the publishing message, and determining the target physical address for caching the target data based on the channel identifier; and reading the target data based on the target physical address.

[0108] According to an embodiment of this application, a processor is also provided for running a program, wherein the program executes the data publishing method in embodiment 1 or the data subscription method in embodiment 2 during runtime.

[0109] Optionally, the program executes the following steps during runtime: obtaining the kernel state and the first user state created by the first device in a heterogeneous system with the data publisher, and using the kernel state and the first user state as the data subscriber; establishing a data channel and a control channel for service subscription with the data subscriber, wherein the data channel is a high-bandwidth channel and the control channel is a low-latency channel; publishing the target data to the data subscriber through the data channel and the control channel, wherein the data subscriber is used to receive the publishing message of the target data published by the data publisher, obtain the channel identifier of the target data channel for transmitting the target data according to the publishing message, and determine the target physical address for caching the target data according to the channel identifier, so as to read the target data.

[0110] Optionally, the program executes the following steps during runtime: obtaining a second user state created by a second application on a second device located in a heterogeneous system with the data subscriber, and using the second user state as the data publisher; receiving a publishing message transmitted by the data publisher; determining the channel identifier of the target data channel for publishing the target data based on the publishing message, and determining the target physical address for caching the target data based on the channel identifier; and reading the target data based on the target physical address.

[0111] According to an embodiment of this application, an electronic device is also provided, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the data publishing method in Embodiment 1 or the data subscription method in Embodiment 2 through the computer program.

[0112] Optionally, the processor is configured to execute the following steps via a computer program: acquiring a kernel state and a first user state created by a first device located in a heterogeneous system with the data publisher, and designating the kernel state and the first user state as data subscribers; establishing a data channel and a control channel for service subscription with the data subscriber, wherein the data channel is a high-bandwidth channel and the control channel is a low-latency channel; publishing target data to the data subscriber through the data channel and the control channel, wherein the data subscriber receives the publishing message from the data publisher, obtains the channel identifier of the target data channel for transmitting the target data based on the publishing message, and determines the target physical address for caching the target data based on the channel identifier, so as to read the target data.

[0113] Optionally, the processor is configured to execute the following steps via a computer program: acquire a second user state created by a second application of a second device located in a heterogeneous system with the data subscriber, and use the second user state as the data publisher; receive a publishing message transmitted by the data publisher; determine the channel identifier of the target data channel for publishing the target data based on the publishing message, and determine the target physical address for caching the target data based on the channel identifier; and read the target data based on the target physical address.

[0114] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0115] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0116] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.

[0117] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0118] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0119] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0120] The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A data publishing method, characterized by, The method comprises the following steps: obtaining a kernel state and a first user state created by a first device in a heterogeneous system and taking the kernel state and the first user state as a data subscriber; establishing a data channel and a control channel for realizing service subscription with the data subscriber, wherein the data channel is a high-bandwidth channel and the control channel is a low-latency channel; publishing target data to the data subscriber through the data channel and the control channel, wherein the data subscriber is configured to receive a publishing message of the data publisher publishing target data, obtain a channel identifier of a target data channel transmitting the target data according to the publishing message, and determine a target physical address for caching the target data according to the channel identifier to read the target data; the data subscriber is further configured to provide a standard hardware abstraction layer to a first user space, so that a first application of the first device uses the target data through the standard hardware abstraction layer.

2. The method of claim 1, wherein, The method comprises the following steps: obtaining a kernel state and a first user state created by a first device in a heterogeneous system and taking the kernel state and the first user state as a data subscriber; creating a first user state through a first application of the first device and initializing the kernel state through a business driver of a virtual device corresponding to the first device, wherein the kernel state is in a kernel space of the first device and the first user state is in a first user space of the first device; taking the kernel state and the first user state as the data subscriber.

3. The method of claim 1, wherein, The data publisher is a second user state created by a second application of a second device in the heterogeneous system, wherein the second user state is in a second user space of the second device.

4. The method of claim 1, wherein, The method comprises the following steps: establishing a data channel and a control channel for realizing service subscription with the data subscriber, wherein the data channel comprises at least one of shared memory and PCIe DMA, and the control channel comprises at least one of RPMsg and network.

5. The method of claim 1, wherein, The method further comprises the following steps: caching the target data to a target physical address through a multi-cache mechanism.

6. The method of claim 1, wherein, Before publishing the target data to the data subscriber through the data channel and the control channel, the method further comprises the following steps: sending a publishing message to the data subscriber in a target form, wherein the publishing message is used to notify the data subscriber to receive the target data, and the target form comprises at least one of broadcast and unicast.

7. A data subscription method, characterized by, The method comprises the following steps: obtaining a second user state created by a second application of a second device in a heterogeneous system and taking the second user state as a data publisher; receiving a publishing message transmitted by the data publisher; determining a channel identifier of a target data channel publishing target data according to the publishing message and determining a target physical address for caching the target data according to the channel identifier; reading the target data based on the target physical address; The virtual device of the first device provides a standard hardware abstraction layer to a first user space through a kernel state; and a first application of the first device uses the target data through the standard hardware abstraction layer.

8. The method of claim 7, wherein, The method further comprises: acquiring, by using a service discovery protocol, a first device within the heterogeneous system; creating a first user state by a first application of the first device, and initializing a kernel state by a virtual device of the first device corresponding to a service driver, wherein the kernel state is in a kernel space of the first device, and the first user state is in a first user space of the first device; taking the kernel state and the first user state as the data subscriber.

9. A data publishing apparatus characterized by comprising: comprises: an acquiring module, configured to acquire a kernel state and a first user state created by a first device within a heterogeneous system with a data publisher, and take the kernel state and the first user state as a data subscriber; an establishing module, configured to establish a data channel and a control channel for realizing service subscription with the data subscriber, wherein the data channel is a high-bandwidth channel, and the control channel is a low-latency channel; a publishing module, configured to publish target data to the data subscriber through the data channel and the control channel, wherein the data subscriber is configured to receive a publishing message of the target data published by the data publisher, acquire a channel identifier of a target data channel transmitting the target data according to the publishing message, and determine a target physical address of the target data according to the channel identifier, so as to read the target data; and the data subscriber is further configured to provide a standard hardware abstraction layer to a first user space, so that a first application of the first device uses the target data through the standard hardware abstraction layer.

10. A data subscription apparatus, characterized by, comprises: an acquiring module, configured to acquire a second user state created by a second application of a second device within a heterogeneous system with a data subscriber, and take the second user state as a data publisher; a receiving module, configured to receive a publishing message transmitted by the data publisher; a determining module, configured to acquire a channel identifier of a target data channel publishing target data according to the publishing message, and determine a target physical address of the target data according to the channel identifier; a reading module, configured to read the target data based on the target physical address; The virtual device of the first device provides a standard hardware abstraction layer to a first user space through a kernel state; and a first application of the first device uses the target data through the standard hardware abstraction layer.

11. A non-volatile storage medium, comprising: The non-volatile storage medium comprises a stored program, wherein a device where the non-volatile storage medium is located executes the data publishing method in any one of claims 1 to 6 or the data subscribing method in any one of claims 7 to 8 by running the program.

12. An electronic device, comprising: comprises: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the data publishing method in any one of claims 1 to 6 or the data subscribing method in any one of claims 7 to 8 by using the computer program.

Citation Information

Patent Citations

  • Method and device for publishing subscribe messages

    CN107026878A

  • Message forwarding method and device, memory medium and electronic device

    CN107888500A