CN-116318534-B - Data transmission method based on cache structure
Abstract
The application provides a data transmission method based on a buffer structure, which belongs to the technical field of computer communication, and particularly relates to a method for transmitting data, wherein a transmitting buffer area is arranged in a transmitting storage area of a file to be transmitted, a receiving buffer area is arranged in a receiving storage area, whether the data to be transmitted is updated is checked, the data to be transmitted is transmitted after the data to be transmitted is updated, the file to be transmitted is written into the transmitting buffer area or is directly transmitted to the receiving storage area, a link between the transmitting storage area and the receiving storage area of the file to be transmitted is established through a handshake mechanism, the number of data packets allowed to be transmitted at one time is calculated, the file to be transmitted is transmitted to the receiving buffer area, and the receiving storage area confirms that marks of the file to be transmitted in the receiving buffer area are matched and then receives the file. By the processing scheme, the space resources of the memory are utilized to the maximum extent while the transmission efficiency is improved.
Inventors
- WANG YING
- BAI JIE
- GUO LIWEI
- ZHANG MIN
- NIU BO
- TIAN GENG
Assignees
- 中国航空工业集团公司西安航空计算技术研究所
Dates
- Publication Date
- 20260505
- Application Date
- 20221215
Claims (3)
- 1. The data transmission method based on the cache structure is characterized by comprising the following steps: A sending buffer area is arranged in a sending storage area of a file to be sent, and a receiving buffer area is arranged on a receiving storage area; Checking whether the data to be sent is updated, sending after the updating is finished, and writing the file to be sent into a sending buffer area or directly sending the file to be sent to an accepting storage area; establishing a link between a sending storage area and a receiving storage area of a file to be sent through a handshake mechanism, and calculating the number of data packets allowed to be sent once; the file to be sent is sent to a receiving buffer area, and the receiving buffer area confirms that the marks of the file to be sent in the receiving buffer area are matched and then receives the file; When the communication mode is based on node transmission, the number of data packets which are allowed to be transmitted at one time is the minimum number of the remaining space of the transmission buffer area, the number of the remaining data packets and the number of the data packets set by the system; When the communication mode is based on frame transmission, the number of data packets which are allowed to be transmitted at one time is the minimum number of the median of the residual space of the transmission buffer area, the number of the residual data packets and the number of the data packets of the manufacturer definition related quantity; The method comprises the steps of firstly judging whether a sending buffer area is full or directly sending the file to an accepting storage area, if so, emptying, if so, judging whether data can be written into a bus or not, if so, directly writing the data into the bus, if not, temporarily writing the data into the sending buffer area, waiting for the bus to be idle, and then writing the data into the bus for sending; The method for receiving the file to be transmitted comprises the steps of firstly judging whether a receiving buffer area-a receiving circular queue is full or not after the receiving buffer area confirms that the marks of the file to be transmitted in the receiving buffer area are matched, wherein the judging method is to calculate the residual space of the receiving circular queue, if the residual space is 0, the receiving circular queue is full and empty, otherwise, the data is stored in the receiving circular queue, and the periodic task polling access is waited.
- 2. The method of claim 1, wherein the step of checking whether the data to be transmitted is updated comprises setting a flag to indicate whether the data to be transmitted in the first data field is updated before the data to be transmitted in the first data field is written into the buffer or the bus, waiting for a set time to wait for the update if the data to be transmitted in the first data field is updated, and immediately reading the data if the data to be transmitted in the first data field is updated.
- 3. The data transmission method based on the buffer structure according to claim 1, wherein the step of calculating the number of data packets allowed to be transmitted at one time comprises: for data transfer between modules, links are established first, and then the number of data packets allowed to be sent at a time is calculated according to the information provided by the establishment of the links.
Description
Data transmission method based on cache structure Technical Field The application relates to the field of computer communication, in particular to a data transmission method based on a cache structure. Background In the communication process, the data transmission rate and the stability are two key factors for measuring the communication. In the current communication, direct transmission is adopted, and the method has too high requirements on memory capacity and CPU operation speed. When transmitting data with the bottom layer, there are two points to influence the success rate of transmission: 1. In the multi-packet transmission, the method for calculating the number of data packets which are allowed to be transmitted once during unpacking is adopted, the number of the packets is too small, so that the hardware waste is caused, the hardware resources cannot be utilized to the greatest extent, and the situation that the bottom layer is blocked, the packets are lost and the like is caused by too many packets. 2. When data is transmitted to the bottom layer, flow control needs to be considered in an algorithm so as to avoid blocking caused by the fact that the data cannot be taken away in time. Disclosure of Invention In view of this, the present application provides a data transmission method based on a buffer structure, which solves the problems in the prior art, improves the transmission efficiency, and maximally utilizes the space resources of the memory. The data transmission method based on the cache structure provided by the application adopts the following technical scheme: a data transmission method based on a cache structure comprises the following steps: A sending buffer area is arranged in a sending storage area of a file to be sent, and a receiving buffer area is arranged on a receiving storage area; Checking whether the data to be sent is updated, sending after the updating is finished, and writing the file to be sent into a sending buffer area or directly sending the file to be sent to an accepting storage area; establishing a link between a sending storage area and a receiving storage area of a file to be sent through a handshake mechanism, and calculating the number of data packets allowed to be sent once; and the file to be sent is sent to a receiving buffer area, and the receiving buffer area confirms that the marks of the file to be sent in the receiving buffer area are matched and then receives the file. Optionally, the step of checking whether the data to be sent is updated, and sending the data after the update includes setting a flag to identify whether the data to be sent in the first data domain is being updated before the data to be sent in the first data domain is written into the buffer area or the bus, waiting for a set time if the data to be sent in the first data domain is being updated, waiting for the data to be sent to be updated, and immediately reading the data if the data to be sent in the first data domain is updated. Optionally, the step of calculating the number of data packets allowed to be transmitted at a time includes: for data transfer between modules, links are established first, and then the number of data packets allowed to be sent at a time is calculated according to the information provided by the establishment of the links. Optionally, when the communication mode is based on node transmission, the number of data packets allowed to be sent at a time is the smallest number among the remaining space of the sending buffer area, the number of the remaining data packets and the number of the data packets set by the system. Optionally, when the communication mode is based on frame transmission, the number of data packets allowed to be transmitted at a time is the smallest number among the remaining space of the transmission buffer, the number of data packets remaining, and the number of data packets of the manufacturer defined correlation quantity. Optionally, writing the file to be transmitted into the transmission buffer or directly transmitting the file to the receiving storage area includes the steps of firstly judging whether the transmission buffer is full, if so, emptying, if so, judging whether the data can be written into the bus or not, if so, directly writing the data into the bus, if not, temporarily writing the data into the transmission buffer, waiting for the bus to be idle, and then writing the data into the bus for transmission. Optionally, the file to be sent is sent to the receiving buffer area, and the receiving buffer area receives the file after confirming that the mark of the file to be sent in the receiving buffer area is matched, specifically includes firstly judging whether the receiving buffer area-receiving circular queue is full or not, if so, calculating the residual space of the receiving circular queue, if the residual space is 0, then indicating that the receiving circular queue is full, and emptying; otherwise, the data is stored i