Movatterモバイル変換


[0]ホーム

URL:


CN115878351B - Message transmission method and device, storage medium and electronic device - Google Patents

Message transmission method and device, storage medium and electronic device
Download PDF

Info

Publication number
CN115878351B
CN115878351BCN202310199164.0ACN202310199164ACN115878351BCN 115878351 BCN115878351 BCN 115878351BCN 202310199164 ACN202310199164 ACN 202310199164ACN 115878351 BCN115878351 BCN 115878351B
Authority
CN
China
Prior art keywords
target
address
memory address
identification value
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310199164.0A
Other languages
Chinese (zh)
Other versions
CN115878351A (en
Inventor
张海仑
赵龙
钟戟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co LtdfiledCriticalSuzhou Inspur Intelligent Technology Co Ltd
Priority to CN202310199164.0ApriorityCriticalpatent/CN115878351B/en
Publication of CN115878351ApublicationCriticalpatent/CN115878351A/en
Application grantedgrantedCritical
Publication of CN115878351BpublicationCriticalpatent/CN115878351B/en
Priority to PCT/CN2024/079088prioritypatent/WO2024183587A1/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The embodiment of the application provides a message transmission method and device, a storage medium and an electronic device, wherein the message transmission method comprises the following steps: acquiring a target memory address, wherein the target memory address is a buffer area address of a target buffer area transmitted by a target transmission message to be transmitted; determining an identification value of an address identification corresponding to the target memory address according to the base address and the address unit size to obtain a target identification value; writing the target identification value into a message structure body of the target transmission message, and transmitting the target transmission message to a receiving end of the target transmission message. By the method, the device and the system for transmitting the inter-process communication messages, the problem that message transmission efficiency is low due to overlong messages to be transmitted in the related technology is solved.

Description

Translated fromChinese
消息的传输方法及装置、存储介质及电子装置Message transmission method and device, storage medium and electronic device

技术领域technical field

本申请实施例涉及计算机领域,具体而言,涉及一种消息的传输方法及装置、存储介质及电子装置。The embodiments of the present application relate to the computer field, and in particular, relate to a message transmission method and device, a storage medium, and an electronic device.

背景技术Background technique

目前,对于不同FU(Function Unit,功能单元)之间的通信,通常采用进程间通信的方式,以IPC(Inter-Process Communication,进程间通信)消息作为基本单元。每个IPC消息包含若干个参数,其中内存地址所占的比特数较多。At present, for communication between different FUs (Function Units, functional units), an inter-process communication method is generally adopted, and an IPC (Inter-Process Communication, inter-process communication) message is used as a basic unit. Each IPC message includes several parameters, among which the memory address occupies more bits.

然而,随着NAND(Not AND,是与非,即计算机闪存设备)技术的发展,一个多plane(即,存储矩阵)读写消息需要传递的内存地址的数量越来越多,IPC消息的长度也相应增大,导致读写IPC消息时消耗的资源增加,从而影响了消息的传输效率。However, with the development of NAND (Not AND, that is, computer flash memory device) technology, the number of memory addresses that need to be transmitted for reading and writing messages in a multi-plane (that is, storage matrix) is increasing, and the length of IPC messages is correspondingly increased, resulting in an increase in resources consumed when reading and writing IPC messages, thereby affecting the transmission efficiency of messages.

由此可见,相关技术中的进程间通信消息的传输方法,存在由于需要传输的消息过长导致的消息传输效率低的问题。It can be seen that, the method for transmitting inter-process communication messages in the related art has the problem of low message transmission efficiency due to too long messages to be transmitted.

发明内容Contents of the invention

本申请实施例提供了一种消息的传输方法及装置、存储介质及电子装置,以至少解决相关技术中的进程间通信消息的传输方法存在由于需要传输的消息过长导致的消息传输效率低的问题。Embodiments of the present application provide a message transmission method and device, a storage medium, and an electronic device to at least solve the problem of low message transmission efficiency caused by too long messages to be transmitted in the inter-process communication message transmission method in the related art.

根据本申请的一个实施例,提供了一种消息的传输方法,包括:获取目标内存地址,其中,所述目标内存地址为待传输的目标传输消息所传输的、目标缓冲区的缓冲区地址;根据基地址和地址单元大小,确定与所述目标内存地址对应的地址标识的标识值,得到目标标识值;将所述目标标识值写入到所述目标传输消息的消息结构体,并将所述目标传输消息传输给所述目标传输消息的接收端。According to an embodiment of the present application, a message transmission method is provided, comprising: obtaining a target memory address, wherein the target memory address is a buffer address of a target buffer to be transmitted by a target transfer message; determining an identification value of an address identification corresponding to the target memory address according to a base address and an address unit size to obtain a target identification value; writing the target identification value into a message structure of the target transmission message, and transmitting the target transmission message to a receiving end of the target transmission message.

根据本申请实施例的另一个方面,还提供了一种消息的传输方法,包括:接收发送端发送的目标传输消息;从所述目标传输消息的消息结构体中提取出目标标识值,其中,所述目标标识值是与目标内存地址对应的地址标识的标识值;根据所述目标标识值、基地址和地址单元大小,确定出所述目标内存地址。According to another aspect of the embodiment of the present application, there is also provided a message transmission method, including: receiving a target transfer message sent by a sender; extracting a target identification value from a message structure of the target transmission message, wherein the target identification value is an identification value of an address identification corresponding to a target memory address; and determining the target memory address according to the target identification value, a base address, and an address unit size.

根据本申请的又一个实施例,提供了一种消息的传输装置,包括:第一获取单元,用于获取目标内存地址,其中,所述目标内存地址为待传输的目标传输消息所传输的、目标缓冲区的缓冲区地址;第一确定单元,用于根据基地址和地址单元大小,确定与所述目标内存地址对应的地址标识的标识值,得到目标标识值;第一执行单元,用于将所述目标标识值写入到所述目标传输消息的消息结构体,并将所述目标传输消息传输给所述目标传输消息的接收端。According to yet another embodiment of the present application, a message transmission device is provided, comprising: a first obtaining unit configured to obtain a target memory address, wherein the target memory address is a buffer address of a target buffer to be transmitted by a target transfer message; a first determination unit configured to determine an identification value of an address identification corresponding to the target memory address according to a base address and an address unit size to obtain a target identification value; a first execution unit is configured to write the target identification value into a message structure of the target transmission message, and transmit the target transmission message to a receiving end of the target transmission message.

根据本申请的又一个实施例,还提供了一种消息的传输装置,包括:接收单元,用于接收发送端发送的目标传输消息;提取单元,用于从所述目标传输消息的消息结构体中提取出目标标识值,其中,所述目标标识值是与目标内存地址对应的地址标识的标识值;第三确定单元,用于根据所述目标标识值、基地址和地址单元大小,确定出所述目标内存地址。According to yet another embodiment of the present application, there is also provided a message transmission device, including: a receiving unit, configured to receive a target transfer message sent by a sender; an extraction unit, configured to extract a target identification value from a message structure of the target transmission message, wherein the target identification value is an identification value of an address identification corresponding to a target memory address; a third determining unit, configured to determine the target memory address according to the target identification value, a base address, and an address unit size.

根据本申请的又一个实施例,还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。According to yet another embodiment of the present application, a computer-readable storage medium is also provided, and a computer program is stored in the computer-readable storage medium, wherein the computer program is configured to execute the steps in any one of the above method embodiments when running.

根据本申请的又一个实施例,还提供了一种电子设备,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行上述任一项方法实施例中的步骤。According to yet another embodiment of the present application, there is also provided an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.

通过本申请实施例,采用对消息内存储的内存地址的存储格式进行重构的方式,通过获取目标内存地址,其中,目标内存地址为待传输的目标传输消息所传输的、目标缓冲区的缓冲区地址;根据基地址和地址单元大小,确定与目标内存地址对应的地址标识的标识值,得到目标标识值;将目标标识值写入到目标传输消息的消息结构体,并将目标传输消息传输给目标传输消息的接收端,由于消息内存储的不是原始的内存地址,而是根据预先定义的基地址和地址单元大小所确定出的内存地址对应的标识值(可以用于根据基地址和地址单元大小还原出原始的内存地址),可以有效压缩内存地址在消息内的占用空间,可以实现缩短需要传输的消息的长度的目的,达到提高消息传输效率的技术效果,进而解决了相关技术中的进程间通信消息的传输方法存在由于需要传输的消息过长导致的消息传输效率低的问题。Through the embodiment of the present application, the storage format of the memory address stored in the message is reconstructed, and the target memory address is obtained by obtaining the target memory address, wherein the target memory address is the buffer address of the target buffer transmitted by the target transmission message to be transmitted; according to the base address and the size of the address unit, the identification value of the address identification corresponding to the target memory address is determined to obtain the target identification value; the target identification value is written into the message structure of the target transmission message, and the target transmission message is transmitted to the receiving end of the target transmission message. The identification value corresponding to the memory address determined by the size of the address unit (which can be used to restore the original memory address according to the base address and the size of the address unit) can effectively compress the space occupied by the memory address in the message, shorten the length of the message to be transmitted, achieve the technical effect of improving the efficiency of message transmission, and further solve the problem of low message transmission efficiency caused by the long message to be transmitted in the inter-process communication message transmission method in the related art.

附图说明Description of drawings

图1是根据本申请实施例的一种消息的传输方法的硬件环境示意图;FIG. 1 is a schematic diagram of a hardware environment of a message transmission method according to an embodiment of the present application;

图2是根据本申请实施例的一种消息的传输方法的流程图;FIG. 2 is a flowchart of a message transmission method according to an embodiment of the present application;

图3是根据本申请实施例的另一种消息的传输方法的流程图;FIG. 3 is a flowchart of another message transmission method according to an embodiment of the present application;

图4是根据本申请实施例的一种消息的传输装置的结构框图;FIG. 4 is a structural block diagram of a message transmission device according to an embodiment of the present application;

图5是根据本申请实施例的另一种消息的传输装置的结构框图。Fig. 5 is a structural block diagram of another message transmission device according to an embodiment of the present application.

具体实施方式Detailed ways

下文中将参考附图并结合实施例来详细说明本申请的实施例。Embodiments of the present application will be described in detail below with reference to the drawings and in combination with the embodiments.

需要说明的是,本申请实施例的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It should be noted that the terms "first" and "second" in the description and claims of the embodiments of the present application and the above drawings are used to distinguish similar objects, but not necessarily used to describe a specific order or sequence.

本申请实施例中所提供的方法实施例可以在移动终端、计算机终端或者类似的运算装置中执行。以运行在计算机终端上为例,图1是根据本申请实施例的一种消息的传输方法的硬件环境示意图。如图1所示,计算机终端可以包括一个或多个(图1中仅示出一个)处理器102(处理器102可以包括但不限于微处理器MCU或可编程逻辑器件FPGA等的处理装置)和用于存储数据的存储器104,其中,上述计算机终端还可以包括用于通信功能的传输设备106以及输入输出设备108。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述计算机终端的结构造成限定。例如,计算机终端还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。The method embodiments provided in the embodiments of the present application may be executed in mobile terminals, computer terminals or similar computing devices. Taking running on a computer terminal as an example, FIG. 1 is a schematic diagram of a hardware environment of a message transmission method according to an embodiment of the present application. As shown in FIG. 1 , a computer terminal may include one or more (only one is shown in FIG. 1 ) processors 102 (the processor 102 may include, but not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data. Those skilled in the art can understand that the structure shown in FIG. 1 is only for illustration, and it does not limit the structure of the above computer terminal. For example, the computer terminal may also include more or fewer components than shown in FIG. 1 , or have a different configuration than that shown in FIG. 1 .

存储器104可用于存储计算机程序,例如,应用软件的软件程序以及模块,如本申请实施例中的消息的传输方法对应的计算机程序,处理器102通过运行存储在存储器104内的计算机程序,从而执行各种功能应用以及数据处理,即实现上述的方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器102远程设置的存储器,这些远程存储器可以通过网络连接至移动终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the message transmission method in the embodiment of the present application, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, that is, implements the above-mentioned method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory that is remotely located relative to the processor 102, and these remote memories may be connected to the mobile terminal through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

传输设备106用于经由一个网络接收或者发送数据。上述的网络具体实例可包括计算机终端的通信供应商提供的无线网络。在一个实例中,传输设备106包括一个网络适配器(Network Interface Controller,简称为NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输设备106可以为射频(Radio Frequency,简称为RF)模块,其用于通过无线方式与互联网进行通讯。Transmission device 106 is used to receive or transmit data via a network. The specific example of the above-mentioned network may include a wireless network provided by the communication provider of the computer terminal. In an example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC for short), which can be connected to other network devices through a base station so as to communicate with the Internet. In an example, the transmission device 106 may be a radio frequency (Radio Frequency, RF for short) module, which is used to communicate with the Internet in a wireless manner.

根据本申请实施例的一个方面,提供了一种消息的传输方法,以由计算机终端来执行本实施例中的消息的传输方法为例,图2是根据本申请实施例的一种消息的传输方法的流程图,如图2所示,该流程包括如下步骤:According to an aspect of the embodiment of the present application, a method for transmitting a message is provided. Taking the computer terminal to execute the method for transmitting a message in this embodiment as an example, FIG. 2 is a flowchart of a method for transmitting a message according to an embodiment of the present application. As shown in FIG. 2 , the process includes the following steps:

步骤S202,获取目标内存地址,其中,目标内存地址为待传输的目标传输消息所传输的、目标缓冲区的缓冲区地址。Step S202, acquiring a target memory address, where the target memory address is a buffer address of a target buffer transmitted by a target transfer message to be transmitted.

本实施例中的消息的传输方法可以应用到同一设备内的不同功能单元FU之间进行通信的场景。对于固件FW(Firmware),不同FU之间的通信主要采用进程间通信方式,通过FU定义不同管道FIFO(First Input First Output,先进先出)。IPC消息作为进程间通信的基本单元,其长度一般以Dword(Double Word,每个word为2个字节的长度,32bit)为单位。每个IPC消息可以包含若干个Dword(比如,16个Dwords),其中包含了消息源、消息目的地、消息唯一标识符、消息类型、消息地址、需要传递的多个buffer(内存地址,读写取数据时用于存放数据)地址等参数。The message transmission method in this embodiment can be applied to a scenario where different functional units FU in the same device communicate with each other. For the firmware FW (Firmware), the communication between different FUs mainly adopts the inter-process communication method, and different pipelines FIFO (First Input First Output, first-in-first-out) are defined through FU. The IPC message is the basic unit of inter-process communication, and its length is generally in units of Dword (Double Word, each word is 2 bytes in length, 32bit). Each IPC message can contain several Dwords (for example, 16 Dwords), which include parameters such as message source, message destination, message unique identifier, message type, message address, and multiple buffers (memory addresses, used to store data when reading and writing data) addresses that need to be transmitted.

在本实施例中,在不同功能单元间进行消息传输之前,可以先获取目标内存地址。这里,目标内存地址可以为待传输的目标传输消息所传输的、目标缓冲区的缓冲区地址,即前述buffer地址。目标传输消息可以是前述IPC消息。In this embodiment, before message transmission between different functional units, the target memory address may be obtained first. Here, the target memory address may be the buffer address of the target buffer transmitted by the target transfer message to be transmitted, that is, the aforementioned buffer address. The target transfer message may be the aforementioned IPC message.

步骤S204,根据基地址和地址单元大小,确定与目标内存地址对应的地址标识的标识值,得到目标标识值。Step S204, according to the base address and the size of the address unit, determine the identification value of the address identification corresponding to the target memory address, and obtain the target identification value.

在IPC消息中,除buffer地址外其他参数较为简单,所占比特(bit)数较少。64位操作系统中一个绝对的buffer地址包含64bit(即,占用2个Dword)。典型的结构体如下,其中,buffer地址占用9个Dwords:In the IPC message, other parameters except the buffer address are relatively simple and occupy a small number of bits. An absolute buffer address in a 64-bit operating system contains 64 bits (that is, occupies 2 Dwords). A typical structure is as follows, where the buffer address occupies 9 Dwords:

typedef uniontypedef union

{{

structstructure

{ {

u32 msgType : 8; u32 msgType : 8;

u32 flashChanQ : 4; u32 flashChanQ : 4;

u32 chan : 5; u32 chan : 5;

u32 outMsgQ : 4; u32 outMsgQ : 4;

u32 reservedDW0B31_21 : 11; u32 reservedDW0B31_21 : 11;

u32 tag : 16; u32 tag : 16;

u32 pageType : 3; u32 pageType : 3;

u32 read_type : 4; u32 read_type : 4;

u32 page_load_flag : 1; u32 page_load_flag : 1;

u32 fast_read_flag : 1; u32 fast_read_flag : 1;

u32 inject_err_type : 3; u32 inject_err_type : 3;

u32 reservedDW1B31_28 : 4; u32 reservedDW1B31_28 : 4;

u32 data_frame_offset : 11; u32 data_frame_offset : 11;

u32 data_frame_length : 11; u32 data_frame_length : 11;

u32 buf_alloc_flag : 1; u32 buf_alloc_flag : 1;

u32 plane_bitmap : 4; u32 plane_bitmap : 4;

u32 df_bitmap : 16; u32 df_bitmap : 16;

u32 reservedDW4B31_20 : 12; u32 reservedDW4B31_20 : 12;

u32 read_refs; u32 read_refs;

u32 eccCodeRateIndex : 4; u32 eccCodeRateIndex : 4;

u32 reservedDW7B7_5 : 4; u32 reservedDW7B7_5 : 4;

u32 maxIter : 8; u32 maxIter : 8;

u32 lLR0 : 8; u32 lLR0 : 8;

u32 lLR1 : 8; u32 lLR1 : 8;

u32 buffer_addr[9]; u32 buffer_addr[9];

}; };

u32 dw[16]; u32 dw[16];

} flash_read_t 。} flash_read_t.

不同FU与NCM(Nand Control Manager,闪存控制管理)进程通信最基本的操作有读、写、擦等,其中,读、写的快慢至关重要,决定了产品的基本性能。然而,随着NAND技术的不断发展,一个多plane读写消息需要传递更多个buffer地址,此时,IPC消息长度不得不增大很多。而进程间通信时,IPC消息需要在一个模块写入,并从另一个模块读出,消息长度增大后,读写IPC消息时会消耗较多的CPU(Central Processing Unit,中央处理器)资源。此外,IPC消息在不同FU间传输过程中有时需要多层转发,过长的IPC消息在消息传输时,也会给总线造成很大负担,进而影响传输性能和传输效率。The most basic operations for communication between different FUs and NCM (Nand Control Manager, flash memory control management) processes include reading, writing, and erasing. Among them, the speed of reading and writing is very important, which determines the basic performance of the product. However, with the continuous development of NAND technology, a multi-plane read and write message needs to transmit more buffer addresses. At this time, the length of the IPC message has to be increased a lot. In inter-process communication, IPC messages need to be written in one module and read from another module. After the message length increases, more CPU (Central Processing Unit, central processing unit) resources will be consumed when reading and writing IPC messages. In addition, IPC messages sometimes need multi-layer forwarding during transmission between different FUs. Too long IPC messages will also place a heavy burden on the bus during message transmission, thereby affecting transmission performance and transmission efficiency.

为了至少解决部分上述问题,在本实施例中,可以对目标传输消息中记录的内存地址的格式进行重构,不再直接记录完整的内存地址,而是通过记录内存地址对应的标识值,实现对消息结构中内存地址占用的Dword数的压缩和优化。In order to solve at least part of the above-mentioned problems, in this embodiment, the format of the memory address recorded in the target transmission message can be reconstructed, and the complete memory address is no longer directly recorded, but the identification value corresponding to the memory address is recorded, so as to realize the compression and optimization of the number of Dwords occupied by the memory address in the message structure.

在本实施例中,可以根据基地址和地址单元大小,确定与目标内存地址对应的地址标识的标识值,得到目标标识值。这里,基地址可以作为内存地址的起始地址。目标标识值可以用于标识目标内存地址。In this embodiment, the identification value of the address identification corresponding to the target memory address may be determined according to the base address and the size of the address unit to obtain the target identification value. Here, the base address can be used as the starting address of the memory address. A target identification value can be used to identify a target memory address.

可选地,目标标识值可以是根据目标内存地址的大小与基地址和地址单元大小有关。基地址和地址单元大小可以是预先设定的固定值,即,每个内存地址对应的基地址和地址单元大小可以是一样的。Optionally, the target identification value may be related to the base address and address unit size according to the size of the target memory address. The base address and address unit size may be preset fixed values, that is, the base address and address unit size corresponding to each memory address may be the same.

可选地,基地址和地址单元的设定可以是在每次进行消息传输之前进行一次基地址和地址单元的设定,也可以是在如内存初始化时等准备阶段完成的,对应地,不论进行多少次消息传输,基地址和地址单元的设定可以只需要进行一次。Optionally, the setting of the base address and the address unit may be performed once before each message transmission, or may be completed during a preparation stage such as memory initialization. Correspondingly, no matter how many times the message transmission is performed, the setting of the base address and the address unit may only need to be performed once.

步骤S206,将目标标识值写入到目标传输消息的消息结构体,并将目标传输消息传输给目标传输消息的接收端。Step S206, write the target identification value into the message structure of the target transfer message, and transmit the target transfer message to the receiving end of the target transfer message.

对于待传输的目标传输消息可以包括消息结构体,消息结构体是用于写入消息中所携带的信息的结构体,在得到目标标识值之后,可以将目标标识值写入到目标传输消息的消息结构体,并将目标传输消息传输给目标传输消息的接收端。传输目标传输消息的方式可以包括传输目标传输消息的消息结构体,还可以包括传输目标传输消息除了消息结构体以外的其他信息。通过将内存地址对应的标识值写入到传输消息的消息结构体中,相较于传输直接地址的方式,可以实现缩小内存地址在传输消息中所占的比特数的目的,从而可以减小传输消息的长度(即,所占的比特数),提高带宽利用率。The target transmission message to be transmitted may include a message structure, and the message structure is a structure for writing information carried in the message. After the target identification value is obtained, the target identification value may be written into the message structure of the target transmission message, and the target transmission message is transmitted to the receiving end of the target transmission message. The manner in which the transmission target transmits the message may include the message structure of the transmission target's transmission message, and may also include other information other than the message structure of the transmission target's transmission message. By writing the identification value corresponding to the memory address into the message structure of the transmission message, compared with the way of transmitting the direct address, the purpose of reducing the number of bits occupied by the memory address in the transmission message can be achieved, thereby reducing the length of the transmission message (that is, the number of bits occupied), and improving bandwidth utilization.

这里,目标传输消息的消息结构体中可以包含多种参数,多种参数的顺序和位置可以是预先设定的。多种参数中的每种参数可以对应于该消息结构体中的一个字段,每种参数对应于一个或多个比特位,即,占用一个或多个比特位,每种参数所占用的比特位数可以是固定的,也可以是针对不同传输消息对应设置的。目标内存地址可以属于多种参数中的一种,可以在消息结构体中与目标内存地址对应的写入位置写入目标标识值。Here, the message structure of the target transmission message may contain various parameters, and the sequence and position of the various parameters may be preset. Each of the various parameters may correspond to a field in the message structure, each parameter corresponds to one or more bits, that is, occupies one or more bits, and the number of bits occupied by each parameter may be fixed or set correspondingly for different transmission messages. The target memory address can belong to one of various parameters, and the target identification value can be written in the writing position corresponding to the target memory address in the message structure.

通过上述步骤,通过获取目标内存地址,其中,目标内存地址为待传输的目标传输消息所传输的、目标缓冲区的缓冲区地址;根据基地址和地址单元大小,确定与目标内存地址对应的地址标识的标识值,得到目标标识值;将目标标识值写入到目标传输消息的消息结构体,并将目标传输消息传输给目标传输消息的接收端,可以解决相关技术中的进程间通信消息的传输方法存在由于需要传输的消息过长导致的消息传输效率低的问题,达到提高消息传输性能的技术效果。Through the above steps, by obtaining the target memory address, wherein the target memory address is the buffer address of the target buffer that is transmitted by the target transfer message to be transmitted; according to the base address and the size of the address unit, determine the identification value of the address identification corresponding to the target memory address, and obtain the target identification value; write the target identification value into the message structure of the target transmission message, and transmit the target transmission message to the receiving end of the target transmission message, which can solve the problem of low message transmission efficiency due to the excessive length of the message that needs to be transmitted in the inter-process communication message transmission method in the related art. effect.

在一个示范性实施例中,在根据基地址和地址单元大小,确定与目标内存地址对应的地址标识的标识值之前,上述方法还包括:获取基地址和地址单元大小,其中,基地址和地址单元大小是在进行内存初始化的过程中设置的。In an exemplary embodiment, before determining the identification value of the address identification corresponding to the target memory address according to the base address and the size of the address unit, the method further includes: obtaining the base address and the size of the address unit, wherein the base address and the size of the address unit are set during memory initialization.

在确定目标标识值之前,可以先获取基地址和地址单元大小。这里,基地址和地址单元大小可以是在进行内存初始化的过程中设置的。内存初始化指的是将管理多个进程的数据的内存进行的初始化。Before determining the target identification value, the base address and address unit size can be obtained first. Here, the base address and address unit size may be set during memory initialization. The memory initialization refers to the initialization of the memory that will manage the data of multiple processes.

通过本实施例,在内存初始化的过程中完成对基地址和地址单元的设置,可以避免浪费单独的资源进行基地址和地址单元的设定,从而提高资源的利用率。Through this embodiment, the setting of the base address and address unit is completed in the process of memory initialization, which can avoid wasting separate resources for setting the base address and address unit, thereby improving resource utilization.

在一个示范性实施例中,上述方法还包括:将缓冲区地址的最小值,设置为基地址,以及将存储地址间的最小单元,设置为地址单元大小。In an exemplary embodiment, the above method further includes: setting the minimum value of the buffer address as the base address, and setting the minimum unit between storage addresses as the address unit size.

在设置基地址和地址单元大小时,可以将缓冲区地址的最小值设置为基地址,将存储地址间的最小单元设置为地址单元大小。例如,内存初始化时定义BaseAddr(基地址)、UnitSize(地址单元大小),BaseAddr采用所用buffer地址的最小值,UnitSize为存储地址间的最小单元。When setting the base address and address unit size, the minimum value of the buffer address can be set as the base address, and the minimum unit between storage addresses can be set as the address unit size. For example, BaseAddr (base address) and UnitSize (address unit size) are defined during memory initialization. BaseAddr adopts the minimum value of the buffer address used, and UnitSize is the smallest unit between storage addresses.

可选地,地址单元大小为地址单元的长度(或者说,地址单元所占的比特位数),将存储地址间的最小单元,设置为地址单元大小是指:将存储地址间的最小单元的大小,设置为地址单元大小,地址单元为存储地址间的最小单元。Optionally, the size of the address unit is the length of the address unit (or in other words, the number of bits occupied by the address unit), and setting the smallest unit between storage addresses as the address unit size means: setting the size of the smallest unit between storage addresses as the size of the address unit, and the address unit is the smallest unit between storage addresses.

通过本实施例,将缓冲区地址的最小值设置为基地址,将存储地址间的最小单元设置为地址单元大小,可以提高基地址和地址单元大小对所有内存地址的适用性。Through this embodiment, the minimum value of the buffer address is set as the base address, and the minimum unit between storage addresses is set as the size of the address unit, which can improve the applicability of the base address and the size of the address unit to all memory addresses.

在一个示范性实施例中,获取基地址和地址单元大小,包括:从预设寄存器中读取出基地址和地址单元大小。In an exemplary embodiment, obtaining the base address and the size of the address unit includes: reading the base address and the size of the address unit from a preset register.

在本实施例中,对于基地址和地址单元大小,在硬件支持的条件下,可以将基地址和地址单元大小在定义完成后存储在预设寄存器中,例如,在对内存进行初始化时,设置基地址和地址单元大小,并将设置的基地址和地址单元大小存储到预设寄存器中。对应地,在进行消息传输时,可以从预设寄存器中读取出基地址和地址单元大小。这里,预设寄存器可以是预先设定的、可以包含具有存储功能的触发器的寄存器。In this embodiment, for the base address and the size of the address unit, under the condition of hardware support, the base address and the size of the address unit can be stored in the preset register after the definition is completed, for example, when the memory is initialized, the base address and the size of the address unit are set, and the set base address and the size of the address unit are stored in the preset register. Correspondingly, during message transmission, the base address and address unit size can be read from the preset register. Here, the preset register may be a preset register that may include a flip-flop with a storage function.

预设寄存器可以仅在内存初始化时允许被设置、修改等,或者,在进行消息传输的过程中不允许被设置、修改等。在此情况下,在将基地址和地址单元大小存储到预设寄存器之后,在不同的发送端想要进行传输消息传输时,均可从预设寄存器中读取基地址和地址单元大小。可选地,为避免信息获取冲突,预设寄存器在同一时间仅允许一个进程进行数据读取,同时,在读取数据时不允许其他进程从预设寄存器中读取数据。或者,预设寄存器在同一时间也可以允许多个进程进行数据读取,此时可以通过一种或多个方式避免数据读取冲突,比如,预设寄存器中的信息仅允许读取,不允许修改等。本实施例中对此不做限定。The preset register may only be allowed to be set, modified, etc. during memory initialization, or may not be allowed to be set, modified, etc. during message transmission. In this case, after the base address and the size of the address unit are stored in the preset register, when different senders intend to transmit messages, they can read the base address and the size of the address unit from the preset register. Optionally, in order to avoid information acquisition conflicts, the preset register only allows one process to read data at a time, and at the same time, other processes are not allowed to read data from the preset register when reading data. Alternatively, the preset register can also allow multiple processes to read data at the same time. At this time, one or more methods can be used to avoid data read conflicts. For example, the information in the preset register is only allowed to be read and not allowed to be modified. This is not limited in this embodiment.

需要说明的是,不同的进程在进行传输消息传输时,均可从预设寄存器中读取出基地址和地址单元大小,不同进程所读取到的基地址和地址单元大小可以是相同的。It should be noted that, when different processes transmit messages, they can read the base address and address unit size from the preset register, and the base address and address unit size read by different processes may be the same.

通过本实施例,通过从寄存器中读取基地址和地址单元大小,可以便于获取基地址和地址单元大小,从而提高信息获取的便捷性。Through this embodiment, by reading the base address and the size of the address unit from the register, the base address and the size of the address unit can be obtained conveniently, thereby improving the convenience of information acquisition.

在一个示范性实施例中,根据基地址和地址单元大小,确定与目标内存地址对应的地址标识的标识值,得到目标标识值,包括:确定目标内存地址与基地址之间的地址偏移量,得到目标偏移量;根据目标偏移量和地址单元大小,确定与目标内存地址对应的地址标识的目标标识值。In an exemplary embodiment, according to the base address and the size of the address unit, determining the identification value of the address identification corresponding to the target memory address to obtain the target identification value includes: determining the address offset between the target memory address and the base address to obtain the target offset; according to the target offset and the size of the address unit, determining the target identification value of the address identification corresponding to the target memory address.

由于内存地址的实际地址可以由基地址和偏移地址所确定,在确定目标标识值时,考虑基地址的独特作用(定位排布),可以先确定目标内存地址与基地址之间的地址偏移量,得到目标偏移量,再根据目标偏移量和地址单元大小,确定与目标内存地址对应的地址标识的目标标识值。这里的目标偏移量可以是目标内存地址与基地址的大小的差值,即,前述偏移地址。Since the actual address of the memory address can be determined by the base address and the offset address, when determining the target identification value, the unique role of the base address (location arrangement) can be considered. The address offset between the target memory address and the base address can be determined first to obtain the target offset, and then the target identification value of the address identification corresponding to the target memory address can be determined according to the target offset and the size of the address unit. The target offset here may be the difference between the size of the target memory address and the base address, that is, the aforementioned offset address.

通过本实施例,根据内存地址和基地址的偏移量与地址单元大小的关系确定内存地址对应的标识值,可以提高标识值与内存地址之间的关联性,便于传输消息的接收端内存地址的获取。Through this embodiment, the identification value corresponding to the memory address is determined according to the relationship between the offset of the memory address and the base address and the size of the address unit, which can improve the correlation between the identification value and the memory address, and facilitate the acquisition of the memory address of the receiving end of the transmission message.

在一个示范性实施例中,根据目标偏移量和地址单元大小,确定与目标内存地址对应的地址标识的目标标识值,包括:将目标偏移量除以地址单元大小所得到的商,确定为与目标内存地址对应的地址标识的目标标识值。In an exemplary embodiment, determining the target identifier value of the address identifier corresponding to the target memory address according to the target offset and the address unit size includes: determining a quotient obtained by dividing the target offset by the address unit size as the target identifier value of the address identifier corresponding to the target memory address.

在本实施例中,由于地址单元大小可以是存储地址间的最小单元,可以认为存储的每个地址占用整数数量的地址单元,即,每个地址的大小是地址单元大小的整数倍。可以将目标偏移量除以地址单元大小所得到的商,确定为与目标内存地址对应的地址标识的目标标识值。In this embodiment, since the address unit size can be the smallest unit among storage addresses, it can be considered that each stored address occupies an integer number of address units, that is, the size of each address is an integer multiple of the address unit size. A quotient obtained by dividing the target offset by the size of the address unit may be determined as the target identification value of the address identification corresponding to the target memory address.

例如,发送端获取到BufferAddr后,计算该BufferAddr相对于基地址的相对偏移量,偏移值bufferId=(BufferAddr–BaseAddr)/UnitSize,运算后得到的bufferId一般不超过12bits。For example, after the sender obtains the BufferAddr, it calculates the relative offset of the BufferAddr relative to the base address, the offset value bufferId=(BufferAddr–BaseAddr)/UnitSize, and the bufferId obtained after the operation generally does not exceed 12 bits.

通过本实施例,根据内存地址和基地址的偏移量与地址单元大小的商确定内存地址对应的标识值,可以提高确定标识值的便捷性。Through this embodiment, the identification value corresponding to the memory address is determined according to the quotient of the offset between the memory address and the base address and the size of the address unit, which can improve the convenience of determining the identification value.

在一个示范性实施例中,上述方法还包括:根据目标缓冲区的缓冲区大小和地址单元大小,确定与目标内存地址对应的缓冲区长度参数的参数值,得到目标长度值。对应地,将目标标识值写入到目标传输消息的消息结构体,包括:将目标标识值和目标长度值写入到目标传输消息的消息结构体。In an exemplary embodiment, the above method further includes: according to the buffer size and address unit size of the target buffer, determining a parameter value of a buffer length parameter corresponding to the target memory address to obtain a target length value. Correspondingly, writing the target identification value into the message structure of the target transmission message includes: writing the target identification value and the target length value into the message structure of the target transmission message.

为了便于目标传输消息的接收端可以准确确定与目标内存地址对应的缓冲区完整信息,可以将目标内存地址对应的长度值也写入目标传输消息的消息结构体中。在本实施例中,可以根据目标缓冲区的缓冲区大小和地址单元大小,确定与目标内存地址对应的缓冲区长度参数的参数值,得到目标长度值。In order to facilitate the receiver of the target transfer message to accurately determine the complete information of the buffer corresponding to the target memory address, the length value corresponding to the target memory address can also be written into the message structure of the target transfer message. In this embodiment, the parameter value of the buffer length parameter corresponding to the target memory address may be determined according to the buffer size and address unit size of the target buffer to obtain the target length value.

在将目标标识值写入到目标传输消息的消息结构体的同时,可以将目标长度值也写入到目标传输消息的消息结构体中。例如,发送端可以将获取到的bufferId、bufferLength填进IPC消息结构体内。While writing the target identification value into the message structure of the target transmission message, the target length value can also be written into the message structure of the target transmission message. For example, the sender can fill the obtained bufferId and bufferLength into the IPC message structure.

可选地,目标标识值和目标长度值可以作为一个内存地址参数在目标传输消息的消息结构体中前后相邻。可以是目标标识值在前,目标长度值在后,也可以是目标长度值在前,目标标识值在后,本实施例对此不做限定。这里,地址标识可以用于标识缓冲区的内存地址(绝对地址),而缓冲区长度参数(或者称缓冲区长度标识)可以用于标识缓冲区的缓冲区大小,通过这两个参数,可以确定出对应的缓冲区。Optionally, the target identification value and the target length value may be used as a memory address parameter adjacent to each other in the message structure of the target transmission message. It may be that the target identification value comes first and the target length value follows, or the target length value comes first and the target identification value follows, which is not limited in this embodiment. Here, the address identifier can be used to identify the memory address (absolute address) of the buffer, and the buffer length parameter (or buffer length identifier) can be used to identify the buffer size of the buffer. Through these two parameters, the corresponding buffer can be determined.

通过本实施例,将内存地址对应的长度值与内存地址对应的标识值一起写入消息结构体中,可以提高缓冲区定位的边界性,提供信息传输的准确性。Through this embodiment, writing the length value corresponding to the memory address and the identification value corresponding to the memory address into the message structure can improve the boundary of buffer location and improve the accuracy of information transmission.

在一个示范性实施例中,根据目标缓冲区的缓冲区大小和地址单元大小,确定与目标内存地址对应的缓冲区长度参数的参数值,得到目标长度值,包括:将目标缓冲区的缓冲区大小除以地址单元大小所得到的商,确定为与目标内存地址对应的缓冲区长度参数的目标长度值。In an exemplary embodiment, according to the buffer size and address unit size of the target buffer, determining the parameter value of the buffer length parameter corresponding to the target memory address to obtain the target length value includes: dividing the buffer size of the target buffer by the address unit size to determine the target length value of the buffer length parameter corresponding to the target memory address.

在本实施例中,在确定目标内存地址对应的长度值时,可以将目标缓冲区的缓冲区大小除以地址单元大小所得到的商,确定为与目标内存地址对应的缓冲区长度参数的目标长度值。这里,内存地址对应的长度值是指内存地址对应的缓冲区长度参数的长度值,即,可以用于标识内存地址对应的缓冲区的大小。In this embodiment, when determining the length value corresponding to the target memory address, the quotient obtained by dividing the buffer size of the target buffer by the address unit size may be determined as the target length value of the buffer length parameter corresponding to the target memory address. Here, the length value corresponding to the memory address refers to the length value of the buffer length parameter corresponding to the memory address, that is, it can be used to identify the size of the buffer corresponding to the memory address.

例如,bufferLength(可以用于标识缓冲区大小的参数)可以根据需要传输的buffer大小除以UnitSize获取,一般所占bits较小。For example, bufferLength (a parameter that can be used to identify the size of the buffer) can be obtained by dividing the buffer size to be transmitted by UnitSize, and generally occupies less bits.

通过本实施例,将缓冲区的缓冲区大小与地址单元大小的商确定为消息结构体中写入的长度值,可以便于接收端根据预设的地址单元大小确定完整的缓冲区信息,提高消息传输的准确性。Through this embodiment, the quotient of the buffer size of the buffer and the address unit size is determined as the length value written in the message structure, which can facilitate the receiving end to determine complete buffer information according to the preset address unit size, and improve the accuracy of message transmission.

在一个示范性实施例中,将目标标识值和目标长度值写入到目标传输消息的消息结构体,包括:按照目标标识值所占的比特数和目标长度值所占用的比特数,将目标标识值和目标长度值写入到目标传输消息的消息结构体。In an exemplary embodiment, writing the target identification value and the target length value into the message structure of the target transmission message includes: writing the target identification value and the target length value into the message structure of the target transmission message according to the number of bits occupied by the target identification value and the number of bits occupied by the target length value.

对于确定的目标标识值和目标长度值,可以分别确定两者在目标传输消息的消息结构体中的比特数,按照目标标识值所占的比特数和目标长度值所占用的比特数,将目标标识值和目标长度值写入到目标传输消息的消息结构体。For the determined target identification value and target length value, the number of bits in the message structure of the target transmission message can be determined respectively, and the target identification value and the target length value are written into the message structure of the target transmission message according to the number of bits occupied by the target identification value and the number of bits occupied by the target length value.

通过本实施例,按照标识值和长度值所占的比特数完成在消息结构体中的写入,可以有效减小内存地址在消息结构体中占用的比特数,实现减小消息长度的目的。Through this embodiment, the writing in the message structure is completed according to the number of bits occupied by the identification value and the length value, which can effectively reduce the number of bits occupied by the memory address in the message structure and achieve the purpose of reducing the message length.

在一个示范性实施例中,上述方法还包括:根据目标内存地址所占用的比特数,动态调整目标标识值所占的比特数和目标长度值所占的比特数。In an exemplary embodiment, the above method further includes: dynamically adjusting the number of bits occupied by the target identification value and the number of bits occupied by the target length value according to the number of bits occupied by the target memory address.

对于目标标识值和目标长度值在目标传输消息的消息结构体中所占的比特数,可以根据实际场景动态调整。在本实施例中,可以根据目标内存地址所占用的比特数,动态调整目标标识值所占的比特数和目标长度值所占的比特数。The number of bits occupied by the target identification value and the target length value in the message structure of the target transmission message can be dynamically adjusted according to actual scenarios. In this embodiment, the number of bits occupied by the target identification value and the number of bits occupied by the target length value may be dynamically adjusted according to the number of bits occupied by the target memory address.

可选地,上述目标标识值所占的比特数和目标长度所占的比特数可以根据当前的传输环境,结合对应的内存地址等参数的大小,由发送端和接收端预先确定目标标识值所占的比特数和目标长度所占的比特数。Optionally, the above-mentioned number of bits occupied by the target identification value and the number of bits occupied by the target length can be determined in advance by the sending end and the receiving end according to the current transmission environment and in combination with the size of parameters such as the corresponding memory address. The number of bits occupied by the target identification value and the number of bits occupied by the target length.

例如,为方便获取传输消息中携带的信息,一个Dword可以存储两组bufferId和bufferLength,此时在同样消息长度下则可以存放更多地址。For example, in order to conveniently obtain the information carried in the transmission message, a Dword can store two sets of bufferId and bufferLength, and at this time, more addresses can be stored under the same message length.

通过本实施例,通过动态调整标识值所占比特数和长度值所占比特数,可以实现在不增加消息长度的情况下传输更多的内存地址,从而提高消息结构体的利用率。Through this embodiment, by dynamically adjusting the number of bits occupied by the identification value and the number of bits occupied by the length value, more memory addresses can be transmitted without increasing the length of the message, thereby improving the utilization rate of the message structure.

在一个示范性实施例中,根据目标内存地址所占用的比特数,动态调整目标标识值所占的比特数和目标长度值所占的比特数,包括:将目标内存地址所占用的比特数与预设比例的乘积,确定为目标标识值所占的比特数,将目标内存地址所占用的比特数与目标标识值所占的比特数的差值,确定为目标长度值所占的比特数。In an exemplary embodiment, dynamically adjusting the number of bits occupied by the target identification value and the number of bits occupied by the target length value according to the number of bits occupied by the target memory address includes: determining the product of the number of bits occupied by the target memory address and a preset ratio as the number of bits occupied by the target identification value, and determining the difference between the number of bits occupied by the target memory address and the number of bits occupied by the target identification value as the number of bits occupied by the target length value.

对于标识值和长度值所占比特数的动态调整,可以预先设定一个比例,即,预设比例,根据预设比例计算确定标识值所占的比特数和长度值所占的比特数。在本实施例中,可以将目标内存地址所占用的比特数与预设比例的乘积,确定为目标标识值所占的比特数,将目标内存地址所占用的比特数与目标标识值所占的比特数的差值,确定为目标长度值所占的比特数。For the dynamic adjustment of the number of bits occupied by the identification value and the length value, a ratio can be preset, that is, a preset ratio, and the number of bits occupied by the identification value and the number of bits occupied by the length value are calculated and determined according to the preset ratio. In this embodiment, the product of the number of bits occupied by the target memory address and the preset ratio can be determined as the number of bits occupied by the target identification value, and the difference between the number of bits occupied by the target memory address and the number of bits occupied by the target identification value can be determined as the number of bits occupied by the target length value.

例如,在将获取到的bufferId、bufferLength填进IPC消息结构体内时,可以根据buffer所占bit数动态调整各自所占的比特数,比如,bufferId占用12bits,bufferLength占用4bits。For example, when filling the obtained bufferId and bufferLength into the IPC message structure, the number of bits occupied by each buffer can be dynamically adjusted according to the number of bits occupied by the buffer. For example, bufferId occupies 12 bits, and bufferLength occupies 4 bits.

通过本实施例,通过预设比例实现标识值和长度值所占比特数的动态调整,可以提高调整的效率,从而提高消息传输的效率。Through this embodiment, the dynamic adjustment of the number of bits occupied by the identification value and the length value is realized through the preset ratio, which can improve the efficiency of adjustment, thereby improving the efficiency of message transmission.

在一个示范性实施例中,根据基地址和地址单元大小,确定与目标内存地址对应的地址标识的标识值,得到目标标识值,包括:在目标内存地址包含多个内存地址的情况下,根据基地址和地址单元大小,分别确定与多个内存地址中的每个内存地址对应的地址标识的标识值,得到与每个内存地址对应的标识值,其中,目标标识值包括与每个内存地址对应的标识值。In an exemplary embodiment, determining an identification value of an address identification corresponding to the target memory address according to the base address and the size of the address unit to obtain the target identification value includes: when the target memory address includes multiple memory addresses, according to the base address and the size of the address unit, respectively determining the identification value of the address identification corresponding to each memory address in the multiple memory addresses to obtain an identification value corresponding to each memory address, wherein the target identification value includes an identification value corresponding to each memory address.

由于NAND技术中的地址信息的数量与NAND的容量呈正相关的关系,IPC消息一般包含多个内存地址,在本实施例中,在目标内存地址包含多个内存地址的情况下,前述目标标识值可以包括与每个内存地址对应的标识值,根据基地址和地址单元大小,可以分别确定与多个内存地址中的每个内存地址对应的地址标识的标识值,得到与每个内存地址对应的标识值。Since the quantity of address information in the NAND technology is positively correlated with the capacity of the NAND, the IPC message generally includes a plurality of memory addresses. In this embodiment, when the target memory address includes a plurality of memory addresses, the aforementioned target identification value can include an identification value corresponding to each memory address. According to the base address and the size of the address unit, the identification value of the address identification corresponding to each memory address in the plurality of memory addresses can be determined respectively, and the identification value corresponding to each memory address can be obtained.

可选地,可以按照前述确定目标标识值的方式,确定内存地址与基地址之间的地址偏移量,将地址偏移量除以地址单元大小所得到的商,确定为与内存地址对应的地址标识的标识值。Optionally, the address offset between the memory address and the base address can be determined according to the aforementioned method for determining the target identification value, and the quotient obtained by dividing the address offset by the size of the address unit can be determined as the identification value of the address identification corresponding to the memory address.

可选地,在确定与每个内存地址对应的标识值的同时,可以按照前述确定目标长度值的方法,确定出与每个内存地址对应的长度值,并将其与对应的标识值一起写入目标传输消息的消息结构体中。Optionally, while determining the identification value corresponding to each memory address, the length value corresponding to each memory address can be determined according to the aforementioned method for determining the target length value, and written together with the corresponding identification value into the message structure of the target transmission message.

通过本实施例,在存在多个内存地址的情况下,分别根据基地址和地址单元大小确定与每个内存地址对应的标识值,可以提高接收端对多个内存地址的识别率,从而提高内存地址传输的准确性。Through this embodiment, in the case of multiple memory addresses, the identification value corresponding to each memory address is determined according to the base address and the size of the address unit, which can improve the recognition rate of the receiving end for multiple memory addresses, thereby improving the accuracy of memory address transmission.

在一个示范性实施例中,获取目标内存地址,包括:获取目标缓冲区的绝对地址,得到目标内存地址。In an exemplary embodiment, obtaining the target memory address includes: obtaining the absolute address of the target buffer to obtain the target memory address.

为了避免消息传输过程中的内存地址因断链等原因出现地址失效的情况发生,在本实施例中,目标传输消息中传输的内存地址可以是绝对地址,即文件的绝对位置。获取目标内存地址可以是指获取目标缓冲区的绝对地址。In order to prevent the memory address from becoming invalid due to link disconnection during message transmission, in this embodiment, the memory address transmitted in the target transmission message may be an absolute address, that is, the absolute location of the file. Obtaining the target memory address may refer to obtaining the absolute address of the target buffer.

通过本实施例,获取绝对地址作为待传输的内存地址,可以避免因连接位置的改变导致地址失效,可以提高内存地址传输的有效性。Through this embodiment, the absolute address is obtained as the memory address to be transmitted, which can avoid address invalidation caused by the change of the connection position, and can improve the effectiveness of memory address transmission.

根据本申请实施例的另一个方面,还提供了一种消息的传输方法,其可以是用于接收并处理通过前述实施例中提供的消息的传输方法所产生并发送的传输消息。以由计算机终端来执行本实施例中的消息的传输方法为例,图3是根据本申请实施例的另一种消息的传输方法的流程图,如图3所示,该流程包括如下步骤:According to another aspect of the embodiments of the present application, a message transmission method is also provided, which may be used to receive and process the transmission message generated and sent by the message transmission method provided in the foregoing embodiments. Taking the computer terminal to execute the message transmission method in this embodiment as an example, FIG. 3 is a flowchart of another message transmission method according to the embodiment of the present application. As shown in FIG. 3 , the process includes the following steps:

步骤S302,接收发送端发送的目标传输消息。Step S302, receiving the target transfer message sent by the sender.

在本实施例中,在进程间通信中,对于一个传输消息的接收端,比如,目标传输消息的接收端,其可以接收发送端发送的目标传输消息。这里,接收到的目标传输消息可以是由发送端生成的、且其消息结构体中写入了目标标识值。In this embodiment, in inter-process communication, for a receiver of a transfer message, for example, a receiver of a target transfer message, it may receive the target transfer message sent by the sender. Here, the received target transfer message may be generated by the sender, and the target identification value is written in its message structure.

步骤S304,从目标传输消息的消息结构体中提取出目标标识值,其中,目标标识值是与目标内存地址对应的地址标识的标识值。Step S304, extracting the target identification value from the message structure of the target transfer message, wherein the target identification value is the identification value of the address identification corresponding to the target memory address.

在接收端接收到目标传输消息之后,可以从目标传输消息的消息结构体中提取出目标标识值。这里,目标标识值可以是与目标内存地址对应的地址标识的标识值,其可以是从目标传输消息的消息结构体的指定字段或者指定位置提取出的,目标标识值的长度可以是固定的,也可以是可变的,可以基于所占的比特位数、结束标识或者其他信息,从目标传输消息的消息结构体的指定字段或者指定位置提取出的目标标识值。After receiving the target transmission message, the receiving end can extract the target identification value from the message structure of the target transmission message. Here, the target identification value may be the identification value of the address identification corresponding to the target memory address, which may be extracted from a specified field or a specified position of the message structure of the target transmission message. The length of the target identification value may be fixed or variable. The target identification value may be extracted from the specified field or specified position of the message structure of the target transmission message based on the number of bits occupied, the end identification or other information.

可选地,可以根据提取出的目标标识值确定对应的目标内存地址的地址标识,进而确定发送端想要传输的内存地址。Optionally, the address identifier of the corresponding target memory address can be determined according to the extracted target identifier value, and then the memory address that the sender wants to transmit can be determined.

可选地,若消息结构体中同时写入了目标标识值和与目标内存地址对应的长度值,即,目标长度值,在提取出目标标识值的同时,可以提取出对应的目标长度值,以根据目标长度值和目标长度值确定出与目标内存地址对应的缓冲区(即,buffer)。Optionally, if the target identification value and the length value corresponding to the target memory address are written in the message structure at the same time, that is, the target length value, when the target identification value is extracted, the corresponding target length value can be extracted, so as to determine the buffer (ie, buffer) corresponding to the target memory address according to the target length value and the target length value.

步骤S306,根据目标标识值、基地址和地址单元大小,确定出目标内存地址。Step S306, determine the target memory address according to the target identification value, the base address and the size of the address unit.

可选地,接收端可以通过与发送端获取基地址和地址单元大小相同或者类似的方式来获取基地址和地址单元大小,具体的获取方式可以参考前述实施例的描述,本实施例在此不做赘述。Optionally, the receiving end may obtain the base address and address unit size in the same or similar manner as the transmitting end obtains the base address and address unit size. For the specific obtaining method, refer to the description in the foregoing embodiments, and this embodiment will not repeat them here.

在提取出目标标识值之后,可以根据获取到的基地址、地址单元大小,结合目标标识值确定出目标内存地址。确定目标内存地址的方式可以与前述实施例中生成目标内存地址的方式对应。After the target identification value is extracted, the target memory address can be determined according to the obtained base address and address unit size combined with the target identification value. The manner of determining the target memory address may correspond to the manner of generating the target memory address in the foregoing embodiments.

通过上述步骤,通过接收发送端发送的目标传输消息;从目标传输消息的消息结构体中提取出目标标识值,其中,目标标识值是与目标内存地址对应的地址标识的标识值;根据目标标识值、基地址和地址单元大小,确定出目标内存地址,可以解决相关技术中的进程间通信消息的传输方法存在由于需要传输的消息过长导致的消息传输效率低的问题,达到提高消息传输性能的技术效果。Through the above steps, by receiving the target transmission message sent by the sender; extracting the target identification value from the message structure of the target transmission message, wherein the target identification value is the identification value of the address identification corresponding to the target memory address; determining the target memory address according to the target identification value, the base address and the size of the address unit, which can solve the problem of low message transmission efficiency caused by too long messages to be transmitted in the inter-process communication message transmission method in the related art, and achieve the technical effect of improving message transmission performance.

在一个示范性实施例中,从目标传输消息的消息结构体中提取出目标标识值,包括:确定目标标识值所占的比特数和目标长度值所占的比特数,其中,目标长度值是与目标内存地址对应的缓冲区长度参数的参数值,目标长度值用于标识与目标内存地址所对应的目标缓冲区的缓冲区大小;根据目标标识值所占的比特数和目标长度值所占的比特数,从目标传输消息的消息结构体中提取出目标标识值和目标长度值。In an exemplary embodiment, extracting the target identification value from the message structure of the target transfer message includes: determining the number of bits occupied by the target identification value and the number of bits occupied by the target length value, wherein the target length value is a parameter value of a buffer length parameter corresponding to the target memory address, and the target length value is used to identify the buffer size of the target buffer corresponding to the target memory address; and extracting the target identification value and the target length value from the message structure of the target transmission message according to the number of bits occupied by the target identification value and the number of bits occupied by the target length value.

由于目标传输消息中各个参数可以是以不同的位置和比特数写入的消息结构体,在目标传输消息的消息结构体中写入有目标标识值和目标长度值的情况下,提取目标标识值和目标长度值的方式,可以是先确定目标标识值所占的比特数和目标长度值所占的比特数,再根据目标标识值所占的比特数和目标长度值所占的比特数,从目标传输消息的消息结构体中提取出目标标识值和目标长度值。这里,目标长度值是与目标内存地址对应的缓冲区长度参数的参数值,目标长度值用于标识与目标内存地址所对应的目标缓冲区的缓冲区大小。Since each parameter in the target transmission message may be a message structure written in a different position and number of bits, when the target identification value and the target length value are written in the message structure of the target transmission message, the method of extracting the target identification value and the target length value may be to first determine the number of bits occupied by the target identification value and the number of bits occupied by the target length value, and then extract the target identification value and the target length value from the message structure of the target transmission message according to the number of bits occupied by the target identification value and the number of bits occupied by the target length value. Here, the target length value is a parameter value of the buffer length parameter corresponding to the target memory address, and the target length value is used to identify the buffer size of the target buffer corresponding to the target memory address.

可选地,对于目标标识值所占的比特数和目标长度值所占的比特数,可以是由发送端在发送目标传输消息的同时发送至接收端的,对应地,可以通过发送前述预设比例等方式实现。此外,目标标识值所占的比特数和目标长度值所占的比特数,也可以是接收端和发送端两方在消息传输前共同确定的,即,接收端知道目标标识值所占的比特数和目标长度值所占的比特数,无需发送端告知。Optionally, the number of bits occupied by the target identification value and the number of bits occupied by the target length value may be sent by the sender to the receiver while sending the target transfer message, and correspondingly, it may be realized by sending the aforementioned preset ratio. In addition, the number of bits occupied by the target identification value and the number of bits occupied by the target length value can also be jointly determined by both the receiving end and the sending end before message transmission, that is, the receiving end knows the number of bits occupied by the target identification value and the number of bits occupied by the target length value without notification from the sending end.

通过本实施例,根据标识值所占的比特数和长度值所占的比特数进行标识值和目标长度值的提取,可以提高标识值和长度值获取的准确性。Through this embodiment, the identification value and the target length value are extracted according to the number of bits occupied by the identification value and the number of bits occupied by the length value, which can improve the accuracy of obtaining the identification value and the length value.

在一个示范性实施例中,根据目标标识值、基地址和地址单元大小,确定出目标内存地址,包括:将目标标识值与地址单元大小的乘积、与基地址的和,确定为目标内存地址。In an exemplary embodiment, determining the target memory address according to the target identification value, the base address and the size of the address unit includes: determining the sum of the product of the target identification value and the size of the address unit and the base address as the target memory address.

在本实施例中,目标标识值可以为目标内存地址与基地址之间的地址偏移量除以地址单元大小所得到的商(即,bufferId = (BufferAddr – BaseAddr) / UnitSize),接收端可以将目标标识值与地址单元大小的乘积、与基地址的和,确定为目标内存地址,即,按照计算公式BufferAddr = bufferId*UnitSize+ BaseAddr来确定目标内存地址。In this embodiment, the target identification value may be the quotient obtained by dividing the address offset between the target memory address and the base address by the size of the address unit (that is, bufferId = (BufferAddr - BaseAddr) / UnitSize), and the receiving end may determine the sum of the product of the target identification value and the size of the address unit and the base address as the target memory address, that is, determine the target memory address according to the calculation formula BufferAddr = bufferId*UnitSize + BaseAddr.

通过本实施例,根据标识值与地址单元大小的乘积、与基地址的和确定内存地址,可以在减小目标内存地址在目标传输消息内的比特数的同时,提高目标内存地址传输的准确性。Through this embodiment, the memory address is determined according to the product of the identification value and the size of the address unit, and the sum of the base address, which can improve the accuracy of the target memory address transmission while reducing the number of bits of the target memory address in the target transmission message.

在一个示范性实施例中,在根据目标标识值、基地址和地址单元大小,确定出目标内存地址之后,上述方法还包括:对目标内存地址进行合法性检查,得到合法性检查结果;在合法性检查结果指示目标内存地址合法的情况下,保存目标内存地址,并释放目标传输消息;在合法性检查结果指示目标内存地址不合法的情况下,向发送端发送消息异常指示信息,并释放目标传输消息,其中,消息异常指示信息用于指示目标传输消息中所传输的内存地址异常。In a demonstration embodiment, after determining the target memory address according to the target identification value, base address, and address unit size, the above method also includes: the target memory address is checked to obtain the results of the legitimacy inspection; the target memory address is stored and the target transmission message is released; In the case of the law, send message anomalies to the sender and release the target transmission message. Among them, the message anomaly indicates that the memory address is abnormal in the transmission of the transmission message in the target.

为了提高消息传输的安全性,避免因传输的内存地址不合法等情况对接收端造成影响,在本实施例中,在确定出目标内存地址之后,可以对目标内存地址进行合法性检查,并得到合法性检查结果。In order to improve the security of message transmission and avoid the impact on the receiving end due to the illegality of the transmitted memory address, in this embodiment, after the target memory address is determined, a legality check can be performed on the target memory address, and the result of the legality check can be obtained.

在合法性检查结果指示目标内存地址合法的情况下,可以保存目标内存地址,并释放目标传输消息。在合法性检查结果指示目标内存地址不合法的情况下,可以向发送端发送消息异常指示信息,并释放目标传输消息。这里,消息异常指示信息可以用于指示目标传输消息中所传输的内存地址异常。If the result of the validity check indicates that the target memory address is legal, the target memory address may be saved, and the target transfer message may be released. In the case that the result of the legality check indicates that the target memory address is illegal, message exception indication information may be sent to the sender, and the target transfer message may be released. Here, the message abnormal indication information may be used to indicate that the memory address transmitted in the target transmission message is abnormal.

例如,以目标传输消息为IPC消息为例,在得到BufferAddr之后,接收端可以对BufferAddr进行参数检查,合法则直接使用该BufferAddr并释放IPC消息,并继续处理下一步,不合法则返回异常并释放IPC消息。For example, if the target transmission message is an IPC message, after obtaining the BufferAddr, the receiving end can check the parameters of the BufferAddr. If it is legal, it will directly use the BufferAddr and release the IPC message, and continue to process the next step. If it is not legal, it will return an exception and release the IPC message.

通过本实施例,通过对确定的内存地址进行合法性检查,可以避免不合法的内存地址导致传输的消息无效或对接收端造成影响等情况发生,可以提高消息传输的有效性。Through this embodiment, by checking the validity of the determined memory address, it is possible to avoid situations such as invalidity of the transmitted message caused by an illegal memory address or an impact on the receiving end, and the effectiveness of message transmission can be improved.

在一个示范性实施例中,对目标内存地址进行合法性检查,得到合法性检查结果,包括:在目标内存地址位于预设地址范围内的情况下,确定目标内存地址合法;在目标内存地址位于预设地址范围以外的情况下,确定目标内存地址不合法。In an exemplary embodiment, performing a legality check on the target memory address to obtain a legality check result includes: determining that the target memory address is legal if the target memory address is within a preset address range; determining that the target memory address is illegal if the target memory address is outside the preset address range.

对目标内存地址进行的合法性检查,可以是检查目标内存地址的大小是否位于预期的范围之内。在本实施例中,可以预先设定一个地址范围,即,预设地址范围,用于判断确定的内存地址是否合法。The legality check performed on the target memory address may be to check whether the size of the target memory address is within an expected range. In this embodiment, an address range may be preset, that is, a preset address range for judging whether the determined memory address is legal.

在目标内存地址位于预设地址范围内的情况下,可以确定目标内存地址合法。而在目标内存地址位于预设地址范围以外的情况下,可以确定目标内存地址不合法。When the target memory address is within the preset address range, it can be determined that the target memory address is legal. If the target memory address is outside the preset address range, it can be determined that the target memory address is illegal.

通过本实施例,通过预先设定内存地址的地址范围、并检查内存地址是否位于该地址范围之内来确定确定的内存地址是否合法,可以提高合法检查的效率,从而提高消息传输的效率。Through this embodiment, by presetting the address range of the memory address and checking whether the memory address is within the address range to determine whether the determined memory address is legal, the efficiency of legal checking can be improved, thereby improving the efficiency of message transmission.

下面结合可选示例对本申请实施例中的消息的传输方法进行解释说明。在本可选示例中,目标传输消息为IPC消息,目标内存地址为BufferAddr(即,buffer地址),目标传输消息为IPC消息,基地址为BaseAddr,地址单元大小为UnitSize。The message transmission method in the embodiment of the present application is explained below in combination with optional examples. In this optional example, the target transmission message is an IPC message, the target memory address is BufferAddr (ie, buffer address), the target transmission message is an IPC message, the base address is BaseAddr, and the address unit size is UnitSize.

由于IPC消息在不同FU间传输过程中有时需要多层转发,消息长度过长会占用较大带宽并增加命令传输耗时。本可选示例中提供了一种提升IPC消息传输效率的方法,消息内不再填写绝对的64bit地址,采用bufferId加bufferLength形式进行消息的传输。传输时发送端根据已经定义的BaseAddr和UnitSize以及将要传递的buffer地址计算出bufferId和bufferLength并填入消息体内,接收端根据已经定义的BaseAddr和UnitSize以及收到的bufferId和bufferLength计算出buffer地址,即完成了地址的传输。通过上述简单计算,可以大大压缩BufferAddr在消息内的所占空间,原来2个Dword只能传输一个64bit的绝对地址,优化后大致能传输4个或更多的绝对地址。通过增加简单计算实现了消息长度的减小,优化了进程与进程之间的数据交互,提升了消息传输的效率,减小了不必要的传输带宽浪费,更有效地利用总线带宽,有助于提高产品性能。Because IPC messages sometimes need multi-layer forwarding during transmission between different FUs, too long message length will occupy a large bandwidth and increase the time-consuming command transmission. This optional example provides a method to improve the efficiency of IPC message transmission. The absolute 64-bit address is no longer filled in the message, and the message is transmitted in the form of bufferId plus bufferLength. During transmission, the sending end calculates the bufferId and bufferLength based on the defined BaseAddr and UnitSize and the buffer address to be transmitted and fills them in the message body, and the receiving end calculates the buffer address based on the defined BaseAddr and UnitSize as well as the received bufferId and bufferLength, that is, the transmission of the address is completed. Through the above simple calculation, the space occupied by BufferAddr in the message can be greatly reduced. Originally, two Dwords could only transmit one 64-bit absolute address. After optimization, it can roughly transmit four or more absolute addresses. By adding simple calculations, the length of the message is reduced, the data interaction between processes is optimized, the efficiency of message transmission is improved, unnecessary waste of transmission bandwidth is reduced, and bus bandwidth is used more effectively, which helps to improve product performance.

本可选示例中的消息的传输方法的流程可以包括以下步骤:The flow of the message transmission method in this optional example may include the following steps:

步骤1,内存初始化时定义BaseAddr、UnitSize。Step 1. Define BaseAddr and UnitSize when initializing the memory.

步骤2,发送端获取到BufferAddr后,计算该BufferAddr相对于基地址的相对偏移量,根据公式bufferId =(BufferAddr–BaseAddr)/UnitSize,确定bufferId,根据需要传输的buffer大小除以UnitSize获取bufferLength。Step 2: After obtaining the BufferAddr, the sender calculates the relative offset of the BufferAddr relative to the base address, determines the bufferId according to the formula bufferId = (BufferAddr–BaseAddr)/UnitSize, and divides the size of the buffer to be transmitted by the UnitSize to obtain the bufferLength.

步骤3,将获取到的bufferId、bufferLength填进IPC消息结构体内,根据所占bit数可以动态调整各自所占比特数.Step 3: Fill the obtained bufferId and bufferLength into the IPC message structure, and dynamically adjust the number of bits occupied by each according to the number of occupied bits.

步骤4,接收端收到IPC消息,提取bufferId、bufferLength,根据步骤1中定义的参数,根据公式BufferAddr = bufferId*UnitSize+ BaseAddr,确定buffer地址。Step 4, the receiving end receives the IPC message, extracts bufferId and bufferLength, and determines the buffer address according to the parameters defined in step 1 and the formula BufferAddr = bufferId*UnitSize+ BaseAddr.

步骤5,得出BufferAddr后,可对BufferAddr进行参数检查,判断其是否在合法范围内,合法则直接使用 BufferAddr并释放IPC消息,不合法,则返回异常并释放IPC消息。Step 5: After getting the BufferAddr, you can check the parameters of the BufferAddr to determine whether it is within the legal range. If it is legal, use the BufferAddr directly and release the IPC message. If it is not legal, return an exception and release the IPC message.

通过本可选示例,通过在处理bufferAddr时增加简单的计算,可以实现对bufferAddr的重构,重构后的每个bufferAddr所占bits减小,进而减小了IPC消息长度,相较于传输直接地址的方式,减小了非必要的传输,有效提升了带宽利用率,更高效、充分地利用了传输总线。Through this optional example, by adding simple calculations when processing bufferAddr, the reconstruction of bufferAddr can be realized. The bits occupied by each bufferAddr after reconstruction are reduced, thereby reducing the length of IPC messages. Compared with the method of transmitting direct addresses, unnecessary transmission is reduced, bandwidth utilization is effectively improved, and the transmission bus is more efficiently and fully utilized.

需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described action order, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to preferred embodiments, and the actions and modules involved are not necessarily required by this application.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solutions of the embodiments of the present application can essentially be embodied in the form of software products that contribute to the prior art. The computer software products are stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), and include several instructions to enable a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the method of each embodiment of the application.

根据本申请实施例的又一方面,还提供了一种消息的传输装置,该装置用于实现上述实施例中所提供的消息的传输方法,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。According to yet another aspect of the embodiments of the present application, a device for transmitting a message is further provided, and the device is used to implement the method for transmitting a message provided in the above embodiments, and what has already been described will not be repeated. As used below, the term "module" may be a combination of software and/or hardware that realizes a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementations in hardware, or a combination of software and hardware are also possible and contemplated.

图4是根据本申请实施例的一种消息的传输装置的结构框图,如图4所示,该装置包括:Fig. 4 is a structural block diagram of a message transmission device according to an embodiment of the present application. As shown in Fig. 4, the device includes:

第一获取单元402,用于获取目标内存地址,其中,目标内存地址为待传输的目标传输消息所传输的、目标缓冲区的缓冲区地址;The first obtaining unit 402 is configured to obtain a target memory address, where the target memory address is the buffer address of the target buffer transmitted by the target transmission message to be transmitted;

第一确定单元404,用于根据基地址和地址单元大小,确定与目标内存地址对应的地址标识的标识值,得到目标标识值;The first determination unit 404 is configured to determine the identification value of the address identification corresponding to the target memory address according to the base address and the size of the address unit to obtain the target identification value;

第一执行单元406,用于将目标标识值写入到目标传输消息的消息结构体,并将目标传输消息传输给目标传输消息的接收端。The first execution unit 406 is configured to write the target identification value into the message structure of the target transfer message, and transmit the target transfer message to the receiving end of the target transfer message.

通过本申请实施例,获取目标内存地址,其中,目标内存地址为待传输的目标传输消息所传输的、目标缓冲区的缓冲区地址;根据基地址和地址单元大小,确定与目标内存地址对应的地址标识的标识值,得到目标标识值;将目标标识值写入到目标传输消息的消息结构体,并将目标传输消息传输给目标传输消息的接收端,可以解决相关技术中的进程间通信消息的传输方法存在由于需要传输的消息过长导致的消息传输效率低的问题,提高消息传输效率。Through the embodiment of the present application, the target memory address is obtained, wherein the target memory address is the buffer address of the target buffer transmitted by the target transfer message to be transmitted; according to the base address and the size of the address unit, the identification value of the address identification corresponding to the target memory address is determined to obtain the target identification value; the target identification value is written into the message structure of the target transmission message, and the target transmission message is transmitted to the receiving end of the target transmission message, which can solve the problem of low message transmission efficiency caused by too long messages to be transmitted in the inter-process communication message transmission method in the related art, and improve message transmission efficiency.

可选地,上述装置还包括:Optionally, the above-mentioned device also includes:

第二获取单元,用于在根据基地址和地址单元大小,确定与目标内存地址对应的地址标识的标识值之前,获取基地址和地址单元大小,其中,基地址和地址单元大小是在进行内存初始化的过程中设置的。The second obtaining unit is used to obtain the base address and the size of the address unit before determining the identification value of the address identification corresponding to the target memory address according to the base address and the size of the address unit, wherein the base address and the size of the address unit are set during memory initialization.

可选地,上述装置还包括:Optionally, the above-mentioned device also includes:

第二执行单元,用于将缓冲区地址的最小值,设置为基地址,以及将存储地址间的最小单元,设置为地址单元大小。The second execution unit is configured to set the minimum value of the buffer address as the base address, and set the minimum unit between the storage addresses as the size of the address unit.

可选地,第二获取单元包括:Optionally, the second acquisition unit includes:

读取单元,用于从预设寄存器中读取出基地址和地址单元大小。The read unit is used to read the base address and address unit size from the preset register.

可选地,第一确定单元包括:Optionally, the first determination unit includes:

第一确定模块,用于确定目标内存地址与基地址之间的地址偏移量,得到目标偏移量;The first determining module is used to determine the address offset between the target memory address and the base address to obtain the target offset;

第二确定模块,用于根据目标偏移量和地址单元大小,确定与目标内存地址对应的地址标识的目标标识值。The second determination module is configured to determine the target identification value of the address identification corresponding to the target memory address according to the target offset and the size of the address unit.

可选地,第二确定模块包括:Optionally, the second determination module includes:

确定子模块,用于将目标偏移量除以地址单元大小所得到的商,确定为与目标内存地址对应的地址标识的目标标识值。The determination submodule is used to determine the quotient obtained by dividing the target offset by the size of the address unit as the target identification value of the address identification corresponding to the target memory address.

可选地,上述装置还包括第二确定单元,第一执行单元包括写入模块,其中,Optionally, the above device further includes a second determination unit, and the first execution unit includes a writing module, wherein,

第二确定单元,用于根据目标缓冲区的缓冲区大小和地址单元大小,确定与目标内存地址对应的缓冲区长度参数的参数值,得到目标长度值;The second determining unit is used to determine the parameter value of the buffer length parameter corresponding to the target memory address according to the buffer size and the address unit size of the target buffer to obtain the target length value;

写入模块,用于将目标标识值和目标长度值写入到目标传输消息的消息结构体。The writing module is used for writing the target identification value and the target length value into the message structure of the target transmission message.

可选地,第二确定单元包括:Optionally, the second determination unit includes:

第三确定模块,用于将目标缓冲区的缓冲区大小除以地址单元大小所得到的商,确定为与目标内存地址对应的缓冲区长度参数的目标长度值。The third determining module is configured to divide the buffer size of the target buffer by the address unit size to determine the target length value of the buffer length parameter corresponding to the target memory address.

可选地,写入模块包括:Optionally, the write module includes:

写入子模块,用于按照目标标识值所占的比特数和目标长度值所占用的比特数,将目标标识值和目标长度值写入到目标传输消息的消息结构体。The writing sub-module is used to write the target identification value and the target length value into the message structure of the target transmission message according to the number of bits occupied by the target identification value and the number of bits occupied by the target length value.

可选地,上述装置还包括:Optionally, the above-mentioned device also includes:

调整单元,用于根据目标内存地址所占用的比特数,动态调整目标标识值所占的比特数和目标长度值所占的比特数。The adjustment unit is configured to dynamically adjust the number of bits occupied by the target identification value and the number of bits occupied by the target length value according to the number of bits occupied by the target memory address.

可选地,调整单元包括:Optionally, the adjustment unit includes:

第四确定模块,用于将目标内存地址所占用的比特数与预设比例的乘积,确定为目标标识值所占的比特数,将目标内存地址所占用的比特数与目标标识值所占的比特数的差值,确定为目标长度值所占的比特数。The fourth determining module is used to determine the product of the number of bits occupied by the target memory address and the preset ratio as the number of bits occupied by the target identification value, and determine the difference between the number of bits occupied by the target memory address and the number of bits occupied by the target identification value as the number of bits occupied by the target length value.

可选地,第一确定单元包括:Optionally, the first determination unit includes:

第五确定模块,用于在目标内存地址包含多个内存地址的情况下,根据基地址和地址单元大小,分别确定与多个内存地址中的每个内存地址对应的地址标识的标识值,得到与每个内存地址对应的标识值,其中,目标标识值包括与每个内存地址对应的标识值。The fifth determination module is used to determine the identification value of the address identification corresponding to each memory address in the plurality of memory addresses according to the base address and the size of the address unit when the target memory address includes multiple memory addresses, and obtain the identification value corresponding to each memory address, wherein the target identification value includes the identification value corresponding to each memory address.

可选地,第一获取单元包括:Optionally, the first acquisition unit includes:

获取模块,用于获取目标缓冲区的绝对地址,得到目标内存地址。The obtaining module is used to obtain the absolute address of the target buffer and obtain the target memory address.

根据本申请实施例的又一方面,还提供了一种消息的传输装置,该装置用于实现上述实施例中所提供的消息的传输方法,已经进行过说明的不再赘述。图5是根据本申请实施例的另一种消息的传输装置的结构框图,如图5所示,该装置包括:According to yet another aspect of the embodiments of the present application, a device for transmitting a message is further provided, and the device is used to implement the method for transmitting a message provided in the above embodiments, and what has already been described will not be repeated. Fig. 5 is a structural block diagram of another message transmission device according to an embodiment of the present application. As shown in Fig. 5, the device includes:

接收单元502,用于接收发送端发送的目标传输消息;a receiving unit 502, configured to receive the target transmission message sent by the sending end;

提取单元504,用于从目标传输消息的消息结构体中提取出目标标识值,其中,目标标识值是与目标内存地址对应的地址标识的标识值;An extracting unit 504, configured to extract a target identification value from the message structure of the target transmission message, wherein the target identification value is an identification value of an address identification corresponding to the target memory address;

第三确定单元506,用于根据目标标识值、基地址和地址单元大小,确定出目标内存地址。The third determining unit 506 is configured to determine the target memory address according to the target identification value, the base address and the size of the address unit.

通过本申请实施例,接收发送端发送的目标传输消息;从所述目标传输消息的消息结构体中提取出目标标识值,其中,所述目标标识值是与目标内存地址对应的地址标识的标识值;根据所述目标标识值、基地址和地址单元大小,确定出所述目标内存地址,可以解决相关技术中的进程间通信消息的传输方法存在由于需要传输的消息过长导致的消息传输效率低的问题,提高消息传输效率。Through the embodiment of the present application, the target transmission message sent by the sending end is received; the target identification value is extracted from the message structure of the target transmission message, wherein the target identification value is the identification value of the address identification corresponding to the target memory address; the target memory address is determined according to the target identification value, the base address and the size of the address unit, which can solve the problem of low message transmission efficiency caused by too long messages to be transmitted in the inter-process communication message transmission method in the related art, and improve the message transmission efficiency.

可选地,提取单元包括:Optionally, the extraction unit includes:

第六确定模块,用于确定目标标识值所占的比特数和目标长度值所占的比特数,其中,目标长度值是与目标内存地址对应的缓冲区长度参数的参数值,目标长度值用于标识与目标内存地址所对应的目标缓冲区的缓冲区大小;The sixth determining module is used to determine the number of bits occupied by the target identification value and the number of bits occupied by the target length value, wherein the target length value is the parameter value of the buffer length parameter corresponding to the target memory address, and the target length value is used to identify the buffer size of the target buffer corresponding to the target memory address;

提取模块,用于根据目标标识值所占的比特数和目标长度值所占的比特数,从目标传输消息的消息结构体中提取出目标标识值和目标长度值。The extraction module is used to extract the target identification value and the target length value from the message structure of the target transmission message according to the number of bits occupied by the target identification value and the number of bits occupied by the target length value.

可选地,第三确定单元包括:Optionally, the third determination unit includes:

第七确定模块,用于将目标标识值与地址单元大小的乘积、与基地址的和,确定为目标内存地址。The seventh determination module is configured to determine the sum of the product of the target identification value and the size of the address unit and the base address as the target memory address.

可选地,上述装置还包括:Optionally, the above-mentioned device also includes:

检查单元,用于在根据目标标识值、基地址和地址单元大小,确定出目标内存地址之后,对目标内存地址进行合法性检查,得到合法性检查结果;The checking unit is used to check the validity of the target memory address after determining the target memory address according to the target identification value, the base address and the size of the address unit, and obtain a result of the legality check;

第三执行单元,用于在合法性检查结果指示目标内存地址合法的情况下,保存目标内存地址,并释放目标传输消息;The third execution unit is used to save the target memory address and release the target transfer message when the legality check result indicates that the target memory address is legal;

第四执行单元,用于在合法性检查结果指示目标内存地址不合法的情况下,向发送端发送消息异常指示信息,并释放目标传输消息,其中,消息异常指示信息用于指示目标传输消息中所传输的内存地址异常。The fourth execution unit is configured to send message abnormality indication information to the sender and release the target transmission message when the legality check result indicates that the target memory address is illegal, wherein the message abnormality indication information is used to indicate that the memory address transmitted in the target transmission message is abnormal.

可选地,检查单元包括:Optionally, the inspection unit includes:

第八确定模块,用于在目标内存地址位于预设地址范围内的情况下,确定目标内存地址合法;An eighth determination module, configured to determine that the target memory address is legal when the target memory address is within a preset address range;

第九确定模块,用于在目标内存地址位于预设地址范围以外的情况下,确定目标内存地址不合法。The ninth determination module is configured to determine that the target memory address is illegal when the target memory address is outside the preset address range.

需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述各个模块以任意组合的形式分别位于不同的处理器中。It should be noted that each of the above-mentioned modules can be implemented by software or hardware. For the latter, it can be implemented in the following manner, but is not limited to this: the above-mentioned modules are all located in the same processor; or, the above-mentioned various modules are respectively located in different processors in any combination.

根据本申请实施例的又一方面,还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,其中,该计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。According to yet another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is set to execute the steps in any one of the above method embodiments when running.

在一个示例性实施例中,上述计算机可读存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器(Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各种可以存储计算机程序的介质。In an exemplary embodiment, the above-mentioned computer-readable storage medium may include, but not limited to, various media capable of storing computer programs such as a USB flash drive, a read-only memory (Read-Only Memory, ROM for short), a random access memory (Random Access Memory, RAM for short), a removable hard disk, a magnetic disk, or an optical disk.

根据本申请实施例的又一方面,还提供了一种电子设备,包括存储器和处理器,该存储器中存储有计算机程序,该处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。According to still another aspect of the embodiments of the present application, there is also provided an electronic device, including a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.

在一个示例性实施例中,上述电子设备还可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。In an exemplary embodiment, the electronic device may further include a transmission device and an input and output device, wherein the transmission device is connected to the processor, and the input and output device is connected to the processor.

本实施例中的具体示例可以参考上述实施例及示例性实施方式中所描述的示例,本实施例在此不再赘述。For specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments and exemplary implementation manners, and details will not be repeated here in this embodiment.

显然,本领域的技术人员应该明白,上述的本申请实施例的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本申请实施例不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by the computing device, and thus, they can be stored in the storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps in them Made into a single integrated circuit module to achieve. Thus, embodiments of the present application are not limited to any specific combination of hardware and software.

以上所述仅为本申请的优选实施例而已,并不用于限制本申请实施例,对于本领域的技术人员来说,本申请实施例可以有各种更改和变化。凡在本申请实施例的原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请实施例的保护范围之内。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the embodiments of the present application. For those skilled in the art, various modifications and changes may be made to the embodiments of the present application. Any modification, equivalent replacement, improvement, etc. made within the principles of the embodiments of the present application shall be included in the protection scope of the embodiments of the present application.

Claims (18)

CN202310199164.0A2023-03-032023-03-03 Message transmission method and device, storage medium and electronic deviceActiveCN115878351B (en)

Priority Applications (2)

Application NumberPriority DateFiling DateTitle
CN202310199164.0ACN115878351B (en)2023-03-032023-03-03 Message transmission method and device, storage medium and electronic device
PCT/CN2024/079088WO2024183587A1 (en)2023-03-032024-02-28Message transmission methods and apparatuses, nonvolatile readable storage medium and electronic apparatus

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202310199164.0ACN115878351B (en)2023-03-032023-03-03 Message transmission method and device, storage medium and electronic device

Publications (2)

Publication NumberPublication Date
CN115878351A CN115878351A (en)2023-03-31
CN115878351Btrue CN115878351B (en)2023-07-21

Family

ID=85761950

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202310199164.0AActiveCN115878351B (en)2023-03-032023-03-03 Message transmission method and device, storage medium and electronic device

Country Status (2)

CountryLink
CN (1)CN115878351B (en)
WO (1)WO2024183587A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN115878351B (en)*2023-03-032023-07-21苏州浪潮智能科技有限公司 Message transmission method and device, storage medium and electronic device
CN119512973A (en)*2023-08-152025-02-25深圳市中兴微电子技术有限公司 Address writing method, device, storage medium and chip

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JP3406983B2 (en)*1994-09-162003-05-19日本電信電話株式会社 Inter-process message communication method
CN102308532B (en)*2009-05-212013-10-09华为终端有限公司 Point-to-multipoint push message processing method, system and server
CN113760560A (en)*2020-06-052021-12-07华为技术有限公司 An inter-process communication method and inter-process communication device
CN112214329B (en)*2020-11-042023-09-22腾讯科技(上海)有限公司Memory management method, device, equipment and computer readable storage medium
CN115269642A (en)*2021-04-292022-11-01青岛海尔智能技术研发有限公司Data processing method, device and system
CN115525417A (en)*2021-06-242022-12-27北京图森智途科技有限公司Data communication method, communication system, and computer-readable storage medium
CN113672499B (en)*2021-07-202024-11-12杭州中天微系统有限公司 Method and system for tracking target variables in an executable program
CN115878351B (en)*2023-03-032023-07-21苏州浪潮智能科技有限公司 Message transmission method and device, storage medium and electronic device

Also Published As

Publication numberPublication date
CN115878351A (en)2023-03-31
WO2024183587A1 (en)2024-09-12

Similar Documents

PublicationPublication DateTitle
CN115878351B (en) Message transmission method and device, storage medium and electronic device
CN109981480A (en)A kind of data transmission method and the first equipment
US11023412B2 (en)RDMA data sending and receiving methods, electronic device, and readable storage medium
CN107257329B (en)A kind of data sectional unloading sending method
CN110870286B (en) Fault-tolerant processing method, apparatus and server
CN116633886A (en)Data transmission method, network card of data receiving end, electronic equipment and storage medium
CN113422793A (en)Data transmission method and device, electronic equipment and computer storage medium
CN114945009A (en)Method, device and system for communication among devices connected through PCIe bus
CN109478171B (en)Improving throughput in openfabics environment
CN112422485B (en)Communication method and device of transmission control protocol
CN113973091A (en)Message processing method, network equipment and related equipment
CN113422792B (en)Data transmission method, device, electronic equipment and computer storage medium
CN113238789B (en)Electronic device, firmware upgrading method and device thereof and computer readable storage medium
CN111459819B (en) Software testing method and device, electronic equipment, computer readable medium
CN118381832A (en)Data message transmission method and device and computer readable storage medium
CN118012351A (en)Data read-write order keeping method and device based on remote storage protocol, electronic equipment and storage medium
CN112039801B (en)Method, system and proxy server for setting IP information
CN113626295B (en)Method and system for processing pressure measurement data and computer readable storage medium
CN102891732A (en)Data sending method and device and data receiving method and device
CN108304214B (en)Method and device for verifying integrity of immediate data
CN111163100A (en)Data structure, communication method, device, storage medium and equipment
CN115250257A (en)Ethernet message processing method and device applied to DPU
CN113132324B (en)Sample identification method and system
CN112968809B (en) A system stability and compatibility testing method and device
CN114679425A (en)Message processing method, network equipment and storage medium in 5G network

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
CP03Change of name, title or address

Address after:215000 Building 9, No.1 guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Suzhou City, Jiangsu Province

Patentee after:Suzhou Yuannao Intelligent Technology Co.,Ltd.

Country or region after:China

Address before:215000 Building 9, No.1 guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Suzhou City, Jiangsu Province

Patentee before:SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd.

Country or region before:China


[8]ページ先頭

©2009-2025 Movatter.jp