CN119166392A - Computer software data transmission method, device and equipment - Google Patents
Computer software data transmission method, device and equipment Download PDFInfo
- Publication number
- CN119166392A CN119166392A CN202411658768.8A CN202411658768A CN119166392A CN 119166392 A CN119166392 A CN 119166392A CN 202411658768 A CN202411658768 A CN 202411658768A CN 119166392 A CN119166392 A CN 119166392A
- Authority
- CN
- China
- Prior art keywords
- data
- queue
- target
- block
- queues
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 53
- 230000005540 biological transmission Effects 0.000 title claims abstract description 42
- 238000012216 screening Methods 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 7
- 238000013500 data storage Methods 0.000 claims description 4
- 238000010586 diagram Methods 0.000 description 7
- 230000007717 exclusion Effects 0.000 description 6
- 238000004891 communication Methods 0.000 description 5
- 238000012545 processing Methods 0.000 description 4
- 238000001514 detection method Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 1
- 238000013467 fragmentation Methods 0.000 description 1
- 238000006062 fragmentation reaction Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/544—Buffers; Shared memory; Pipes
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention provides a method, a device and equipment for transmitting computer software data, which comprises the steps of establishing a data queue, wherein the data queue comprises a plurality of data blocks, each data block comprises an identifier, an effective length and a data area, initializing the data queue, starting a data transmitting end and a data receiving end of the computer software data, controlling the data transmitting end to detect the target data block which is marked as an empty state according to the sequence of the data blocks in the data queue, writing the computer software data to be transmitted into the data area of the target data block, recording the actual length of the written data in the effective length, setting the identifier of the target data block as a non-empty state, controlling the data receiving end to detect the target data block which is marked as the non-empty state according to the sequence of the data blocks in the data queue, acquiring the data in the data area based on the effective length of the target data block, and setting the identifier of the target data block after acquiring the data as the empty state, and completing the data transmission more efficiently.
Description
Technical Field
The present invention relates to the field of computer software communications technologies, and in particular, to a method, an apparatus, and a device for transmitting computer software data.
Background
Transmission of computer software data may refer to exchanging software data from one thread to another thread, or exchanging software data from one process to another. In the process of transmitting software data, the mutual exclusion lock and the semaphore are often utilized to control the software data, and the synchronization of the software data is completed by means of the kernel resources of the computer system.
But both the mutex (lock apply/release) and the semaphore (resource apply/release) are time consuming operations, while both the mutex and the semaphore are limited kernel resources. Therefore, the data transmission is completed by depending on the two kernel resources of the mutual exclusion lock and the semaphore, so that the transmission efficiency is affected to a certain extent, and particularly, under the high-frequency data interaction scene, the kernel resources are accessed by each time of data transmission and reception, at the moment, the efficiency of the data transmission is seriously reduced by the limited kernel resources, and the higher the data transmission frequency is, the lower the data transmission efficiency is.
Disclosure of Invention
The invention provides a method, a device and equipment for transmitting computer software data, which are used for solving the technical problem of low software data transmission efficiency in the prior art.
In one aspect, the present invention provides a method for transmitting computer software data, including:
applying for a memory space, and establishing a data queue in the memory space, wherein the data queue comprises a plurality of data blocks, and each data block comprises an identifier, an effective length and a data area;
Initializing the data queue to determine the size and total number of the data blocks in the data queue, and setting the identification and the data area of each data block of the data queue to be in an empty state;
Starting a data transmitting end and a data receiving end of the computer software data;
The control data transmitting end detects a target data block marked as an empty state according to the sequence of the data blocks in the data queue, writes the computer software data to be transmitted into a data area of the target data block, records the actual length of the written data in the effective length, and sets the mark of the target data block as a non-empty state;
And the control data receiving end detects the target data block marked as the non-empty state according to the sequence of the data blocks in the data queue, acquires data in the data area based on the effective length of the target data block marked as the non-empty state, and sets the mark of the target data block after acquiring the data as the empty state.
According to the method for transmitting the computer software data, when a plurality of data queues are provided, the sizes of the data blocks of the data queues are different;
after initializing the data queue, the method further comprises:
Comparing the data length of the computer software data to be transmitted with the data length of the data blocks in each data queue to obtain a comparison result;
Screening target queues with the data length of the data blocks being greater than or equal to the data length of the computer software data to be transmitted from the data queues based on the comparison result;
Screening one of the target queues as a final queue;
The control data transmitting end detects the target data block marked as empty according to the sequence of the data blocks in the data queue, and the control data transmitting end comprises the following steps:
and the control data transmitting end detects the target data block marked as an empty state according to the sequence of the data blocks in the final queue.
According to the method for transmitting computer software data provided by the invention, one of the target queues is screened as a final queue, and the method comprises the following steps:
and screening one with the smallest data length of the data block from each target queue to be used as a final queue.
According to the method for transmitting computer software data provided by the invention, when the number of the data queues is multiple, the number of the data receiving ends is also multiple and is less than the number of the data queues, the control data receiving end detects the target data block marked as a non-empty state according to the sequence of the data blocks in the data queues, and the method comprises the following steps:
grouping the data queues based on the transmission data quantity of the data queues to obtain a plurality of queue groups, wherein the number of the queue groups is the same as that of the data receiving ends;
determining the corresponding relation between each queue group and each data receiving end;
And controlling each data receiving end to sequentially detect the target data blocks marked as non-empty states according to the sequence of the data blocks for the data queues in the corresponding queue groups.
According to the method for transmitting the computer software data, the more the number of the data queues contained in the queue group is, the smaller the data transmission amount of a single data queue in the queue group is;
the fewer the number of data queues contained in the queue set, the greater the amount of data transferred by a single data queue in the queue set.
According to the method for transmitting computer software data provided by the invention, when a plurality of data queues are provided and one data receiving end is provided, the control data receiving end detects target data blocks marked as non-empty states according to the sequence of the data blocks in the data queues, and the method comprises the following steps:
and controlling the data receiving end to sequentially detect the target data blocks marked as non-empty states for each data queue according to the sequence of the data blocks.
According to the method for transmitting computer software data provided by the invention, when the number of the data queues is multiple, and the number of the data receiving ends is also multiple, and the control data receiving ends are in one-to-one correspondence with the data queues, the control data receiving ends detect target data blocks marked as non-empty states according to the sequence of the data blocks in the data queues, and the method comprises the following steps:
And controlling each data receiving end to detect the target data block marked as a non-empty state according to the sequence of the data blocks for the corresponding data queues.
According to the method for transmitting computer software data provided by the invention, the memory space is applied, a data queue is built in the memory space, and the method further comprises the following steps:
establishing connection between a first data block and a last data block in the data queue;
After the identification of the target data block is set to a non-null state, the method further comprises:
controlling the data sending end to point to the next data block;
if the next pointed data block is the last data block, controlling the data transmitting end to point to the first data block;
after the identification of the target data block after the data acquisition is set to be in the null state, the method further comprises the following steps:
controlling the data receiving end to point to the next data block;
And if the next pointed data block is the last data block, controlling the data receiving end to point to the first data block.
In another aspect, the present invention also provides a device for transmitting computer software data, including:
The system comprises a queue creation module, a data storage module and a data storage module, wherein the queue creation module is used for applying for a memory space and creating a data queue in the memory space, the data queue comprises a plurality of data blocks, and each data block comprises an identifier, an effective length and a data area;
the initialization module is used for initializing the data queue to determine the size and the total number of the data blocks in the data queue and setting the identification of each data block in the data queue to be in an empty state;
the starting module is used for starting a data transmitting end and a data receiving end of the computer software data;
The sending module is used for controlling a data sending end to detect a target data block marked as an empty state according to the sequence of the data blocks in the data queue, writing computer software data to be transmitted into a data area of the target data block, recording the actual length of the written data in the effective length, and setting the mark of the target data block as a non-empty state;
The receiving module is used for controlling the data receiving end to detect the target data block marked as the non-empty state according to the sequence of the data blocks in the data queue, acquiring data in the data area based on the effective length of the target data block marked as the non-empty state, and setting the mark of the target data block after acquiring the data as the empty state.
In another aspect, the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements a method for transmitting any of the above-mentioned computer software data when executing the program.
The invention provides a method, a device and equipment for transmitting computer software data, which are characterized in that a data queue is established, wherein the data queue comprises a plurality of data blocks, a data transmitting end is controlled to detect target data blocks marked as empty according to the sequence of the data blocks in the data queue, computer software data to be transmitted is written into a data area of the target data blocks, the actual length of the written data is recorded in the effective length, the mark of the target data blocks is set as non-empty, a data receiving end is controlled to detect target data blocks marked as non-empty according to the sequence of the data blocks in the data queue, data is acquired in the data area based on the effective length of the target data blocks, and the mark of the target data blocks after the data acquisition is set as empty. The data transmitting end and the data receiving end of the embodiment do not use kernel resources such as mutual exclusion locks and semaphores, namely, the data transmission of the embodiment is not limited to the limited kernel resources such as mutual exclusion locks and semaphores, and the same transmission efficiency can be ensured no matter single large data block transmission or small data block transmission, and the delay of data transmission is greatly reduced.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a method for transmitting computer software data according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a data block according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a data queue according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a plurality of data queues according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a transmission device for computer software data according to an embodiment of the present invention;
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Fig. 1 is a flowchart of a method for transmitting computer software data according to an embodiment of the present invention. The execution subject of the method can be a computer, a mobile phone or intelligent wearable equipment and the like. Referring to fig. 1, a transmission method of computer software data may include the following steps 101 to 105.
101. Applying for a memory space, and establishing a data queue in the memory space, wherein the data queue comprises a plurality of data blocks, and each data block comprises an identifier, an effective length and a data area.
In this step, the transfer of computer software data may include two cases, one in which computer software data is transferred between threads (i.e., within computer application software) and the other in which computer software data is transferred between processes (i.e., between different computer application software). When software data is transmitted between threads, the memory space can be directly applied in a computer, and then the creation of a data queue is completed. When software data is transmitted between processes, a shared memory mode can be adopted between the processes to realize the creation of a data queue.
The structure of the data block may be seen in fig. 2, and the data block may include three fields of "identification", "effective length", and "data area". The "identifier" may generally occupy 1 Byte (Byte), the "effective length" may occupy 4 bytes (Byte), and the size of the data in the "data area" is determined according to the length of the data sequence where the data is located, which is the maximum transmission data at a time. The flag is used to indicate the state of the data in the data block, the null state (e.g., flag 0) indicates that the data area is null or the data in the data area has been consumed by the data receiving end, and the non-null state (e.g., flag 1) indicates that the data in the data area is valid and not consumed by the data receiving end. The "effective length" is used to indicate the effective data length of the data in the data area, and the maximum value of the "effective length" cannot exceed the total size of the data that can be stored in the data area. The data area is used for storing data. The actual effective length of the data in the data area is determined by the "effective length" field.
In the same data queue, the sizes of the data blocks are consistent, after the data transmitting end and the data receiving end finish operation on one data block, the data transmitting end and the data receiving end can be fixedly offset by one complete data block to reach the next data block, and the data transmitting mode of the data transmitting end and the data receiving end can be simplified due to the consistent sizes of the data blocks. Both the effective length and the data area are effective when identified as non-empty.
102. Initializing the data queue to determine the size and total number of data blocks in the data queue, and placing the identification of each data block and the data area of the data queue in a null state.
In this step, the data queue needs to be initialized when the data block in the data queue is first created. At initialization, the size and total number of data blocks may be assigned to the head of the data queue. The size of each data block in the data queue may also be referred to as a single block size. The data length that one data block can transmit at most once is "single block size minus (" mark "+" effective length "). The total block number of the data blocks represents the maximum number of data that can be buffered in the data queue. The larger the "monolithic size", the higher the supportable transmission bandwidth, the more the total number of data blocks, and the stronger the jitter adaptability of the data receiving end to receive the data.
103. And starting a data transmitting end and a data receiving end of the computer software data.
In this step, the data transmitting end and the data receiving end can access the data queue in the memory space.
104. The control data transmitting end detects the target data block marked as an empty state according to the sequence of the data blocks in the data queue, writes the computer software data to be transmitted into the data area of the target data block, records the actual length of the written data in the effective length, and sets the mark of the target data block as a non-empty state.
In this embodiment, the control data transmitting end detects the target data block marked as empty according to the sequence of the data blocks in the data queue, which specifically includes that the control data transmitting end points to the first data block according to the sequence of the data blocks, if the first data block marked as non-empty, the data queue is full, the mark of the current data block (the first data block) can be detected in a non-interval and infinite polling mode until the mark shows the empty state, and the target data block is obtained. After the software data is written into the target data block, the identifier of the data block can be set to be in a non-empty state, then the next data block is pointed, and the state of the identifier of the next data block is continuously detected in the mode of no interval and infinite polling.
105. The control data receiving end detects the target data block marked as the non-empty state according to the sequence of the data blocks in the data queue, acquires data in the data area based on the effective length of the target data block marked as the non-empty state, and sets the mark of the target data block after acquiring the data as the empty state.
In the step, the control data receiving end detects the target data block marked as the non-empty state according to the sequence of the data blocks in the data queue, and specifically comprises the steps that the control data receiving end points to the first data block according to the sequence of the data blocks in the data queue, if the first data block marked as the empty state indicates that the data queue is empty and no new data is received, the mark of the current data block (the first data block) can be detected in a non-interval and non-polling mode until the mark shows the non-empty state, and the target data block is obtained. When a non-empty state is detected, the data in the target data block is read in the manner described above. After the data reading is finished, pointing to the next data block, and continuously detecting the identification state of the next data block in a non-interval and infinite polling mode.
In this embodiment, a data queue is established, where the data queue includes a plurality of data blocks, a control data transmitting end detects a target data block identified as an empty state according to a sequence of the data blocks in the data queue, computer software data to be transmitted is written into a data area of the target data block, an actual length of the written data is recorded in an effective length, the identification of the target data block is set as a non-empty state, a control data receiving end detects the target data block identified as the non-empty state according to the sequence of the data blocks in the data queue, data is acquired in the data area based on the effective length of the target data block, and the identification of the target data block after the data acquisition is set as the empty state. The data transmitting end and the data receiving end of the embodiment do not use kernel resources such as mutual exclusion locks and semaphores, namely, the data transmission of the embodiment is not limited to the limited kernel resources such as mutual exclusion locks and semaphores, and the same transmission efficiency can be ensured no matter single large data block transmission or small data block transmission, and the delay of data transmission is greatly reduced. When the ability of the data receiving end to consume data is larger than the ability of the data transmitting end to produce data and processor time slice switching is not considered, the software data has almost zero delay from the data transmitting end to the data receiving end.
In an embodiment of the present disclosure, applying for a memory space and establishing a data queue in the memory space may further include:
establishing connection between a first data block and a last data block in a data queue;
after placing the identification of the target data block in the non-null state, it may further include:
The control data transmitting end points to the next data block;
If the next data block is the last data block, controlling the data transmitting end to point to the first data block;
After the identifier of the target data block after the data acquisition is set to be in the null state, the method may further include:
the control data receiving end points to the next data block;
if the next data block is the last data block, the control data receiving end points to the first data block.
In this embodiment, the connection between the first data block and the last data block in the data queue is established, i.e. the data queue may be made a circular data queue. As shown in fig. 3, the total number of blocks of data is N, and the individual block sizes of each data block are the same, e.g., including data block 1, data block 2, data block 3, and so on, up to data block N. The data block N and the data block 1 are connected to form a loop. The data receiving end can consume/read data in the data block, and the data transmitting end can produce/write data in the data block. The circulating data queue has various advantages, such as space saving, avoiding frequent memory allocation and release, reducing memory fragmentation, improving efficiency, improving the efficiency of enqueuing and dequeuing operations by circularly utilizing the data block space, avoiding false overflow, effectively utilizing the memory space by a head-to-tail circulating structure, and solving the false overflow problem of the sequential queue.
In an embodiment of the present disclosure, when there are a plurality of data queues, the sizes of the data blocks of the data queues are different;
After initializing the data queue, it may further include:
comparing the data length of the computer software data to be transmitted with the data length of the data blocks in each data queue to obtain a comparison result;
Screening target queues with the data length of the data blocks being greater than or equal to the data length of the computer software data to be transmitted from each data queue based on the comparison result;
screening one of the target queues as a final queue;
The control data transmitting end detects the target data block marked as the empty state according to the sequence of the data blocks in the data queue, and can comprise:
And the control data transmitting end detects the target data block marked as the empty state according to the sequence of the data blocks in the final queue.
In this embodiment, when there is only one data queue, it is necessary to ensure that the size of the "data area" of each data block in the data queue must be larger than the data size that is required to be sent by the data sending end at a single time, and when the data sending end sends data each time, a complete data block will be consumed no matter what the length of the data to be sent is. The size of data sent by the data sending end each time may be unstable, and if the data block is set larger, memory resources are wasted when small data is sent. In order to avoid the above problems, a plurality of data queues may be created, the sizes of the data blocks of each data queue are different, the data length of the computer software data to be transmitted and the data length of the data blocks in each data queue are compared to obtain a comparison result, the target queues with the data length of the data blocks greater than or equal to the data length of the computer software data to be transmitted are screened out from each data queue based on the comparison result, and one target queue is screened out from each target queue to be used as a final queue.
In this embodiment, the size of the data blocks of each data queue is different, i.e., the individual sizes of the data queues are different. In addition to the monolithic size being different for each data queue, the total number of blocks of data may also be different. Each data queue may be a separate circular data queue. The single block size of the data queue can be obtained according to the size of the single transmission of the actual data, and the minimum data of the single transmission of the actual data is recorded as N. The individual block size of each data queue may be set.
In this embodiment, referring to fig. 4, fig. 4 is a schematic structural diagram of a plurality of data queues according to an embodiment of the present invention. In fig. 4, the data queues sequentially increase in size from top to bottom, that is, the data queue located above is a small block queue, and the data queue located below is a large block queue. Let I be the number of data queues I, i.e. the total number of data queues. I is equal to 1 and represents a first data queue, the size of the "data area" of which is defined as N. I is equal to 2, which represents a second data queue, the "data area" of which has a size of N x (2 x 1). I is equal to 3 and represents a third data queue, the "data area" of which has a size of N x (2 x 2). Similarly, the size of the "data area" of the ith data queue is Nx (2 x (I-1). That is, starting from the second data queue, the size of the single block of the ith data queue may be specified according to the formula Nx (2 x (I-1). N represents the size of the "data area" in the data block, I represents the number of the circular data queue, or the total number of the data queues.
In one embodiment of the present disclosure, selecting one of the target queues as the final queue may include:
and screening one of the data blocks with the smallest data length from each target queue to be used as a final queue.
In this embodiment, one of the target queues with the smallest data length of the data block is selected as the final queue, so that the size of the data sent by the data sending end is closest to the size of the data block of the final queue, the occupation of the memory resource can be minimized, and the memory resource can be saved as much as possible.
Specifically, for example, X data queues are currently included, the data block size of the first queue is 32 Bytes, the data block size of the second queue is 64 Bytes, the data block size of the third queue is 128 Bytes, the data block size of the fourth queue is 256 Bytes, and so on, the data block size of the X-1 th queue is 1Mbyte, and the data block size of the X-th queue is 2Mbyte. At this time, if 100Byte data is required to be transmitted, a third queue is selected, if 150Byte data is required to be transmitted, a fourth queue is selected, and if 1.5Mbyte data is required to be transmitted, an X-th queue is selected. And similarly, when the number of the data queues is multiple, the mode of receiving the data by the data receiving end is consistent with the receiving mode of the single data queue.
In an embodiment of the present disclosure, when the number of the data queues is multiple, and the number of the data receiving ends is also multiple, and is less than the number of the data queues, the controlling the data receiving ends to detect the target data blocks marked as the non-empty state according to the sequence of the data blocks in the data queues may include:
Grouping the data queues based on the transmission data quantity of the data queues to obtain a plurality of queue groups, wherein the number of the queue groups is the same as that of the data receiving ends;
determining the corresponding relation between each queue group and each data receiving end;
And controlling each data receiving end to sequentially detect the target data blocks marked as non-empty states according to the sequence of the data blocks for the data queues in the corresponding queue groups.
In this embodiment, each queue group includes at least one data queue, that is, some queue groups include a plurality of data queues. For example, if there are M (M may be six) data queues, the data queues are arranged in order of the transmission data amount from small to large, that is, the transmission data amount of the first data queue is the smallest, the transmission data amount of the last data queue is the largest, the first to third data queues may be divided into one group, the fourth and fifth data queues may be divided into one group, and the sixth data queue may be divided into one group.
When the queue group corresponding to the data receiving end comprises a plurality of data queues, a target data block marked as a non-empty state can be detected for one of the data queues according to the sequence of the data blocks, and after the data of each data block of one data queue are read, the data of the other data queue in the queue group are read, and the like until the data of each data queue in the queue group are read. In addition, when the data receiving end detects that the identification of one data queue in the queue group is in an empty state, the processing of the data queue is stopped, and the detection of the identification of the next data queue in the queue group is directly carried out. The embodiment can play a role in balancing the data receiving capacity and the occupation of CPU (Central Processing Unit, CPU) resources, and can meet the performance requirement of a data receiving end while reducing the waste of CPU resources.
In one embodiment of the present disclosure, the greater the number of data queues included in a queue group, the smaller the amount of data transferred by a single data queue in the queue group;
The fewer the number of data queues contained in a queue group, the greater the amount of data transferred by a single data queue in the queue group.
In this embodiment, the transmission data amounts of the respective queue groups may be kept as close to or equal to each other as possible, that is, the more the number of data queues included in the queue group, the smaller the transmission data amount of a single data queue included in the queue group, the fewer the number of data queues included in the queue group, and the larger the transmission data amount of a single data queue included in the queue group, so that a balance point between the data receiving capability and the CPU resource occupation may be more easily determined, which does not waste CPU resources, and may also satisfy performance requirements of the data receiving end.
In an embodiment of the present disclosure, when the number of data queues is multiple and the number of data receiving ends is one, the controlling the data receiving end to detect the target data block marked as the non-empty state according to the sequence of the data blocks in the data queues may include:
And the control data receiving end sequentially detects the target data blocks marked as non-empty states for each data queue according to the sequence of the data blocks.
In this embodiment, assuming that there are M data queues, the data receiving end may first perform data reading on the first data queue, detect, according to the sequence of data blocks in the data queues, a target data block marked as a non-empty state, and read data of the target data block. And after the reading of all the data blocks of the first data queue is finished, starting to read the data of the second data queue, and so on until the reading of the data of the Mth data queue is finished. In addition, when the data receiving end detects that the identification of one data queue is in an empty state, the processing of the data queue is stopped, and the detection of the identification of the next data queue is directly carried out. After all the data queues are processed, the steps can be continuously started from the first data queue and circularly executed. The processing logic of the mode of sequentially reading each data queue through one data receiving end is simpler.
In an embodiment of the present disclosure, when there are multiple data queues and multiple data receiving ends are also multiple and correspond to the data queues one by one, the controlling the data receiving end to detect the target data block marked as the non-empty state according to the sequence of the data blocks in the data queues may include:
and controlling each data receiving end to detect the target data block marked as a non-empty state according to the sequence of the data blocks for the corresponding data queues.
In this embodiment, the data receiving ends are in one-to-one correspondence with the data queues, so that the efficiency of receiving data by the data receiving ends can be greatly improved.
Based on the same general inventive concept, the invention also protects a transmission device of computer software data, as shown in fig. 5. The transmission device of computer software data provided by the invention is described below, and the transmission device of computer software data described below and the transmission method of computer software data described above can be referred to correspondingly. The apparatus may include a queue creation module 201, an initialization module 202, a start-up module 203, a transmission module 204, and a reception module 205.
The queue creating module 201 is configured to apply for a memory space and create a data queue in the memory space, where the data queue includes a plurality of data blocks, and each data block includes an identifier, an effective length, and a data area.
The initialization module 202 is configured to initialize the data queue to determine the size and the total number of the data blocks in the data queue, and place the identifier of each data block in the data queue in an empty state.
The starting module 203 is used for starting a data transmitting end and a data receiving end of the computer software data.
The sending module 204 is configured to control the data sending end to detect, according to the sequence of the data blocks in the data queue, the target data block identified as an empty state, write the computer software data to be transmitted into the data area of the target data block, record the actual length of the written data in the effective length, and set the identification of the target data block as a non-empty state.
The receiving module 205 is configured to control the data receiving end to detect the target data block identified as the non-empty state according to the sequence of the data blocks in the data queue, acquire data in the data area based on the effective length of the target data block identified as the non-empty state, and set the identifier of the target data block after acquiring the data as the empty state.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
As shown in FIG. 6, the electronic device may include a processor (processor) 610, a communication interface (Communications Interface) 620, a memory (memory) 630, and a communication bus 640, where the processor 610, the communication interface 620, and the memory 630 communicate with each other via the communication bus 640. The processor 610 may invoke logic instructions in the memory 630 to perform a method of transferring computer software data.
Further, the logic instructions in the memory 630 may be implemented in the form of software functional units and stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. The storage medium includes a U disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program, the computer program being storable on a non-transitory computer readable storage medium, the computer program, when executed by a processor, being capable of executing the method of transmitting computer software data provided by the methods described above.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform a method of transmitting computer software data provided by the above methods.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
It should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention, and not for limiting the same, and although the present invention has been described in detail with reference to the above-mentioned embodiments, it should be understood by those skilled in the art that the technical solution described in the above-mentioned embodiments may be modified or some technical features may be equivalently replaced, and these modifications or substitutions do not make the essence of the corresponding technical solution deviate from the spirit and scope of the technical solution of the embodiments of the present invention.
Claims (10)
1. A method for transmitting computer software data, comprising:
applying for a memory space, and establishing a data queue in the memory space, wherein the data queue comprises a plurality of data blocks, and each data block comprises an identifier, an effective length and a data area;
Initializing the data queue to determine the size and total number of the data blocks in the data queue, and setting the identification and the data area of each data block of the data queue to be in an empty state;
Starting a data transmitting end and a data receiving end of the computer software data;
The control data transmitting end detects a target data block marked as an empty state according to the sequence of the data blocks in the data queue, writes the computer software data to be transmitted into a data area of the target data block, records the actual length of the written data in the effective length, and sets the mark of the target data block as a non-empty state;
And the control data receiving end detects the target data block marked as the non-empty state according to the sequence of the data blocks in the data queue, acquires data in the data area based on the effective length of the target data block marked as the non-empty state, and sets the mark of the target data block after acquiring the data as the empty state.
2. The method according to claim 1, wherein when the number of the data queues is plural, the size of the data block of each of the data queues is different;
after initializing the data queue, the method further comprises:
Comparing the data length of the computer software data to be transmitted with the data length of the data blocks in each data queue to obtain a comparison result;
Screening target queues with the data length of the data blocks being greater than or equal to the data length of the computer software data to be transmitted from the data queues based on the comparison result;
Screening one of the target queues as a final queue;
The control data transmitting end detects the target data block marked as empty according to the sequence of the data blocks in the data queue, and the control data transmitting end comprises the following steps:
and the control data transmitting end detects the target data block marked as an empty state according to the sequence of the data blocks in the final queue.
3. The method for transmitting computer software data according to claim 2, wherein said selecting one of said target queues as a final queue comprises:
and screening one with the smallest data length of the data block from each target queue to be used as a final queue.
4. The method for transmitting computer software data according to claim 2, wherein when the number of the data queues is plural and the number of the data receiving terminals is plural and is smaller than the number of the data queues, the controlling the data receiving terminal detects the target data block identified as the non-empty state according to the order of the data blocks in the data queues, comprising:
grouping the data queues based on the transmission data quantity of the data queues to obtain a plurality of queue groups, wherein the number of the queue groups is the same as that of the data receiving ends;
determining the corresponding relation between each queue group and each data receiving end;
And controlling each data receiving end to sequentially detect the target data blocks marked as non-empty states according to the sequence of the data blocks for the data queues in the corresponding queue groups.
5. The method of transmitting computer software data according to claim 4, wherein the greater the number of data queues included in the queue group, the smaller the amount of data transmitted by a single data queue in the queue group;
the fewer the number of data queues contained in the queue set, the greater the amount of data transferred by a single data queue in the queue set.
6. The method for transmitting computer software data according to claim 2, wherein when the number of the data queues is plural and the number of the data receiving terminals is one, the control data receiving terminal detects the target data block identified as the non-empty state according to the order of the data blocks in the data queues, comprising:
and controlling the data receiving end to sequentially detect the target data blocks marked as non-empty states for each data queue according to the sequence of the data blocks.
7. The method for transmitting computer software data according to claim 2, wherein when the number of the data queues is plural and the number of the data receiving terminals is plural, and the control data receiving terminals are in one-to-one correspondence with the data queues, the control data receiving terminals detect the target data blocks identified as non-empty states according to the sequence of the data blocks in the data queues, including:
And controlling each data receiving end to detect the target data block marked as a non-empty state according to the sequence of the data blocks for the corresponding data queues.
8. The method for transmitting computer software data according to claim 1, wherein the applying for the memory space and establishing a data queue in the memory space further comprise:
establishing connection between a first data block and a last data block in the data queue;
After the identification of the target data block is set to a non-null state, the method further comprises:
controlling the data sending end to point to the next data block;
if the next pointed data block is the last data block, controlling the data transmitting end to point to the first data block;
after the identification of the target data block after the data acquisition is set to be in the null state, the method further comprises the following steps:
controlling the data receiving end to point to the next data block;
And if the next pointed data block is the last data block, controlling the data receiving end to point to the first data block.
9. A transmission device for computer software data, comprising:
The system comprises a queue creation module, a data storage module and a data storage module, wherein the queue creation module is used for applying for a memory space and creating a data queue in the memory space, the data queue comprises a plurality of data blocks, and each data block comprises an identifier, an effective length and a data area;
the initialization module is used for initializing the data queue to determine the size and the total number of the data blocks in the data queue and setting the identification of each data block in the data queue to be in an empty state;
the starting module is used for starting a data transmitting end and a data receiving end of the computer software data;
The sending module is used for controlling a data sending end to detect a target data block marked as an empty state according to the sequence of the data blocks in the data queue, writing computer software data to be transmitted into a data area of the target data block, recording the actual length of the written data in the effective length, and setting the mark of the target data block as a non-empty state;
The receiving module is used for controlling the data receiving end to detect the target data block marked as the non-empty state according to the sequence of the data blocks in the data queue, acquiring data in the data area based on the effective length of the target data block marked as the non-empty state, and setting the mark of the target data block after acquiring the data as the empty state.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements a method of transmitting computer software data according to any of the preceding claims 1 to 8 when executing the program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411658768.8A CN119166392B (en) | 2024-11-20 | 2024-11-20 | Method, device and equipment for transmitting computer software data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411658768.8A CN119166392B (en) | 2024-11-20 | 2024-11-20 | Method, device and equipment for transmitting computer software data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN119166392A true CN119166392A (en) | 2024-12-20 |
CN119166392B CN119166392B (en) | 2025-03-07 |
Family
ID=93882270
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202411658768.8A Active CN119166392B (en) | 2024-11-20 | 2024-11-20 | Method, device and equipment for transmitting computer software data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN119166392B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4956771A (en) * | 1988-05-24 | 1990-09-11 | Prime Computer, Inc. | Method for inter-processor data transfer |
WO2021139438A1 (en) * | 2020-01-07 | 2021-07-15 | 平安科技(深圳)有限公司 | Big data resource processing method and apparatus, and terminal and storage medium |
CN116225742A (en) * | 2023-03-09 | 2023-06-06 | 山东云海国创云计算装备产业创新中心有限公司 | Message distribution method, device and storage medium |
CN118606069A (en) * | 2024-05-24 | 2024-09-06 | 东方证券股份有限公司 | Inter-process communication method based on shared memory |
CN118838858A (en) * | 2024-07-15 | 2024-10-25 | 山东云海国创云计算装备产业创新中心有限公司 | Data processing system, data processing method, computer device, and storage medium |
-
2024
- 2024-11-20 CN CN202411658768.8A patent/CN119166392B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4956771A (en) * | 1988-05-24 | 1990-09-11 | Prime Computer, Inc. | Method for inter-processor data transfer |
WO2021139438A1 (en) * | 2020-01-07 | 2021-07-15 | 平安科技(深圳)有限公司 | Big data resource processing method and apparatus, and terminal and storage medium |
CN116225742A (en) * | 2023-03-09 | 2023-06-06 | 山东云海国创云计算装备产业创新中心有限公司 | Message distribution method, device and storage medium |
CN118606069A (en) * | 2024-05-24 | 2024-09-06 | 东方证券股份有限公司 | Inter-process communication method based on shared memory |
CN118838858A (en) * | 2024-07-15 | 2024-10-25 | 山东云海国创云计算装备产业创新中心有限公司 | Data processing system, data processing method, computer device, and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN119166392B (en) | 2025-03-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110750341B (en) | Task scheduling method, device, system, terminal equipment and storage medium | |
CN113138802B (en) | Command distribution device, method, chip, computer device and storage medium | |
CN105141603B (en) | Communication data transmission method and system | |
CN113660351B (en) | Data communication method, device, communication terminal and computer readable storage medium | |
US7584307B2 (en) | Direct memory access DMA with positional information and delay time | |
CN117539807A (en) | Data transmission method, related equipment and storage medium | |
CN108304272B (en) | Data IO request processing method and device | |
CN110798269A (en) | Method and system for realizing PCM slave function based on GPIO | |
CN117389766A (en) | Message sending method and device, storage medium and electronic device | |
CN117909031A (en) | Message processing method, computer equipment and medium for data processing unit | |
CN109951532B (en) | DPDK-based automatic flow model conversion device | |
CN112040001A (en) | Request processing method and device based on distributed storage | |
CN119166392B (en) | Method, device and equipment for transmitting computer software data | |
CN115934625A (en) | Doorbell knocking method, device and medium for remote direct memory access | |
CN110995817A (en) | Request callback method and device and client equipment | |
CN113271336B (en) | DPDK-based robot middleware DDS data transmission method, electronic device and computer-readable storage medium | |
CN117076353B (en) | Descriptor configuration method and descriptor configuration device | |
US8473579B2 (en) | Data reception management apparatus, systems, and methods | |
CN113157465A (en) | Message sending method and device based on pointer linked list | |
KR20170117326A (en) | Direct memory access control device for at least one processing unit having a random access memory | |
EP4425334A1 (en) | Storage control method, storage controller, storage chip, network card, and readable medium | |
CN111638979A (en) | Call request processing method and device, electronic equipment and readable storage medium | |
CN113343735B (en) | Tag processing method of reader-writer, reader-writer and storage medium | |
CN115878550A (en) | A data processing method, chip, device and system | |
CN114979153B (en) | Load balancing method, computer equipment and storage device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |