Vehicle process communication method and system, vehicle and storage medium

By applying and allocating memory blocks in shared memory, inter-process communication is realized, and the problems of low inter-process communication efficiency and high computing power requirements in the prior art are solved, and communication efficiency is improved and computing power is saved.

CN119862053APending Publication Date: 2025-04-22CHONGQING CHANGAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510057900.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

In the prior art, inter-process communication efficiency is low and computing power demands are large, resulting in a large amount of time and computing power being consumed during the communication process.

Method used

By applying for and allocating storage blocks in shared memory, the data sending process converts the data to be sent into a data object and a pointer, and generates notification information. The data receiving process reads the data object from the shared memory based on the notification information to obtain the data to be sent.

Benefits of technology

This method eliminates the serialization and deserialization of data encoding and deserialization, as well as the memory data copying operations across processes, improving communication efficiency and saving computing power.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862053A_ABST
    Figure CN119862053A_ABST
Patent Text Reader

Abstract

The invention relates to a vehicle process communication method and system, a vehicle and a storage medium, and the method comprises the steps: a data sending process responds to the writing of to-be-sent data, and applies for a storage block from a shared memory; the shared memory allocates a target storage block based on the to-be-sent data, and the data sending process converts the to-be-sent data into a data object and a corresponding pointer based on the target storage block, converts the pointer into a relative offset, and generates notification information based on the relative offset and the name of the data object; and when the data receiving process receives the notification information, reading the data object from the shared memory to obtain the data to be sent. Through the embodiment of the invention, the inter-process communication efficiency can be improved, and the computing power is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of vehicle assisted driving technology, and in particular to a vehicle process communication method, a vehicle operating system, a vehicle and a computer-readable storage medium. Background Art

[0002] In recent years, the application of vehicle assisted driving systems has become increasingly common, and its core is an embedded computer system. The process of process communication usually involves the sending process initiating data object serialization to shared memory, and the receiving process initiating deserialization to decode the data object from shared memory, and finally realizing the information transmission between the sender and the receiver. However, data exchange protocols such as serialization and deserialization require a large number of data element encoding and decoding operations in this process, which consumes time and computing power. Summary of the invention

[0003] One of the purposes of the present invention is to provide a vehicle process communication method to solve the problems of low efficiency and high computing power demand in the prior art in inter-process communication; the second purpose is to provide a vehicle operating system; the third purpose is to provide a vehicle; and the fourth purpose is to provide a computer-readable storage medium.

[0004] In order to achieve the above object, the technical solution adopted by the present invention is as follows:

[0005] A vehicle process communication method is applied to a vehicle operating system, wherein the vehicle operating system includes a data sending process, a data receiving process and a shared memory, and the method includes:

[0006] The data sending process applies for a storage block from the shared memory in response to writing of the data to be sent;

[0007] The shared memory allocates a target storage block based on the data to be sent;

[0008] The data sending process converts the data to be sent into a data object and a corresponding pointer based on the target storage block, converts the pointer into a relative offset, and generates notification information based on the relative offset and the name of the data object;

[0009] When receiving the notification information, the data receiving process reads the data object from the shared memory to obtain the data to be sent.

[0010] Optionally, the method further comprises:

[0011] The data sending process divides the shared memory into a plurality of storage blocks;

[0012] The shared memory records the storage status of the multiple storage blocks and generates a storage occupancy table.

[0013] Optionally, the step of allocating a target storage block by the shared memory based on the data to be sent includes:

[0014] The shared memory searches the storage occupancy table based on the size of the data to be sent to determine the target storage block.

[0015] Optionally, the step of converting the data to be sent into a data object and a corresponding pointer based on the target storage block in the data sending process includes:

[0016] The data sending process performs data object initialization for the target storage block;

[0017] The data sending process determines the storage address corresponding to the target storage block;

[0018] After completing the data object initialization, the data sending process writes the data to be sent to the storage address to construct the data object;

[0019] The data sending process generates a pointer based on a storage address corresponding to the target storage block.

[0020] Optionally, the step of converting the pointer into a relative offset comprises:

[0021] Calculate the original offset between the storage address corresponding to the target storage block and the template object address of the shared memory;

[0022] The original offset is determined as a relative offset.

[0023] Optionally, the step of generating notification information based on the relative offset and the name of the data object includes:

[0024] The relative offset and the name of the data object are written into a preset message queue to generate notification information.

[0025] Optionally, when the data receiving process receives the notification information, the step of reading the data object from the shared memory to obtain the data to be sent includes:

[0026] When receiving the notification information, the data receiving process obtains a data receiving definition template;

[0027] The data receiving process searches and determines the data object in the shared memory according to the relative offset and the name of the data object;

[0028] The data receiving process reconstructs the data object based on the data receiving definition template to obtain the data to be sent.

[0029] Optionally, the step of the data receiving process querying and determining the data object in the shared memory according to the relative offset and the name of the data object includes:

[0030] The data receiving process converts the relative offset into the pointer;

[0031] The data receiving process determines the data object based on the pointer and the name of the data object.

[0032] Optionally, the method further comprises:

[0033] The shared memory releases the target storage block after the data receiving process finishes reading.

[0034] A vehicle operating system includes a data sending process, a data receiving process and a shared memory.

[0035] The data sending process is used to apply for a storage block from the shared memory in response to writing of data to be sent;

[0036] The shared memory is used to allocate a target storage block based on the data to be sent;

[0037] The data sending process is used to convert the data to be sent into a data object and a corresponding pointer based on the target storage block, convert the pointer into a relative offset, and generate notification information based on the relative offset and the name of the data object;

[0038] The data receiving process is used to read the data object from the shared memory when receiving the notification information, so as to obtain the data to be sent.

[0039] A vehicle comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the steps of the vehicle process communication method as described above when executed by the processor.

[0040] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the vehicle process communication method described above are implemented.

[0041] Beneficial effects of the present invention:

[0042] In an embodiment of the present invention, the data sending process and the data receiving process write and read data in the shared memory. During the communication between the data sending process and the data receiving process, information is exchanged only through the relative offset and the name of the data object carried by the notification information. The data receiving process can read the data object from the shared memory based on the notification information to obtain the data to be sent, thereby completing a process communication process. During this process, the data sending process does not need to serialize the data object, and the data receiving process does not need to perform corresponding deserialization. The data object is constructed and used in the storage space of the shared memory, which not only eliminates the data encoding and decoding process of serialization and deserialization, but also eliminates the memory data copy operation across processes, thereby improving communication efficiency and saving computing power. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A flow chart of the steps of an embodiment of a vehicle process communication method of the present invention;

[0044] Figure 2 A flowchart of another vehicle process communication method embodiment of the present invention;

[0045] Figure 3 A schematic structural diagram of an example of a vehicle process communication method of the present invention;

[0046] Figure 4 A flowchart of an exemplary vehicle process communication method of the present invention;

[0047] Figure 5 A structural block diagram of an embodiment of a vehicle operating system of the present invention;

[0048] Figure 6 A schematic diagram of a processor and a storage medium of a vehicle embodiment of the present invention;

[0049] Figure 7 A schematic diagram of an embodiment of a computer-readable storage medium of the present invention. DETAILED DESCRIPTION

[0050] The following will describe the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.

[0051] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0052] Reference Figure 1 , shows a flow chart of the steps of an embodiment of a vehicle process communication method of the present invention. The vehicle process communication method is applied to a vehicle operating system, the vehicle operating system includes a data sending process, a data receiving process and a shared memory, and the vehicle process communication method may specifically include the following steps:

[0053] Step 101, the data sending process applies for a storage block from the shared memory in response to writing of data to be sent;

[0054] When data is written and needs to be sent to the data receiving process, the data sending process can apply for a storage block from the shared memory in response to the writing of the data to be sent.

[0055] Step 102, the shared memory allocates a target storage block based on the data to be sent;

[0056] The shared memory allocates a suitable storage block based on the content of the data to be sent, and this storage block is the target storage block.

[0057] Step 103, the data sending process converts the data to be sent into a data object and a corresponding pointer based on the target storage block, converts the pointer into a relative offset, and generates notification information based on the relative offset and the name of the data object;

[0058] The data sending process can write the data to be sent into the target storage block according to the allocated target storage block, convert it into a data object and a corresponding pointer, and then convert the pointer into a relative offset, and combine the relative offset and the name of the data object with the notification information.

[0059] Step 104: When receiving the notification information, the data receiving process reads the data object from the shared memory to obtain the data to be sent.

[0060] When receiving the notification information, the data receiving process can find the data object from the shared memory based on the relative offset and the name of the data object in the notification information, read the data object to reconstruct the data, obtain the data to be sent, and complete the communication between processes.

[0061] In an embodiment of the present invention, the data sending process and the data receiving process write and read data in the shared memory. During the communication between the data sending process and the data receiving process, information is exchanged only through the relative offset and the name of the data object carried by the notification information. The data receiving process can read the data object from the shared memory based on the notification information to obtain the data to be sent, thereby completing a process communication process. During this process, the data sending process does not need to serialize the data object, and the data receiving process does not need to perform corresponding deserialization. The data object is constructed and used in the storage space of the shared memory, which not only eliminates the data encoding and decoding process of serialization and deserialization, but also eliminates the memory data copy operation across processes, thereby improving communication efficiency and saving computing power.

[0062] Reference Figure 2 , shows a flow chart of steps of another embodiment of a vehicle process communication method of the present invention. The vehicle process communication method is applied to a vehicle operating system, which includes a data sending process, a data receiving process and a shared memory.

[0063] In an embodiment of the present invention, the vehicle operating system is an operating system for auxiliary driving control on a vehicle. The vehicle operating system may include a data sending process, a data receiving process and a shared memory. Both the data sending process and the data receiving process are connected to the shared memory, and both the data sending process and the data receiving process can interact with the shared memory for data. The data sending process is a process for sending data. The data receiving process is a process for receiving data.

[0064] The vehicle process communication method may specifically include the following steps:

[0065] Step 201, the data sending process applies for a storage block from the shared memory in response to writing of data to be sent;

[0066] When inter-process communication is required, that is, when the data to be sent is written, the data sending process responds to the writing of the data to be sent, the data sending process starts, and calls the interface of the vehicle operating system to apply for a storage block from the shared memory, using a unique name identifier when applying. The data receiving process starts and calls the operating system interface to specify the corresponding name identifier to open the shared memory space and read the data.

[0067] Step 202, the data sending process divides the shared memory into multiple storage blocks;

[0068] In the embodiment of the present invention, the data sending process also divides the shared memory into multiple storage blocks. That is, the data sending process can divide the shared memory space into a number of storage blocks of different sizes for use. These storage blocks can be called through a related API (Application Programming Interface).

[0069] For example, void*shm_malloc(size_t size); / / Similar to the standard library malloc function, it searches for a free memory block from the shared memory space and allocates it to the data object in the form of a pointer, and after the allocation is completed, it marks the memory block as occupied in the internal table; or void shm_free(void*ptr); / / Similar to the standard library free function, it re-marks the memory block no longer occupied by the data object as free.

[0070] Step 203, the shared memory records the storage status of the multiple storage blocks and generates a storage occupancy table;

[0071] After being divided into multiple storage blocks, a table can be used to record whether each memory block is occupied by a data object, that is, the storage status of multiple storage blocks is recorded to generate a storage occupancy table. The storage occupancy table is used to display the status of the storage block.

[0072] Step 204, the shared memory allocates a target storage block based on the data to be sent;

[0073] Then, based on the content of the data to be sent, the memory space required by the elements of the data to be sent is dynamically allocated, that is, at least one storage block that satisfies the data to be sent is selected from multiple storage blocks of the shared memory as the target storage block.

[0074] Specifically, the step of allocating a target storage block by the shared memory based on the data to be sent includes: the shared memory searches the storage occupancy table based on the size of the data to be sent to determine the target storage block.

[0075] Based on the size of the data to be sent, the shared memory searches the storage occupancy table for a free storage block that meets the required size, namely, the target storage block.

[0076] Step 205, the data sending process converts the data to be sent into a data object and a corresponding pointer based on the target storage block, converts the pointer into a relative offset, and generates notification information based on the relative offset and the name of the data object;

[0077] In the embodiment of the present invention, the data sending process can write the data to be sent on the target storage block, construct a data object and a corresponding pointer, convert the pointer into a relative offset, and combine the relative offset with the name of the data object to generate notification information.

[0078] In an optional embodiment of the present invention, the step of converting the data to be sent into a data object and a corresponding pointer based on the target storage block comprises: the data sending process initializes the data object for the target storage block; the data sending process determines the storage address corresponding to the target storage block; after completing the data object initialization, the data sending process writes the data to be sent at the storage address to construct a data object; the data sending process generates a pointer based on the storage address corresponding to the target storage block.

[0079] For the generation of pointers, a pointer to a data object can be reconstructed based on the unique identification name of the shared memory space and the offset address of the data object in the shared memory space. The data sending process performs data object initialization on the target storage block, such as template<typename T,typename...Args>

[0080] inline T*create(Args...args){

[0081] void*ptr=shm_malloc(sizeof(T));

[0082] return new(ptr)T(std::forward <args>(args)...);

[0083] }

[0084] Then write the data to be sent on the storage address, call the create template method to build the data object; the data sending process generates a pointer based on the storage address corresponding to the target storage block.

[0085] In addition, pointers can be declared in advance, such as: const RadarFreeSpace*rebuild(constchar*shm_name,int64_t offset);

[0086] In an optional embodiment of the invention, the step of converting the pointer into a relative offset includes: calculating the original offset between the storage address corresponding to the target storage block and the template object address of the shared memory; and determining the original offset as a relative offset.

[0087] Among them, for the conversion with relative offset, the original offset between the storage address corresponding to the target storage block and the template object address of the shared memory can be calculated; the original offset is determined as the relative offset. That is, an integer can be used to record the relative offset between the storage address and the template object address, so that when the data receiving process reconstructs the array object, the storage address of the array element can be obtained according to the relative offset.

[0088] In an optional embodiment of the invention, the step of generating notification information based on the relative offset and the name of the data object includes:

[0089] The relative offset and the name of the data object are written into a preset message queue to generate notification information.

[0090] The data sending process can call the message queue interface of the operating system to initiate a communication process to notify the data receiving process to receive data. The sending process writes the relative offset of the shared memory space where the data object is located and the name of the data object into the message queue to generate a notification for the data receiving process to receive data.

[0091] Step 206, when receiving the notification information, the data receiving process reads the data object from the shared memory to obtain the data to be sent;

[0092] When the notification information is received, it means that the data sending process has written the data into the shared memory, and the data can be read. The data object can be read from the shared memory to obtain the data to be sent.

[0093] In an optional embodiment of the present invention, when the data receiving process receives the notification information, the step of reading the data object from the shared memory to obtain the data to be sent includes: when the data receiving process receives the notification information, obtaining the data receiving definition template; the data receiving process queries and determines the data object in the shared memory based on the relative offset and the name of the data object; the data receiving process reconstructs the data object based on the data receiving definition template to obtain the data to be sent.

[0094] The data receiving process can obtain the data receiving definition template when receiving the notification information. The data receiving definition template can be a proto file. For example, the radar point set definition file radar.proto is as follows:

[0095] syntax="proto3";

[0096] package RadarProto;

[0097] message RadarFsPoint

[0098] {

[0099] double lng_distance = 1;

[0100] double lat_distance=2;

[0101] }

[0102] message RadarFreeSpace

[0103] {

[0104] double timestamp=1;

[0105] repeated RadarFsPoint points=2;

[0106] int32 frame_index = 3;

[0107] }

[0108] The data receiving process searches and determines the data object in the shared memory according to the relative offset and the name of the data object; the data receiving process reconstructs the data object based on the data receiving definition template to obtain the data to be sent.

[0109] In addition, related operations can be performed during the receiving process, and parameters can be set to obtain data. The proto file can be used as input to output the corresponding data structure definition and operation method, where the data type definition and operation method declaration are output to the C++ header file (.h), and the data operation method implementation is output to the C++ source file (.cpp).

[0110] Among them, the step of the data receiving process querying and determining the data object in the shared memory according to the relative offset and the name of the data object includes: the data receiving process converting the relative offset into the pointer; the data receiving process determining the data object based on the pointer and the name of the data object.

[0111] The data receiving process can call the operating system message queue interface to obtain the relative offset of the shared memory space, and then call the rebuild method of the data object to obtain the pointer of the data object. Then, based on the pointer and the name of the data object, the data object to be rebuilt is determined, the data object is rebuilt, and the corresponding data is obtained.

[0112] Step 207: After the data receiving process has finished reading, the shared memory releases the target storage block.

[0113] After the data receiving process finishes reading the data, the target storage block can be released, so that the storage block can continue to participate in subsequent communications.

[0114] In the embodiment of the present invention, in response to the writing of data to be sent, the data sending process applies for a storage block from the shared memory; the data sending process divides the shared memory into multiple storage blocks; the shared memory records the storage status of the multiple storage blocks and generates a storage occupancy table; the shared memory allocates a target storage block based on the data to be sent; the data sending process converts the data to be sent into a data object and a corresponding pointer based on the target storage block, converts the pointer into a relative offset, and generates notification information based on the relative offset and the name of the data object; when receiving the notification information, the data receiving process reads the data object from the shared memory to obtain the data to be sent; and the shared memory releases the target storage block after the data receiving process completes the reading. During one communication, the data sending process and the data receiving process only need to transmit the relative offset and name. The data volume is small and does not need to be serialized. The data object is constructed, used and then destroyed in the shared memory space, eliminating the data encoding and decoding process of serialization and deserialization, and also eliminating the memory data copy operation across processes, thereby improving communication efficiency and saving computing power. In addition, by transmitting relative offsets instead of pointers to calculate the actual storage address, data can be shared between different processes without worrying about invalid pointers generated during the shared memory address mapping process, thereby improving the effectiveness of inter-process communication and reducing the probability of packet loss and errors.

[0115] In order to make the implementation process of the embodiment of the present invention more clear to those skilled in the art, an example is used to illustrate as follows:

[0116] like Figure 3 As shown, the operating system architecture of the present invention is: the data sending process (process 1) applies for a shared memory space (i.e., shared content), and uses a unique name identifier when applying. When the data receiving process is started, the operating system interface can also be called to specify the corresponding name identifier to open the above-mentioned shared memory space. For a shared memory space with a specific name identifier, there is only one associated data sending process, but there can be several data receiving processes.

[0117] Reference Figure 4 , taking process 1 as the data sending process and process 2 as the data receiving process for explanation. First, both process 1 and process 2 are started. After starting, process 1 applies for shared memory space. Constructs a data object in the shared memory space and generates a corresponding sending notification to the message queue. Process 2 starts monitoring the message queue and waits for notification. Until process 2 receives the data notification. When process 2 receives the data notification, it opens the shared memory space based on the data notification, rebuilds the data object, and obtains the corresponding data to complete a communication between processes.

[0118] Reference Figure 5 , shows a structural block diagram of an embodiment of a vehicle operating system of the present invention, wherein the vehicle operating system includes a data sending process 501, a data receiving process 502 and a shared memory 503,

[0119] The data sending process 501 is used to apply for a storage block from the shared memory 503 in response to the writing of the data to be sent;

[0120] The shared memory 503 is used to allocate a target storage block based on the data to be sent;

[0121] The data sending process 501 is used to convert the data to be sent into a data object and a corresponding pointer based on the target storage block, convert the pointer into a relative offset, and generate notification information based on the relative offset and the name of the data object;

[0122] The data receiving process 502 is used to read the data object from the shared memory 503 when receiving the notification information, so as to obtain the data to be sent.

[0123] In an optional embodiment of the present invention, it also includes:

[0124] The data sending process 501 is used to divide the shared memory 503 into multiple storage blocks;

[0125] The shared memory 503 is used to record the storage status of the multiple storage blocks and generate a storage occupancy table.

[0126] In an optional embodiment of the present invention, the shared memory 503 is used to query the storage occupancy table based on the size of the data to be sent to determine the target storage block.

[0127] In an optional embodiment of the present invention, the data sending process 501 is used to initialize the data object for the target storage block;

[0128] The data sending process 501 is used to determine the storage address corresponding to the target storage block;

[0129] The data sending process 501 is used to write the data to be sent to the storage address and construct the data object after completing the data object initialization;

[0130] The data sending process 501 is used to generate a pointer based on the storage address corresponding to the target storage block.

[0131] In an optional embodiment of the present invention, the data sending process 501 is used to calculate the original offset between the storage address corresponding to the target storage block and the template object address of the shared memory 503;

[0132] The data sending process 501 is used to determine the original offset as a relative offset.

[0133] In an optional embodiment of the present invention, the data sending process 501 is used to write the relative offset and the name of the data object into a preset message queue to generate notification information.

[0134] In an optional embodiment of the present invention, the data receiving process 502 is used to obtain a data receiving definition template when receiving the notification information;

[0135] The data receiving process 502 is used to query and determine the data object in the shared memory 503 according to the relative offset and the name of the data object;

[0136] The data receiving process 502 is used to reconstruct the data object based on the data receiving definition template to obtain the data to be sent.

[0137] In an optional embodiment of the present invention, the data receiving process 502 is used to convert the relative offset into the pointer;

[0138] The data receiving process 502 is used to determine the data object based on the pointer and the name of the data object.

[0139] In an optional embodiment of the present invention, it also includes:

[0140] The shared memory 503 is used to release the target storage block after the data receiving process 502 completes reading.

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

[0142] Reference Figure 6 , an embodiment of the present invention further provides a vehicle, comprising:

[0143] A processor 601 and a storage medium 602, wherein the storage medium 602 stores a computer program executable by the processor 601, and when the vehicle is running, the processor 601 executes the computer program to perform the vehicle process communication method as described in any one of the embodiments of the present invention.

[0144] The vehicle process communication method is applied to a vehicle operating system, the vehicle operating system includes a data sending process, a data receiving process and a shared memory, and the method includes:

[0145] The data sending process applies for a storage block from the shared memory in response to writing of the data to be sent;

[0146] The shared memory allocates a target storage block based on the data to be sent;

[0147] The data sending process converts the data to be sent into a data object and a corresponding pointer based on the target storage block, converts the pointer into a relative offset, and generates notification information based on the relative offset and the name of the data object;

[0148] When receiving the notification information, the data receiving process reads the data object from the shared memory to obtain the data to be sent.

[0149] Optionally, it also includes:

[0150] The data sending process divides the shared memory into a plurality of storage blocks;

[0151] The shared memory records the storage status of the multiple storage blocks and generates a storage occupancy table.

[0152] Optionally, the step of allocating a target storage block by the shared memory based on the data to be sent includes:

[0153] The shared memory searches the storage occupancy table based on the size of the data to be sent to determine the target storage block.

[0154] Optionally, the step of converting the data to be sent into a data object and a corresponding pointer based on the target storage block in the data sending process includes:

[0155] The data sending process performs data object initialization for the target storage block;

[0156] The data sending process determines the storage address corresponding to the target storage block;

[0157] After completing the data object initialization, the data sending process writes the data to be sent to the storage address to construct the data object;

[0158] The data sending process generates a pointer based on a storage address corresponding to the target storage block.

[0159] Optionally, the step of converting the pointer into a relative offset comprises:

[0160] Calculate the original offset between the storage address corresponding to the target storage block and the template object address of the shared memory;

[0161] The original offset is determined as a relative offset.

[0162] Optionally, the step of generating notification information based on the relative offset and the name of the data object includes:

[0163] The relative offset and the name of the data object are written into a preset message queue to generate notification information.

[0164] Optionally, when the data receiving process receives the notification information, the step of reading the data object from the shared memory to obtain the data to be sent includes:

[0165] When receiving the notification information, the data receiving process obtains a data receiving definition template;

[0166] The data receiving process searches and determines the data object in the shared memory according to the relative offset and the name of the data object;

[0167] The data receiving process reconstructs the data object based on the data receiving definition template to obtain the data to be sent.

[0168] Optionally, the step of the data receiving process querying and determining the data object in the shared memory according to the relative offset and the name of the data object includes:

[0169] The data receiving process converts the relative offset into the pointer;

[0170] The data receiving process determines the data object based on the pointer and the name of the data object.

[0171] Optionally, the method further comprises:

[0172] The shared memory releases the target storage block after the data receiving process finishes reading.

[0173] In an embodiment of the present invention, the data sending process and the data receiving process write and read data in the shared memory. During the communication between the data sending process and the data receiving process, information is exchanged only through the relative offset and the name of the data object carried by the notification information. The data receiving process can read the data object from the shared memory based on the notification information to obtain the data to be sent, thereby completing a process communication process. During this process, the data sending process does not need to serialize the data object, and the data receiving process does not need to perform corresponding deserialization. The data object is constructed and used in the storage space of the shared memory, which not only eliminates the data encoding and decoding process of serialization and deserialization, but also eliminates the memory data copy operation across processes, thereby improving communication efficiency and saving computing power.

[0174] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor.

[0175] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0176] Reference Figure 7 The embodiment of the present invention further provides a computer-readable storage medium 701, on which a computer program is stored. When the computer program is executed by a processor, the vehicle process communication method as described in any one of the embodiments of the present invention is executed.

[0177] The vehicle process communication method is applied to a vehicle operating system, the vehicle operating system includes a data sending process, a data receiving process and a shared memory, and the method includes:

[0178] The data sending process applies for a storage block from the shared memory in response to writing of the data to be sent;

[0179] The shared memory allocates a target storage block based on the data to be sent;

[0180] The data sending process converts the data to be sent into a data object and a corresponding pointer based on the target storage block, converts the pointer into a relative offset, and generates notification information based on the relative offset and the name of the data object;

[0181] When receiving the notification information, the data receiving process reads the data object from the shared memory to obtain the data to be sent.

[0182] Optionally, it also includes:

[0183] The data sending process divides the shared memory into a plurality of storage blocks;

[0184] The shared memory records the storage status of the multiple storage blocks and generates a storage occupancy table.

[0185] Optionally, the step of allocating a target storage block by the shared memory based on the data to be sent includes:

[0186] The shared memory searches the storage occupancy table based on the size of the data to be sent to determine the target storage block.

[0187] Optionally, the step of converting the data to be sent into a data object and a corresponding pointer based on the target storage block in the data sending process includes:

[0188] The data sending process performs data object initialization for the target storage block;

[0189] The data sending process determines the storage address corresponding to the target storage block;

[0190] After completing the data object initialization, the data sending process writes the data to be sent to the storage address to construct the data object;

[0191] The data sending process generates a pointer based on a storage address corresponding to the target storage block.

[0192] Optionally, the step of converting the pointer into a relative offset comprises:

[0193] Calculate the original offset between the storage address corresponding to the target storage block and the template object address of the shared memory;

[0194] The original offset is determined as a relative offset.

[0195] Optionally, the step of generating notification information based on the relative offset and the name of the data object includes:

[0196] The relative offset and the name of the data object are written into a preset message queue to generate notification information.

[0197] Optionally, when the data receiving process receives the notification information, the step of reading the data object from the shared memory to obtain the data to be sent includes:

[0198] When receiving the notification information, the data receiving process obtains a data receiving definition template;

[0199] The data receiving process searches and determines the data object in the shared memory according to the relative offset and the name of the data object;

[0200] The data receiving process reconstructs the data object based on the data receiving definition template to obtain the data to be sent.

[0201] Optionally, the step of the data receiving process querying and determining the data object in the shared memory according to the relative offset and the name of the data object includes:

[0202] The data receiving process converts the relative offset into the pointer;

[0203] The data receiving process determines the data object based on the pointer and the name of the data object.

[0204] Optionally, the method further comprises:

[0205] The shared memory releases the target storage block after the data receiving process finishes reading.

[0206] In an embodiment of the present invention, the data sending process and the data receiving process write and read data in the shared memory. During the communication between the data sending process and the data receiving process, information is exchanged only through the relative offset and the name of the data object carried by the notification information. The data receiving process can read the data object from the shared memory based on the notification information to obtain the data to be sent, thereby completing a process communication process. During this process, the data sending process does not need to serialize the data object, and the data receiving process does not need to perform corresponding deserialization. The data object is constructed and used in the storage space of the shared memory, which not only eliminates the data encoding and decoding process of serialization and deserialization, but also eliminates the memory data copy operation across processes, thereby improving communication efficiency and saving computing power.

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

[0208] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

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

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

[0211] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0212] The above embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Any equivalent substitution or change made by a person skilled in the art based on the present invention is within the protection scope of the present invention.< / args>

Claims

1. A vehicle process communication method, characterized in that: Applied to a vehicle operating system, the vehicle operating system includes a data sending process, a data receiving process and a shared memory, and the method includes: The data sending process applies for a storage block from the shared memory in response to writing of the data to be sent; The shared memory allocates a target storage block based on the data to be sent; The data sending process converts the data to be sent into a data object and a corresponding pointer based on the target storage block, converts the pointer into a relative offset, and generates notification information based on the relative offset and the name of the data object; When receiving the notification information, the data receiving process reads the data object from the shared memory to obtain the data to be sent.

2. The method according to claim 1, characterized in that The method further comprises: The data sending process divides the shared memory into a plurality of storage blocks; The shared memory records the storage status of the multiple storage blocks and generates a storage occupancy table.

3. The method according to claim 1, characterized in that The step of allocating a target storage block based on the data to be sent comprises: The shared memory searches the storage occupancy table based on the size of the data to be sent to determine the target storage block.

4. The method according to claim 1, characterized in that The data sending process converts the data to be sent into a data object and a corresponding pointer based on the target storage block, comprising: The data sending process performs data object initialization for the target storage block; The data sending process determines the storage address corresponding to the target storage block; After completing the data object initialization, the data sending process writes the data to be sent to the storage address to construct the data object; The data sending process generates a pointer based on a storage address corresponding to the target storage block.

5. The method according to claim 4, characterized in that The step of converting the pointer into a relative offset comprises: Calculate the original offset between the storage address corresponding to the target storage block and the template object address of the shared memory; The original offset is determined as a relative offset.

6. The method according to claim 1, characterized in that The step of generating notification information based on the relative offset and the name of the data object comprises: The relative offset and the name of the data object are written into a preset message queue to generate notification information.

7. The method according to claim 5, characterized in that When the data receiving process receives the notification information, the step of reading the data object from the shared memory to obtain the data to be sent includes: When receiving the notification information, the data receiving process obtains a data receiving definition template; The data receiving process searches and determines the data object in the shared memory according to the relative offset and the name of the data object; The data receiving process reconstructs the data object based on the data receiving definition template to obtain the data to be sent.

8. The method according to claim 7, characterized in that The step of the data receiving process querying and determining the data object in the shared memory according to the relative offset and the name of the data object comprises: The data receiving process converts the relative offset into the pointer; The data receiving process determines the data object based on the pointer and the name of the data object.

9. The method according to claim 1, characterized in that: The method further comprises: The shared memory releases the target storage block after the data receiving process finishes reading.

10. A vehicle operating system, characterized in that: Including data sending process, data receiving process and shared memory, The data sending process is used to apply for a storage block from the shared memory in response to writing of data to be sent; The shared memory is used to allocate a target storage block based on the data to be sent; The data sending process is used to convert the data to be sent into a data object and a corresponding pointer based on the target storage block, convert the pointer into a relative offset, and generate notification information based on the relative offset and the name of the data object; The data receiving process is used to read the data object from the shared memory when receiving the notification information, so as to obtain the data to be sent.

11. A vehicle, characterized in that: The vehicle process communication method comprises a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the vehicle process communication method according to any one of claims 1 to 9 are implemented.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the vehicle process communication method according to any one of claims 1 to 9 are implemented.