Data output method and device, storage medium and electronic device

By dynamically allocating and releasing cache space in the traditional multi-output port control management solution, ensuring that there is an independent cache space in each output direction, solving the problem of low data output efficiency and achieving more efficient data output.

CN118363886BActive Publication Date: 2024-11-15SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410789929.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2024-11-15
Estimated Expiration
2044-06-19

AI Technical Summary

Technical Problem

In the traditional multi-output port control management solution, the data cache has the first-in, first-out feature, which causes the output direction to be blocked, and the data of other output channels to be blocked, resulting in low data output efficiency.

Method used

By determining its output direction when receiving data and dividing the common cache space into multiple cache space queues, the cache space is dynamically allocated and freed, ensuring that each output direction has an independent cache space and avoiding mutual constraints between channels.

Benefits of technology

It improves data output efficiency, eliminates the mutual constraints between output channels, and realizes the maximum utilization of cache resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118363886B_ABST
    Figure CN118363886B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a data output method and device, a storage medium and an electronic device, which relate to the field of computers. The method includes: when first data is received, determining a first output direction of the first data, and determining whether there is valid cache space in a first cache space queue corresponding to the first output direction, wherein the data in the cache space corresponding to the first cache space queue is output through the first output direction; when it is determined that there is no valid cache space, applying for a first cache space according to a public cache space queue, and writing the first data to the first cache space; writing a first cache space identifier corresponding to the first cache space into the first cache space queue, and determining the first cache space as a valid cache space in the first cache space queue, so that the first data is output in the first output direction through the first cache space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computers, and more specifically, to a data output method and device, a storage medium, and an electronic device. Background Art

[0002] In the traditional multi-output port control management scheme, a common data cache is used in the system. Since the data cache has the first-in-first-out characteristic, the data that first enters the cache will be output from its corresponding output direction first. If the output direction is blocked due to high business pressure, that is, the data that first enters the cache cannot be output from the corresponding output port, which will cause the data of other output channels that enter the cache to be blocked, resulting in mutual constraints between different output channels, which will seriously affect the execution efficiency of the system. For example: data 0 and 1 corresponding to output direction 0 enter the system and are written into the cache. At this time, data 0 corresponding to output direction 0 can be output. Subsequently, data 0, 1, and 2 of output direction 1 enter the system and are written into the cache. At this time, due to the high business pressure of output direction 0, data 1 corresponding to output direction 0 is blocked, which will cause data 0, 1, and 2 of output direction 1 that are arranged behind to be blocked. After that, data 0 and 1 of output direction 2 and data 0 and 1 of output direction 3 that enter the system are written into the cache, and will also be affected by the blocking of output channels 0 and 1.

[0003] Therefore, in the related art, data is input and output serially, and all output directions are output through one cache space, resulting in low data output efficiency, which has not yet been effectively solved. Summary of the invention

[0004] The embodiments of the present application provide a data output method and device, a storage medium and an electronic device to at least solve the problem in the related art that data is serially input and serially output, and all output directions are output through one cache space, resulting in low data output efficiency.

[0005] According to an embodiment of the present application, a data output method is provided, the method comprising: upon receiving first data, determining a first output direction of the first data, and determining whether there is valid cache space in a first cache space queue corresponding to the first output direction, wherein data in the cache space corresponding to the first cache space queue is output through the first output direction; upon determining that there is no valid cache space, applying for a first cache space according to a public cache space queue, and writing the first data to the first cache space; writing a first cache space identifier corresponding to the first cache space into the first cache space queue, and determining the first cache space as a valid cache space in the first cache space queue, so that the first data is output in the first output direction through the first cache space.

[0006] In an exemplary embodiment, before determining the first output direction of the first data, the method also includes: when it is determined that the target system is in an initialization state, dividing the public cache space in the target system into multiple cache spaces, and determining a cache space identifier corresponding to each divided cache space, wherein the target system is used to receive the first data; writing the cache space identifier corresponding to each divided cache space into the public cache space queue, wherein the multiple cache spaces include: the first cache space; when it is determined that the initialization of the target system is completed, detecting whether the first data is received.

[0007] In an exemplary embodiment, determining whether there is valid cache space in the first cache space queue corresponding to the first output direction includes: determining whether the identifier of the valid flag corresponding to the first cache space queue is a target identifier; if it is determined that the identifier is the target identifier, determining that there is no valid cache space in the first cache space queue; if it is determined that the identifier is not the target identifier, determining that there is valid cache space in the first cache space queue.

[0008] In an exemplary embodiment, before determining whether the identifier of the valid flag corresponding to the first cache space queue is a target identifier, the method further includes: when it is determined that there is no cache space identifier corresponding to the cache space in the first cache space queue, adjusting the identifier of the valid flag to the target identifier; or, when it is determined that there is a second cache space identifier corresponding to the second cache space in the first cache space queue, and the space status corresponding to the second cache space is a full space status, adjusting the identifier of the valid flag to the target identifier.

[0009] In an exemplary embodiment, after determining the first cache space as a valid cache space in the first cache space queue, the method also includes: when receiving second data, determining a second output direction of the second data, and determining whether the second output direction is consistent with the first output direction; when determining that the second output direction is consistent with the first output direction, determining whether there is valid cache space in the first cache space queue, and writing the second data to the cache space corresponding to the first cache space queue based on whether there is valid cache space in the first cache space queue; when determining that the second output direction is inconsistent with the first output direction, determining whether there is valid cache space in the second cache space queue corresponding to the second output direction, and writing the second data to the cache space corresponding to the second cache space queue based on whether there is valid cache space in the second cache space queue.

[0010] In an exemplary embodiment, the second data is written to the cache space corresponding to the first cache space queue according to whether there is valid cache space in the first cache space queue, including: when it is determined that there is valid cache space in the first cache space queue, the second data is written to the first cache space so that the second data is output in the first output direction through the first cache space.

[0011] In an exemplary embodiment, the second data is written to the first cache space queue based on whether there is valid cache space in the first cache space queue, including: when it is determined that there is no valid cache space in the first cache space queue, applying for a third cache space in the public cache space, and writing the second data to the third cache space; writing a third cache space identifier corresponding to the third cache space into the first cache space queue, and determining the third cache space as a valid cache space in the first cache space queue, so that the second data is output in the first output direction through the third cache space.

[0012] In an exemplary embodiment, after determining the first cache space as a valid cache space in the first cache space queue, the method further includes: obtaining a cache release vector, wherein each bit of the cache release vector is used to indicate whether there is cache space to be released to the public cache space queue in the cache space queue corresponding to each output direction in the target system; determining whether the bit value corresponding to each bit is a target bit value; and when it is determined that the bit value corresponding to any bit is the target bit value, releasing the cache space to be released to the public cache space queue corresponding to the output direction corresponding to any bit into the public cache space queue.

[0013] In an exemplary embodiment, the cache space to be released to the public cache space queue corresponding to the output direction corresponding to any bit is released to the public cache space queue, including: determining the bit number of the target bit, wherein the target bit is a bit whose bit value is the target bit value; when it is determined that the bit number is the target value, determining the third output direction corresponding to the target bit; determining the first cache space number of the cache space to be released to the public cache space queue corresponding to the third output direction; when it is determined that the first cache space number is the target value, releasing the cache space to be released to the public cache space queue corresponding to the third output direction to the public cache space queue.

[0014] In an exemplary embodiment, after determining the first cache space number of cache spaces to be released to the public cache space queue corresponding to the third output direction, the method further includes: when it is determined that the first cache space number is not the target value, releasing the first cache space of the multiple cache spaces to be released to the public cache space queue corresponding to the third output direction to the public cache space queue, and writing the fourth cache space identifiers corresponding to the other cache spaces of the multiple cache spaces to be released to the public cache space queue corresponding to the third output direction into the first released cache space queue corresponding to the third output direction in sequence, wherein the fourth cache space identifier in the first released cache space queue is used to indicate the cache space to be released to the public cache space queue corresponding to the third output direction; when it is determined that the first cache space has been successfully released to the public cache space queue, releasing the other cache spaces to the public cache space queue in sequence according to the writing order of the fourth cache space identifier.

[0015] In an exemplary embodiment, after determining the bit number of the target bit positions, the method further includes: determining the bit order of multiple target bits in the cache release vector when it is determined that the bit number of the target bit positions is not the target value; determining the first target bit among the multiple target bits according to the bit order, and determining the fourth output direction corresponding to the first target bit; determining whether the second cache space quantity of the fourth cache space corresponding to the fourth output direction is the target value; and releasing the fourth cache space to the public cache space queue according to whether the second cache space quantity is the target value.

[0016] In an exemplary embodiment, after determining the bit order of multiple target bits in the cache release vector, the method also includes: determining other target bits among the multiple target bits according to the bit order, wherein the other target bits are bits among the multiple target bits except the first target bit; determining the fifth output direction corresponding to the other target bits; writing the fifth cache space identifier corresponding to the fifth cache space corresponding to the fifth output direction into the second released cache space queue corresponding to the fifth output direction, wherein the fifth cache space identifier in the second released cache space queue is used to indicate the cache space corresponding to the fifth output direction to be released to the public cache space queue; when it is determined that the fourth cache space has been successfully released to the public cache space queue, releasing the fifth cache space corresponding to the fifth cache space identifier in the second released cache space queue to the public cache space queue.

[0017] In an exemplary embodiment, after determining the first cache space as the valid cache space in the first cache space queue, the method also includes: when receiving multiple third data, determining the output direction of each third data, and determining whether there is valid cache space in the cache space queue corresponding to the output direction of each third data; when it is determined that there is valid cache space in the third cache space queue and there is no valid cache space in the fourth cache space queue, writing the third data with an output direction of a sixth output direction into the third cache space queue, and writing the third data with an output direction of a seventh output direction into the fourth cache space queue, wherein the cache space queues corresponding to the output direction of each third data include: the third cache space queue and the fourth cache space queue, the sixth output direction is the output direction corresponding to each fourth cache space queue, and the seventh output direction is the output direction corresponding to each fourth cache space queue.

[0018] In an exemplary embodiment, writing the third data whose output direction is the sixth output direction into the third cache space queue includes: writing the third data whose output direction is the sixth output direction into the valid cache space in the fourth cache space queue, so that the third data whose output direction is the sixth output direction is output in the sixth output direction through the valid cache space in the fourth cache space queue.

[0019] In an exemplary embodiment, writing the third data with an output direction of the seventh output direction into the fourth cache space queue includes: applying for a sixth cache space in the public cache space queue, and writing the third data with an output direction of the seventh output direction into the sixth cache space; writing a sixth cache space identifier corresponding to the sixth cache space into the fourth cache space queue, and determining the sixth cache space as a valid cache space in the fourth cache space queue, so that the third data with an output direction of the seventh output direction is output in the seventh output direction through the sixth cache space.

[0020] In an exemplary embodiment, after determining the first cache space as the valid cache space in the first cache space queue, the method also includes: when receiving multiple fourth data and the output direction of each fourth data is the eighth output direction, determining whether there is valid cache space in the fifth cache space queue corresponding to the eighth output direction; when determining that there is valid cache space in the fifth cache space queue, determining the remaining cache space of the valid cache space in the fifth cache space queue, and determining the size relationship between the remaining cache space and the total data space of the multiple fourth data; writing the multiple fourth data into the eighth output direction according to the size relationship, so that each fourth data is output in the eighth output direction.

[0021] In an exemplary embodiment, the multiple fourth data are written to the eighth output direction according to the size relationship, including: when the size relationship indicates that the remaining cache space is greater than or equal to the total data space, each of the fourth data is written to the valid cache space in the fifth cache space queue, so that each of the fourth data is output in the eighth output direction through the valid cache space in the fifth cache space queue.

[0022] In an exemplary embodiment, the multiple fourth data are written to the eighth output direction according to the size relationship, including: when the size relationship indicates that the remaining cache space is smaller than the total data space, applying for a seventh cache space in the public cache space queue; writing a target number of fourth data into the valid cache space in the fifth cache space queue, and writing other fourth data into the seventh cache space, wherein the other fourth data are fourth data in the multiple fourth data except the target number of fourth data; writing a seventh cache space identifier corresponding to the seventh cache space into the fifth cache space queue; when it is determined that the target number of fourth data has been successfully output in the eighth output direction, determining the seventh cache space as the valid cache space in the fifth cache space queue, so that the other fourth data are output in the eighth output direction through the valid cache space in the fifth cache space queue.

[0023] According to another embodiment of the present application, a data output device is provided, including: a determination module, for determining a first output direction of the first data when first data is received, and determining whether there is valid cache space in a first cache space queue corresponding to the first output direction, wherein data in the cache space corresponding to the first cache space queue is output through the first output direction; an application module, for applying for a first cache space according to a public cache space queue when it is determined that there is no valid cache space, and writing the first data to the first cache space; a writing module, for writing a first cache space identifier corresponding to the first cache space into the first cache space queue, and determining the first cache space as a valid cache space in the first cache space queue, so that the first data is output in the first output direction through the first cache space.

[0024] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.

[0025] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in the above method embodiment.

[0026] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiment are implemented.

[0027] The data output method of the present application includes: when receiving the first data, determining the first output direction of the first data, and determining whether there is a valid cache space in the first cache space queue corresponding to the first output direction, and the data in the cache space corresponding to the first cache space queue is output through the first output direction. When it is determined that there is no valid cache space in the first cache space queue, apply for the first cache space according to the public cache space queue, and write the first data into the first cache space, write the first cache space identifier corresponding to the first cache space into the first cache space queue, and determine the first cache space as the valid cache space in the first cache space queue, so that the first data is output in the first output direction through the first cache space. In an embodiment of the present application, when there is no valid cache space in the first output direction, it is necessary to apply for the first cache space from the public cache space queue, and use the first cache space as the valid data cache in the first output direction, so that the first data can be output in the first output direction through the first cache space. That is to say, the embodiment of the present application defines the public cache space queue, and the output direction of each data cache in the public cache space queue is consistent, and then each output direction has a cache space corresponding to each output direction, so that the data of each output direction can be output in each output direction through the cache space corresponding to each output direction. Through the embodiments of the present application, the problem of low data output efficiency caused by serial input and serial output of data in the related art and all output directions being output through one cache space is solved, thereby improving the data output efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a hardware structure block diagram of a computer terminal of a data output method according to an embodiment of the present application;

[0029] Figure 2 is a flow chart of a data output method according to an embodiment of the present application;

[0030] Figure 3 It is a schematic diagram of a multi-output port control management solution in the related art;

[0031] Figure 4 This is a schematic diagram of a hardware implementation scheme for multiple output ports based on a cache dynamic allocation method according to an optional embodiment of the present application (I);

[0032] Figure 5 It is a system architecture diagram of a method for realizing hardware of controlling multiple output ports based on a cache dynamic allocation method according to an optional embodiment of the present application;

[0033] Figure 6 This is a schematic diagram (II) of a hardware implementation scheme for multiple output ports based on a cache dynamic allocation method according to an optional embodiment of the present application;

[0034] Figure 7 This is a schematic diagram of a hardware implementation scheme for multiple output ports based on a cache dynamic allocation method according to an optional embodiment of the present application (III);

[0035] Figure 8 Schematic diagram (IV) of a hardware implementation scheme for multiple output ports based on a cache dynamic allocation method according to an optional embodiment of the present application;

[0036] Fig. 9 Schematic diagram (V) of a hardware implementation scheme for multiple output ports based on a cache dynamic allocation method according to an optional embodiment of the present application;

[0037] Fig.10 Schematic diagram (VI) of a hardware implementation scheme for multiple output ports based on a dynamic cache allocation method according to an optional embodiment of the present application;

[0038] Fig.11 It is a structural block diagram of a data output device according to an embodiment of the present application. DETAILED DESCRIPTION

[0039] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0041] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 1 is a hardware structure block diagram of a computer terminal of a data output method according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned computer terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0042] 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 data output method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a 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 remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0043] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0044] The present application provides a method for outputting data. Figure 2 is a flow chart of a data output method according to an embodiment of the present application, which is applied to Figure 1 Computer terminals in Figure 2 As shown, the process includes the following steps:

[0045] Step S202, when first data is received, determining a first output direction of the first data, and determining whether there is valid cache space in a first cache space queue corresponding to the first output direction, wherein data in the cache space corresponding to the first cache space queue is output via the first output direction;

[0046] Among them, each data needs to be output from one output direction, and the embodiment of the present application splits the cache space corresponding to each output direction. When it is determined that there is valid cache space in the first cache space queue corresponding to the first output direction, the first data can be written into the valid cache space in the first cache space, so that the first data is output from the first output direction through the valid cache space in the first cache space.

[0047] Step S204, when it is determined that there is no valid cache space, applying for a first cache space according to the public cache space queue, and writing the first data into the first cache space;

[0048] Step S206: write the first cache space identifier corresponding to the first cache space into the first cache space queue, and determine the first cache space as a valid cache space in the first cache space queue, so that the first data is output in the first output direction through the first cache space.

[0049] When the first cache space identifier corresponding to the first cache space is written into the first cache space queue, it can be determined that there is a binding relationship between the first cache space and the first cache space queue, and the data in the first cache space is output from the first output direction corresponding to the first cache space queue by default. That is, when it is determined that the first data needs to be output from the first output direction, the first data can be written into the first cache space.

[0050] The data output method of the present application includes: when receiving the first data, determining the first output direction of the first data, and determining whether there is a valid cache space in the first cache space queue corresponding to the first output direction, and the data in the cache space corresponding to the first cache space queue is output through the first output direction. When it is determined that there is no valid cache space in the first cache space queue, apply for the first cache space according to the public cache space queue, and write the first data into the first cache space, write the first cache space identifier corresponding to the first cache space into the first cache space queue, and determine the first cache space as the valid cache space in the first cache space queue, so that the first data is output in the first output direction through the first cache space. In an embodiment of the present application, when there is no valid cache space in the first output direction, it is necessary to apply for the first cache space from the public cache space queue, and use the first cache space as the valid data cache in the first output direction, so that the first data can be output in the first output direction through the first cache space. That is to say, the embodiment of the present application defines the public cache space queue, and the output direction of each data cache in the public cache space queue is consistent, and then each output direction has a cache space corresponding to each output direction, so that the data of each output direction can be output in each output direction through the cache space corresponding to each output direction. Through the embodiments of the present application, the problem of low data output efficiency caused by serial input and serial output of data in the related art and all output directions being output through one cache space is solved, thereby improving the data output efficiency.

[0051] Optionally, before determining the first output direction of the first data in the above step S202, the method also includes: when it is determined that the target system is in an initialization state, dividing the public cache space in the target system into multiple cache spaces, and determining the cache space identifier corresponding to each divided cache space, wherein the target system is used to receive the first data; writing the cache space identifier corresponding to each divided cache space into the public cache space queue, wherein the multiple cache spaces include: the first cache space; when it is determined that the initialization of the target system is completed, detecting whether the first data is received.

[0052] It is understandable that the embodiment of the present application splits a public cache space in the related art into multiple cache spaces. The cache space identifiers corresponding to the multiple cache spaces after the division are written into the public cache space. When it is determined that there is no valid cache space in the cache space queue corresponding to any output direction, the cache space in the public cache space can be applied.

[0053] Through the above technical solution, a public cache space in the prior art is divided into multiple cache spaces, and they are reasonably allocated on demand according to different business pressures of output ports, thereby maximizing the utilization of the cache space.

[0054] Optionally, the above-mentioned step S202 of determining whether there is valid cache space in the first cache space queue corresponding to the first output direction includes: determining whether the identifier of the valid flag corresponding to the first cache space queue is the target identifier; if it is determined that the identifier is the target identifier, determining that there is no valid cache space in the first cache space queue; if it is determined that the identifier is not the target identifier, determining that there is valid cache space in the first cache space queue.

[0055] Among them, before determining whether the identifier of the valid flag bit corresponding to the first cache space queue is the target identifier, the method also includes: when it is determined that there is no cache space identifier corresponding to the cache space in the first cache space queue, adjusting the identifier of the valid flag bit to the target identifier; or, when it is determined that there is a second cache space identifier corresponding to the second cache space in the first cache space queue, and the space state corresponding to the second cache space is a full space state, adjusting the identifier of the valid flag bit to the target identifier.

[0056] It is understandable that each cache space queue has a valid flag bit, and whether there is valid data cache in each cache space queue can be determined by the identifier on the valid flag bit. The above identifier can be: 0 or 1, and the above target identifier can be 0.

[0057] The situation where there is no valid data cache in the cache space queue includes: there is no cache space identifier in the cache space queue, or the space state of the cache space corresponding to the cache space identifier existing in the cache space queue is a full space state.

[0058] For example: when it is determined that there is a cache space identifier 1 corresponding to cache space 1 in cache space queue 1, and the space state of cache space 1 is a full space state, it can be determined that there is no valid cache space in cache space queue 1, and the identifier of the valid flag bit of the valid identifier corresponding to cache space queue 1 is set to 0.

[0059] When it is determined that there is no cache space identification state in cache space queue 2, it can be determined that there is no valid cache space in cache space queue 1, and the identifier of the valid identification valid flag bit corresponding to cache space queue 1 is set to 0.

[0060] When it is determined that there is a cache space identifier 3 corresponding to cache space 3 in cache space queue 3, and the space state of cache space 3 is not a full space state, it can be determined that there is valid cache space in cache space queue 3, and the identifier of the valid flag bit of the valid identifier corresponding to cache space queue 3 is set to 1.

[0061] Optionally, after executing the above step S206 to determine the first cache space as a valid cache space in the first cache space queue, the method further includes:

[0062] (1) When receiving second data, determine a second output direction of the second data, and determine whether the second output direction is consistent with the first output direction; when it is determined that the second output direction is consistent with the first output direction, determine whether there is valid cache space in the first cache space queue, and write the second data to the cache space corresponding to the first cache space queue according to whether there is valid cache space in the first cache space queue; when it is determined that the second output direction is inconsistent with the first output direction, determine whether there is valid cache space in the second cache space queue corresponding to the second output direction, and write the second data to the cache space corresponding to the second cache space queue according to whether there is valid cache space in the second cache space queue.

[0063] Among them, writing the second data into the cache space corresponding to the first cache space queue according to whether there is valid cache space in the first cache space queue includes: when it is determined that there is valid cache space in the first cache space queue, writing the second data into the first cache space so that the second data is output in the first output direction through the first cache space.

[0064] Among them, writing the second data into the first cache space queue according to whether there is valid cache space in the first cache space queue includes: when it is determined that there is no valid cache space in the first cache space queue, applying for a third cache space in the public cache space, and writing the second data into the third cache space; writing the third cache space identifier corresponding to the third cache space into the first cache space queue, and determining the third cache space as a valid cache space in the first cache space queue, so that the second data is output in the first output direction through the third cache space.

[0065] It can be known from the above technical solution that after the first data is output through the first cache space, when the second data is received, the second output direction corresponding to the second data can be determined, and whether the second output direction is consistent with the first output direction can be determined.

[0066] (1) When the second output direction is consistent with the first output direction, it can be determined whether there is valid cache space in the first cache space queue corresponding to the first output direction.

[0067] 1) If the space status of the first cache space is full, it is determined that there is no valid cache space in the first cache space queue. At this time, it is necessary to apply for a third cache space from the public cache space queue and write the second data into the third cache space. At the same time, the third cache space identifier corresponding to the third cache space is written into the first cache space queue, and the third cache space is determined as a valid cache space in the second cache space queue. Then, the second data can be output from the first output direction through the third cache space.

[0068] 2) If the space status of the first cache space is not full, it is determined that there is valid cache space in the first cache space queue. At this time, the second data can be directly input into the first cache space so that the second data is output through the first cache space.

[0069] (2) When the second output direction is inconsistent with the first output direction, it can be determined whether there is valid cache space in the second cache space queue corresponding to the second output direction.

[0070] 1) If there is no cache space in the second cache space queue, or there is cache space in the second cache space queue and the space status of the cache space is full, it is determined that there is no valid cache space in the second cache space queue. At this time, it is necessary to apply for a cache space from the public cache space queue and write the second data into this cache space. At the same time, the cache space identifier corresponding to this cache space is written into the second cache space queue, and this cache space is determined as a valid cache space in the second cache space queue. Then, the second data can be output from the first output direction through this cache space.

[0071] 2) If there is cache space in the second cache space queue and the space status of the cache space is not full, it is determined that there is valid cache space in the second cache space queue. At this time, the second data can be directly input into this cache space so that the second data is output through this cache space.

[0072] (2) Obtaining a cache release vector, wherein each bit of the cache release vector is used to indicate whether there is cache space to be released to the public cache space queue in the cache space queue corresponding to each output direction in the target system; determining whether the bit value corresponding to each bit is a target bit value; and when it is determined that the bit value corresponding to any bit is the target bit value, releasing the cache space to be released to the public cache space queue corresponding to the output direction corresponding to any bit into the public cache space queue.

[0073] Among them, releasing the cache space to be released to the public cache space queue corresponding to the output direction corresponding to any bit position into the public cache space queue includes: determining the bit number of the target bit position, wherein the target bit position is a bit position whose bit value is the target bit value; when it is determined that the bit number is the target value, determining the third output direction corresponding to the target bit position; determining the first cache space number of the cache space to be released to the public cache space queue corresponding to the third output direction; when it is determined that the first cache space number is the target value, releasing the cache space to be released to the public cache space queue corresponding to the third output direction into the public cache space queue.

[0074] Among them, after determining the first cache space number of cache spaces to be released to the public cache space queue corresponding to the third output direction, the method also includes: when it is determined that the first cache space number is not the target value, releasing the first cache space among the multiple cache spaces to be released to the public cache space queue corresponding to the third output direction to the public cache space queue, and writing the fourth cache space identifiers corresponding to the other cache spaces among the multiple cache spaces to be released to the public cache space queue corresponding to the third output direction into the first released cache space queue corresponding to the third output direction in sequence, wherein the fourth cache space identifier in the first released cache space queue is used to indicate the cache space to be released to the public cache space queue corresponding to the third output direction; when it is determined that the first cache space has been successfully released to the public cache space queue, releasing the other cache spaces to the public cache space queue in sequence according to the writing order of the fourth cache space identifier.

[0075] Among them, after determining the bit number of the target bit position, the method also includes: when it is determined that the bit number of the target bit position is not the target value, determining the bit order of multiple target bits in the cache release vector; determining the first target bit position among the multiple target bits according to the bit order, and determining the fourth output direction corresponding to the first target bit position; determining whether the second cache space quantity of the fourth cache space corresponding to the fourth output direction is the target value; and releasing the fourth cache space to the public cache space queue according to whether the second cache space quantity is the target value.

[0076] Among them, after determining the bit order of multiple target bits in the cache release vector, the method also includes: determining other target bits among the multiple target bits according to the bit order, wherein the other target bits are bits among the multiple target bits except the first target bit; determining the fifth output direction corresponding to the other target bits; writing the fifth cache space identifier corresponding to the fifth cache space corresponding to the fifth output direction into the second released cache space queue corresponding to the fifth output direction, wherein the fifth cache space identifier in the second released cache space queue is used to indicate the cache space corresponding to the fifth output direction to be released to the public cache space queue; when it is determined that the fourth cache space has been successfully released to the public cache space queue, the fifth cache space corresponding to the fifth cache space identifier in the second released cache space queue is released to the public cache space queue.

[0077] It can be understood that, when the first data is output from the first output direction through the first cache space, it is also necessary to obtain a cache release vector.

[0078] There are multiple bits in the cache release vector, and each bit is used to indicate whether there is cache space that needs to be released in an output direction. For example, if there are output directions 0, 1, 2, and 3 in the target system, the cache release vector contains bit 0 corresponding to output direction 0, bit 1 corresponding to output direction 1, bit 2 corresponding to output direction 2, and bit 3 corresponding to output direction 3.

[0079] The bit value corresponding to each bit position can be used to determine whether there is cache space to be released to the public cache space queue in each output direction. The target bit value can be 1. For example, if the cache release vector is 0011, it can be determined that there is cache space to be released to the public cache space queue in output directions 2 and 3.

[0080] It can be understood that if 3 data can be written into cache space 1, both cache space 1 and cache space 2 have entered cache space queue 1, and 3 data have been written into cache space 1, and one data has been written into cache space 2, then after the 3 data in cache space 1 are output, it can be determined that cache space 1 needs to be released to the public cache space queue.

[0081] Among them, when it is determined that both cache space 1 and cache space 2 need to be released, cache space 1 can be directly released to the public cache space according to the order of cache space 1 and cache space 2, and the cache space identifier corresponding to cache space 2 needs to be written into the corresponding cache space release queue of cache space 2, and after waiting for cache space 1 to be released, cache space 2 is released to the public cache queue. In other words, the cache space identifier corresponding to cache space 1 does not need to be written into the cache space release queue, and can be directly released to the public cache space queue, which improves the efficiency of releasing cache space.

[0082] The buffer space released to the public buffer space queue can continue to be written into the buffer space queue corresponding to any output direction.

[0083] (4) When receiving multiple third data, determine the output direction of each third data, and determine whether there is valid cache space in the cache space queue corresponding to the output direction of each third data; when it is determined that there is valid cache space in the third cache space queue and there is no valid cache space in the fourth cache space queue, write the third data with an output direction of the sixth output direction into the third cache space queue, and write the third data with an output direction of the seventh output direction into the fourth cache space queue, wherein the cache space queues corresponding to the output direction of each third data include: the third cache space queue and the fourth cache space queue, the sixth output direction is the output direction corresponding to each fourth cache space queue, and the seventh output direction is the output direction corresponding to each fourth cache space queue.

[0084] Among them, writing the third data with the output direction being the sixth output direction into the third cache space queue includes: writing the third data with the output direction being the sixth output direction into the effective cache space in the fourth cache space queue, so that the third data with the output direction being the sixth output direction is output in the sixth output direction through the effective cache space in the fourth cache space queue.

[0085] Among them, writing the third data with the output direction being the seventh output direction into the fourth cache space queue includes: applying for the sixth cache space in the public cache space queue, and writing the third data with the output direction being the seventh output direction into the sixth cache space; writing the sixth cache space identifier corresponding to the sixth cache space into the fourth cache space queue, and determining the sixth cache space as the valid cache space in the fourth cache space queue, so that the third data with the output direction being the seventh output direction is output in the seventh output direction through the sixth cache space.

[0086] It is understandable that when multiple data are received, it is necessary to determine whether the output directions of the multiple data are the same. If the output directions of the multiple data are different, it is necessary to determine whether there is a valid data cache in the cache space queue corresponding to each output direction. Then, if there is a valid data cache, the data is directly written into the valid data cache; if there is no valid data cache, it is necessary to apply for cache space from the public cache space queue and write the data into the cache space so that the data is output from the output direction corresponding to the data through the cache space.

[0087] (5) When a plurality of fourth data are received and the output direction of each fourth data is the eighth output direction, determine whether there is effective cache space in the fifth cache space queue corresponding to the eighth output direction; when it is determined that there is effective cache space in the fifth cache space queue, determine the remaining cache space of the effective cache space in the fifth cache space queue, and determine the size relationship between the remaining cache space and the total data space of the plurality of fourth data; write the plurality of fourth data into the eighth output direction according to the size relationship, so that each fourth data is output in the eighth output direction.

[0088] Among them, writing the multiple fourth data into the eighth output direction according to the size relationship includes: when the size relationship indicates that the remaining cache space is greater than or equal to the total data space, writing each fourth data into the valid cache space in the fifth cache space queue, so that each fourth data is output in the eighth output direction through the valid cache space in the fifth cache space queue.

[0089] Among them, writing the multiple fourth data into the eighth output direction according to the size relationship includes: when the size relationship indicates that the remaining cache space is smaller than the total data space, applying for the seventh cache space in the public cache space queue; writing the target number of fourth data into the valid cache space in the fifth cache space queue, and writing other fourth data into the seventh cache space, wherein the other fourth data are the fourth data in the multiple fourth data except the target number of fourth data; writing the seventh cache space identifier corresponding to the seventh cache space into the fifth cache space queue; when it is determined that the target number of fourth data has been successfully output in the eighth output direction, determining the seventh cache space as the valid cache space in the fifth cache space queue, so that the other fourth data are output in the eighth output direction through the valid cache space in the fifth cache space queue.

[0090] It is understandable that when determining that multiple data are output from the same output direction, it is also necessary to determine whether there is valid cache space in the cache space queue corresponding to the output direction. If so, it is necessary to determine the relationship between the remaining cache space of the valid cache space and the total data space size of the multiple data. For example: the multiple data include: 4 data, and the remaining cache space is 3 data cache spaces, then the remaining cache space is smaller than the total data space. At this time, 3 of the 4 data can be written into the valid cache space, and a new cache space can be applied for in the public cache space, the 4th data can be written into the new cache space, and the cache space identifier corresponding to the new cache space can be written into this cache space queue. After the data in the valid cache space is output, the new cache space is determined as the valid cache space, and the 4th data is output.

[0091] In order to better understand the process of the above data output method, the implementation process of the above data output method is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.

[0092] At present, with the development of computer networks, the power-law distribution characteristics of node degrees exist in the topological structure of computer networks. The power-law distribution characteristics of node degrees have led to a huge change in the network topological model. More and more model constructions are based on the characteristics of priority connection and optimized growth in the power-law distribution law, allowing models that conform to the computer topological properties to automatically generate, grow and connect according to some simple evolutionary laws in the power-law distribution law. New nodes are constantly added through this law of priority connection and priority growth.

[0093] It is the above characteristics of network topology that make the development of network more and more complex and the performance more and more reliable, which also prompts the emergence of many network topology connection rules, that is, the construction of network topology formation mechanism. The topology of computer network refers to the abstract connection mode displayed by various network devices (such as routers, switches, etc.) including computers in the network to achieve network interconnection. The more important point in computer network topology is: the above connection relationship and its diagram. Through the topology diagram, we can clearly understand the line connection of each node in the entire network and the appearance structure of the entire network. The nodes mainly refer to various active devices connected in the network. Therefore, the topology of computer network is composed of nodes and links.

[0094] Figure 3 Schematic diagram of a multi-output port control management solution in the related art. Figure 3As shown in the figure: a public data cache is used in the system. Since the data cache has the first-in-first-out feature, the data that first enters the cache will be output from its corresponding output direction first. Data 0 and 1 corresponding to output direction 0 enter the system and are written into the cache. At this time, data 0 corresponding to output direction 0 can be output. Subsequently, data 0, 1, and 2 of output direction 1 enter the system and are written into the cache. At this time, due to the high business pressure of output direction 0, data 1 corresponding to output direction 0 is blocked, which will cause data 0, 1, and 2 of output direction 1 that are arranged behind to be blocked. After that, data 0 and 1 of output direction 2 and data 0 and 1 of output direction 3 that enter the system are written into the cache and will also be affected by the blocking of output channels 0 and 1.

[0095] In order to solve the problem in the related art that data is serially input and serially output, and all output directions are output through one cache space, resulting in low data output efficiency, an optional embodiment of the present application proposes a multi-output port hardware implementation method based on a dynamic cache allocation method. Specifically:

[0096] Optional embodiment (I):

[0097] Figure 4 is a schematic diagram of a hardware implementation scheme for multiple output ports based on a cache dynamic allocation method according to an optional embodiment of the present application (I), Figure 5 1 is a system architecture diagram of a method for implementing a multi-output port control hardware based on a cache dynamic allocation method according to an optional embodiment of the present application. Figure 4 As shown, the optional embodiment of the present application splits the public cache in the related art into several parts and sets the following Figure 5 The public free cache management queue, each output direction occupied cache queue, released cache queue, occupied cache number register and current cache valid flag shown in the figure realize the dynamic allocation and recovery of data caches in different output directions. Different output directions will be dynamically allocated to data caches unique to different output directions, realizing parallel output of different output directions, eliminating the phenomenon of mutual constraints between channels, allocating cache resources according to the business pressure of different output directions, and realizing the maximum utilization of hardware cache resources. At the same time, adding the cache release vector first 1 search mechanism can eliminate the input data interruption problem caused by cache release and recovery, and can also improve the operation efficiency of the system. For example, Figure 4As shown, data 0 and 1 of output direction 0 enter the system, and output direction 0 is allocated to data cache 0, and data 0 and 1 are written into data cache 0 in sequence. At this time, the data of data cache 0 can be output through output direction 0. Subsequently, data 0 of output direction 1 enters the system, and output direction 1 is allocated to data cache 1, and data 0 is written into data cache 1. At this time, since output direction 1 and output direction 0 are allocated to independent data caches, output direction 1 is no longer restricted by output direction 0, and data of data cache 1 can be directly output to output direction 1. After that, input directions 2 and 3 are also allocated to independent data caches 2 and 3 of input directions 2 and 3 respectively, and data can also be output independently; when data 2 of output direction 0 enters the system, since data cache 0 (occupied by output direction 0) is full, output direction 0 re-applies to a new data cache 4, and writes subsequent data into the cache in sequence. When the data caches occupied by each output direction are released (the data is read empty), all released data cache labels will be recycled to the public free cache management queue to be cached by subsequent data entering the system.

[0098] The above-mentioned multi-output port control hardware implementation method based on cache dynamic allocation method depends on Figure 5 The architecture diagram is implemented as Figure 5 As shown:

[0099] The system architecture diagram of the multi-output port control hardware implementation method based on the dynamic cache allocation method according to the optional embodiment of the present application includes: a data dynamic cache module, a public idle cache management module, an output direction occupied cache management module, a vector first 1 search module, and an output direction released cache management module. Specifically:

[0100] (1) Data dynamic cache module: The data dynamic cache module is mainly responsible for writing and reading n dynamically allocated data caches. According to the management and control results of the data caches in the system's m output directions (i.e., the output directions of the present application), the module dynamically allocates data cache space (i.e., the cache space of the present application) to the m output directions and writes the input data into the corresponding data caches. At the same time, according to the data cache occupancy queues in the m output directions, the module reads out the corresponding cache data and outputs it to the corresponding output direction.

[0101] (2) Public free cache management module (i.e., the public cache space queue of this application): The public free cache management module is mainly responsible for recording the free data cache labels (i.e., the cache space identifiers of this application) in the current system. When input data needs to apply for new data cache space, the public free cache management module will allocate available free data cache to the new input data according to its free data cache label queue. At the same time, the public free cache management module is also responsible for recycling the data cache released in the m output directions, that is, the public free cache management module is the free data cache pool in the system.

[0102] (3) Output direction occupied cache management module: There are m output direction occupied cache management modules (m output directions) in the system. The output direction occupied cache management module is mainly responsible for recording the data cache number occupied by the current output direction. The current occupied cache number register, the current cache valid flag and the occupied cache queue are set in the output direction occupied cache management module. When the data of the output direction is applied to a new data cache, the data cache number will be written into the occupied cache queue, and the current occupied cache number register will be updated to the newly applied data cache number. The current cache valid flag (that is, the identifier of the valid flag bit of this application) will be set to 1. When the data of the output direction arrives again, it will continue to be written into the data cache recorded by the current occupied cache number register (when the current cache valid flag bit is 1, the data continues to be written). If the current data cache is filled with input data, the current cache valid flag will be cleared to 0, and the subsequent data writing of the output channel needs to re-apply for a new free data cache. In addition, the output direction occupied cache management module will read and output the data of the corresponding data cache according to the first data cache label in the occupied cache queue. Since the occupied cache queue has the characteristics of first-in-first-out, the data cache label at the head of the queue corresponds to the data cache written to the input data that first enters the system, thereby realizing the first-write-first-read of data to achieve the order preservation of input and output data.

[0103] (4) Vector first 1 search module: The vector first 1 search module is mainly responsible for two functions:

[0104] 1) When the data caches occupied by multiple output channels are read empty and released at the same time, the vector first 1 search module can find the output channel number in the first position starting from the low bit according to the cache release flag vectors of all output channels (i.e., the cache release vector of this application). At this time, the data cache label released by the output channel is written back to the public free cache management module to ensure that when the next input data enters the system, there is free data cache in the public free cache management module for allocation. The vector first 1 search module can eliminate bubbles between input data (i.e., there is no waiting time between input data due to the lack of free data cache in the public free cache management module). Subsequently, the output directions of the remaining released cache spaces in the cache release flag vectors of all output channels will write their corresponding released cache labels into their corresponding released cache queues.

[0105] 2) When the release cache queues corresponding to multiple output directions contain data cache space that has been released for the output direction, at this time, according to the release cache vectors of all output channels, starting from the low bit, find the output channel number at the first position, and write the cache label in its release cache queue back to the public free cache management module. This operation is repeated until all the released data cache space in the release cache queue corresponding to the output channel is written back to the public free cache management module.

[0106] (5) Output direction release cache management module: There are m output direction release cache management modules (m output directions) in the system. The output direction release cache management module is mainly responsible for recording the data cache labels released in the current output direction, and combining with the vector first 1 search module to write the corresponding data cache labels released in all output directions back to the public free cache management module in turn, in preparation for input data application.

[0107] Optional embodiment (two):

[0108] Figure 6 Schematic diagram (II) of a hardware implementation scheme for multiple output ports based on a cache dynamic allocation method according to an optional embodiment of the present application, such as Figure 6 As shown, the system is set to have 4 output directions, corresponding to output directions 0 to 3 respectively, and 8 dynamically allocated data caches are set, corresponding to data caches 0 to 7 respectively.

[0109] When the system is in the initialization state, eight dynamically assignable data cache labels 0 to 7 are sequentially written into the queue in the public free cache management module.

[0110] After the system initialization is completed, the data 0 and 1 corresponding to the output direction 0 enter the system. At this time, the current cache valid flag corresponding to the output direction 0 is 0, indicating that there is no valid writable data cache in the output direction 0. At this time, the output direction 0 applies for an idle data cache 0 from the queue of the public idle cache management module, and writes the input data 0 and 1 into the data cache in sequence. At the same time, the data cache 0 is written to the occupied cache queue corresponding to the output direction 0, and the current occupied cache number register is updated to data cache 0 and the current cache valid flag position is 1 (indicating that the subsequent data of the output direction 0 can continue to be written into the data cache 0). At this time, the output direction 0 can read data from the data cache 0 for output.

[0111] Since there is no data cache space released in any output channel during this process, that is, the cache release vector is 0000 (4 output channels, 0 indicates no data cache release, and 1 indicates data cache release), at this time, there is no need to write back the released data cache label to the public free cache management module.

[0112] Optional embodiment (three):

[0113] Figure 7 Schematic diagram (III) of a hardware implementation scheme for multiple output ports based on a cache dynamic allocation method according to an optional embodiment of the present application, such as Figure 7 As shown, the system is set to have 4 output directions, corresponding to output directions 0 to 3 respectively, and 8 dynamically allocated data caches are set, corresponding to data caches 0 to 7 respectively.

[0114] Data 0 and 1 corresponding to output direction 1 enter the system. At this time, the current cache valid flag corresponding to output direction 1 is 0, indicating that there is no valid writable data cache in output direction 1. At this time, output direction 1 applies for an idle data cache 1 from the queue of the public idle cache management module, writes input data 0 and 1 into the data cache in sequence, and writes data cache 1 to the occupied cache queue corresponding to output direction 1, and updates the current occupied cache number register to data cache 1 and the current cache valid flag position 1 (indicating that subsequent data of output direction 1 can continue to be written into data cache 1). At this time, output direction 1 can read data from data cache 1 for output. Since there is no data cache space released in the output channel during this process, the cache release vector is 0000 (4 output channels, 0 indicates that there is no data cache release, and 1 indicates that there is a data cache release). At this time, there is no need to write back the released data cache label to the public idle cache management module.

[0115] Optional embodiment (four):

[0116] Figure 8 Schematic diagram (IV) of a hardware implementation scheme for multiple output ports based on a cache dynamic allocation method according to an optional embodiment of the present application, such as Figure 8 As shown, the system is set to have 4 output directions, corresponding to output directions 0 to 3 respectively, and 8 dynamically allocated data caches are set, corresponding to data caches 0 to 7 respectively.

[0117] The data 0 and 1 corresponding to output direction 2 enter the system. At this time, the current cache valid flag corresponding to output direction 2 is 0, indicating that there is currently no valid writable data cache in output direction 2.

[0118] At this time, output direction 2 applies for an idle data cache 2 from the queue of the public idle cache management module, and writes the input data 0 and 1 into the data cache in sequence. At the same time, data cache 2 is written to the occupied cache queue corresponding to output direction 2, and the current occupied cache number register is updated to data cache 2, the current cache valid flag position 1 (indicating that subsequent data in output direction 2 can continue to be written into data cache 2). At this time, output direction 2 can read data from data cache 2 for output.

[0119] If the data cache 0 occupied by output direction 0 and the data cache 1 occupied by output direction 1 are released at the same time (cache release means that all the data in the cache are read away), then the cache release vector is 0011, and the vector first 1 search module finds the first 1 in the current vector corresponding to output direction 0 according to the cache release vector 0011. That is, at this time, the data cache 0 released by output direction 0 is written into the public free cache management module, and the data cache 1 released by output direction 1 is written into the release cache queue corresponding to output direction 1. At the same time, the current cache valid flag corresponding to output directions 0 and 1 is cleared to 0 (the data corresponding to output directions 0 and 1 need to re-apply for free data cache).

[0120] Optional embodiment (five):

[0121] Fig. 9 Schematic diagram (V) of a hardware implementation scheme for multiple output ports based on a dynamic cache allocation method according to an optional embodiment of the present application, such as Fig. 9 As shown, the system is set to have 4 output directions, corresponding to output directions 0 to 3 respectively, and 8 dynamically allocated data caches are set, corresponding to data caches 0 to 7 respectively.

[0122] Data 2 and 3 corresponding to output direction 2 enter the system. Since data 0 and 1 corresponding to output direction 2 previously entered the system, the data cache 2 space occupied by output direction 2 is filled up.

[0123] At this time, output direction 2 needs to reapply for data cache space. Output direction 2 applies for an idle data cache 3 from the queue of the public idle cache management module, and writes input data 2 and 3 into the data cache in sequence. At the same time, data cache 3 is written to the occupied cache queue corresponding to output direction 2, and the current occupied cache number register is updated to data cache 3 and the current cache valid flag position 1 (indicating that subsequent data of output direction 2 can continue to be written into data cache 3). Output direction 2 can now read data from data cache 2 for output.

[0124] At this time, if there is still released data cache 1 in the release cache queue of output direction 1, the cache release vector at this time is 0010. The vector first 1 search module finds the first 1 in the current vector corresponding to output direction 1 according to the cache release vector 0010, and writes the data cache 1 released in output direction 1 into the public free cache management module.

[0125] Optional embodiment (six):

[0126] Fig.10 Schematic diagram (VI) of a hardware implementation scheme for multiple output ports based on a cache dynamic allocation method according to an optional embodiment of the present application, such as Fig.10As shown, the system is set to have 4 output directions, corresponding to output directions 0 to 3 respectively, and 8 dynamically allocated data caches are set, corresponding to data caches 0 to 7 respectively.

[0127] The data 0 and 1 corresponding to output direction 3 enter the system. At this time, the query of the current cache valid flag corresponding to output direction 3 is 0, indicating that there is no valid writable data cache in output direction 3. Output direction 3 applies for an idle data cache 4 from the queue of the public idle cache management module, and writes the input data 0 and 1 into the data cache in sequence. At the same time, data cache 4 is written to the occupied cache queue corresponding to output direction 3, and the current occupied cache number register is updated to data cache 4 and the current cache valid flag position is 1 (indicating that subsequent data of output direction 3 can continue to be written into data cache 4). At this time, output direction 3 can read data from data cache 4 for output. During this period, data cache 2 occupied by output direction 2 is released (cache release means that all data in the cache is read away). At this time, the cache release vector is 0100. The vector first 1 search module finds the first 1 in the current vector corresponding to output direction 2 according to the cache release vector 0100, that is, the data cache 2 released by output direction 2 is written into the public idle cache management module.

[0128] Through the optional embodiments of the present application, the problem of mutual restriction of data in different output directions caused by the sharing of one data cache space by all output directions in traditional data serial input and serial output can be solved. The multi-output port control hardware implementation method based on the dynamic cache allocation method proposed in the optional embodiments of the present application can split the data cache space and reasonably allocate it on demand according to the different business pressures of the output ports, so as to maximize the utilization of the cache space. At the same time, parallel output of different output directions is realized, eliminating the phenomenon of mutual restriction between output channels. In addition, adding a cache release vector first 1 search mechanism can eliminate the problem of input data interruption caused by cache release and recovery, and can also improve the operating efficiency of the system.

[0129] That is to say, in the optional embodiment of the present application, since the output direction corresponding to the input data is shunted, each output direction is allocated to its own unique data cache space, which realizes the independence of data output in each output direction and is no longer restricted by other output channels, thereby improving the data output efficiency of the system. At the same time, the dynamic allocation of data cache space realizes the maximum utilization of hardware resources, and dynamically allocates data cache space on demand for output ports with different business pressures. In addition, adding a vector first 1 search module can eliminate the input data interruption phenomenon caused by the time delay of releasing and recovering the data cache space. That is, the optional embodiment of the present application can realize the maximum rational allocation of hardware cache resources while greatly improving the operating efficiency of the system.

[0130] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0131] In the present embodiment, a data output device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions thereof will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and contemplated.

[0132] Fig.11 is a structural block diagram of a data output device according to an embodiment of the present application, such as Fig.11 As shown, the device comprises:

[0133] The determination module 112 is used to determine, when receiving the first data, a first output direction of the first data, and determine whether there is a valid cache space in a first cache space queue corresponding to the first output direction, wherein the data in the cache space corresponding to the first cache space queue is output through the first output direction;

[0134] An application module 114, configured to apply for a first cache space according to a public cache space queue and write the first data into the first cache space when it is determined that there is no valid cache space;

[0135] The writing module 116 is used to write the first cache space identifier corresponding to the first cache space into the first cache space queue, and determine the first cache space as a valid cache space in the first cache space queue, so that the first data is output in the first output direction through the first cache space.

[0136] Through the data output device of the present application, when the first data is received, the first output direction of the first data is determined, and it is determined whether there is an effective cache space in the first cache space queue corresponding to the first output direction, and the data in the cache space corresponding to the first cache space queue is output through the first output direction. In the case of determining that there is no effective cache space in the first cache space queue, the first cache space is applied for according to the public cache space queue, and the first data is written into the first cache space, the first cache space identifier corresponding to the first cache space is written into the first cache space queue, and the first cache space is determined as the effective cache space in the first cache space queue, so that the first data is output in the first output direction through the first cache space. In the embodiment of the present application, when there is no effective cache space in the first output direction, it is necessary to apply for the first cache space from the public cache space queue, and use the first cache space as the effective data cache in the first output direction, so that the first data can be output in the first output direction through the first cache space. That is to say, the embodiment of the present application defines the public cache space queue, and the output direction of each data cache in the public cache space queue is consistent, and then each output direction has a cache space corresponding to each output direction, so that the data of each output direction can be output in each output direction through the cache space corresponding to each output direction. Through the embodiments of the present application, the problem of low data output efficiency caused by serial input and serial output of data in the related art and all output directions being output through one cache space is solved, thereby improving the data output efficiency.

[0137] In an exemplary embodiment, the determination module 112 is also used to divide the public cache space in the target system into multiple cache spaces when it is determined that the target system is in an initialization state, and determine the cache space identifier corresponding to each cache space after the division, wherein the target system is used to receive the first data; write the cache space identifier corresponding to each cache space after the division into the public cache space queue, wherein the multiple cache spaces include: the first cache space; and detect whether the first data is received when it is determined that the initialization of the target system is completed.

[0138] In an exemplary embodiment, the determination module 112 is also used to determine whether the identifier of the valid flag corresponding to the first cache space queue is a target identifier; when it is determined that the identifier is the target identifier, it is determined that there is no valid cache space in the first cache space queue; when it is determined that the identifier is not the target identifier, it is determined that there is valid cache space in the first cache space queue.

[0139] In an exemplary embodiment, the determination module 112 is also used to adjust the identifier of the valid flag to the target identifier when it is determined that there is no cache space identifier corresponding to the cache space in the first cache space queue; or, when it is determined that there is a second cache space identifier corresponding to the second cache space in the first cache space queue, and the space state corresponding to the second cache space is a full space state, adjust the identifier of the valid flag to the target identifier.

[0140] In an exemplary embodiment, the write module 116 is also used to determine a second output direction of the second data when receiving the second data, and determine whether the second output direction is consistent with the first output direction; when it is determined that the second output direction is consistent with the first output direction, determine whether there is valid cache space in the first cache space queue, and write the second data to the cache space corresponding to the first cache space queue according to whether there is valid cache space in the first cache space queue; when it is determined that the second output direction is inconsistent with the first output direction, determine whether there is valid cache space in the second cache space queue corresponding to the second output direction, and write the second data to the cache space corresponding to the second cache space queue according to whether there is valid cache space in the second cache space queue.

[0141] In an exemplary embodiment, the writing module 116 is further configured to write the second data into the first cache space when determining that there is valid cache space in the first cache space queue, so that the second data is output in the first output direction through the first cache space.

[0142] In an exemplary embodiment, the write module 116 is also used to apply for a third cache space in the public cache space and write the second data into the third cache space when it is determined that there is no valid cache space in the first cache space queue; write the third cache space identifier corresponding to the third cache space into the first cache space queue, and determine the third cache space as a valid cache space in the first cache space queue, so that the second data can be output in the first output direction through the third cache space.

[0143] In an exemplary embodiment, the write module 116 is also used to obtain a cache release vector, wherein each bit of the cache release vector is used to indicate whether there is cache space to be released to the public cache space queue in the cache space queue corresponding to each output direction in the target system; determine whether the bit value corresponding to each bit is a target bit value; and when it is determined that the bit value corresponding to any bit is the target bit value, release the cache space to be released to the public cache space queue corresponding to the output direction corresponding to any bit to the public cache space queue.

[0144] In an exemplary embodiment, the write module 116 is also used to determine the bit number of the target bit position, wherein the target bit position is a bit position whose bit value is the target bit value; when it is determined that the bit number is the target value, determine the third output direction corresponding to the target bit position; determine the first cache space number of the cache space to be released to the public cache space queue corresponding to the third output direction; when it is determined that the first cache space number is the target value, release the cache space to be released to the public cache space queue corresponding to the third output direction into the public cache space queue.

[0145] In an exemplary embodiment, the write module 116 is also used to release the first cache space among the multiple cache spaces to be released to the public cache space queue corresponding to the third output direction to the public cache space queue when it is determined that the first cache space quantity is not the target value, and write the fourth cache space identifiers corresponding to other cache spaces among the multiple cache spaces to be released to the public cache space queue corresponding to the third output direction to the first released cache space queue corresponding to the third output direction in sequence, wherein the fourth cache space identifier in the first released cache space queue is used to indicate the cache space to be released to the public cache space queue corresponding to the third output direction; when it is determined that the first cache space has been successfully released to the public cache space queue, the other cache spaces are released to the public cache space queue in sequence according to the writing order of the fourth cache space identifier.

[0146] In an exemplary embodiment, the write module 116 is also used to determine the bit order of multiple target bits in the cache release vector when it is determined that the bit quantity of the target bit is not the target value; determine the first target bit among the multiple target bits according to the bit order, and determine the fourth output direction corresponding to the first target bit; determine whether the second cache space quantity of the fourth cache space corresponding to the fourth output direction is the target value; and release the fourth cache space to the public cache space queue according to whether the second cache space quantity is the target value.

[0147] In an exemplary embodiment, the write module 116 is also used to determine other target bits among the multiple target bits according to the bit order, wherein the other target bits are bits among the multiple target bits except the first target bit; determine the fifth output direction corresponding to the other target bits; write the fifth cache space identifier corresponding to the fifth cache space corresponding to the fifth output direction into the second released cache space queue corresponding to the fifth output direction, wherein the fifth cache space identifier in the second released cache space queue is used to indicate the cache space corresponding to the fifth output direction to be released to the public cache space queue; when it is determined that the fourth cache space has been successfully released to the public cache space queue, the fifth cache space corresponding to the fifth cache space identifier in the second released cache space queue is released to the public cache space queue.

[0148] In an exemplary embodiment, the write module 116 is also used to determine the output direction of each third data when multiple third data are received, and determine whether there is valid cache space in the cache space queue corresponding to the output direction of each third data; when it is determined that there is valid cache space in the third cache space queue and there is no valid cache space in the fourth cache space queue, write the third data with an output direction of a sixth output direction into the third cache space queue, and write the third data with an output direction of a seventh output direction into the fourth cache space queue, wherein the cache space queues corresponding to the output direction of each third data include: the third cache space queue and the fourth cache space queue, the sixth output direction is the output direction corresponding to each fourth cache space queue, and the seventh output direction is the output direction corresponding to each fourth cache space queue.

[0149] In an exemplary embodiment, the write module 116 is also used to write the third data whose output direction is the sixth output direction into the effective cache space in the fourth cache space queue, so that the third data whose output direction is the sixth output direction is output in the sixth output direction through the effective cache space in the fourth cache space queue.

[0150] In an exemplary embodiment, the write module 116 is also used to apply for a sixth cache space in the public cache space queue, and write the third data with the output direction being the seventh output direction into the sixth cache space; write the sixth cache space identifier corresponding to the sixth cache space into the fourth cache space queue, and determine the sixth cache space as a valid cache space in the fourth cache space queue, so that the third data with the output direction being the seventh output direction is output in the seventh output direction through the sixth cache space.

[0151] In an exemplary embodiment, the write module 116 is also used to determine whether there is effective cache space in the fifth cache space queue corresponding to the eighth output direction when multiple fourth data are received and the output direction of each fourth data is the eighth output direction; when it is determined that there is effective cache space in the fifth cache space queue, determine the remaining cache space of the effective cache space in the fifth cache space queue, and determine the size relationship between the remaining cache space and the total data space of the multiple fourth data; write the multiple fourth data into the eighth output direction according to the size relationship, so that each fourth data is output in the eighth output direction.

[0152] In an exemplary embodiment, the write module 116 is also used to write each fourth data into the valid cache space in the fifth cache space queue when the size relationship indicates that the remaining cache space is greater than or equal to the total data space, so that each fourth data is output in the eighth output direction through the valid cache space in the fifth cache space queue.

[0153] In an exemplary embodiment, the write module 116 is also used to apply for a seventh cache space in the public cache space queue when the size relationship indicates that the remaining cache space is smaller than the total data space; write a target number of fourth data into the valid cache space in the fifth cache space queue, and write other fourth data into the seventh cache space, wherein the other fourth data are fourth data among the multiple fourth data except the target number of fourth data; write a seventh cache space identifier corresponding to the seventh cache space into the fifth cache space queue; and when it is determined that the target number of fourth data has been successfully output in the eighth output direction, determine the seventh cache space as the valid cache space in the fifth cache space queue, so that the other fourth data can be output in the eighth output direction through the valid cache space in the fifth cache space queue.

[0154] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.

[0155] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0156] An embodiment of the present application further provides 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 execute the steps in the above method embodiment.

[0157] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0158] An embodiment of the present application further provides a computer program product, including a computer program, which is implemented to perform the steps in the above method embodiment when executed by a processor.

[0159] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0160] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general 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 a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0161] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A data output method, characterized in that: include: In the case of receiving first data, determining a first output direction of the first data, and determining whether there is valid cache space in a first cache space queue corresponding to the first output direction, wherein data in the cache space corresponding to the first cache space queue is output through the first output direction; In the case where it is determined that there is no valid cache space, applying for a first cache space according to the public cache space queue, and writing the first data into the first cache space; writing a first cache space identifier corresponding to the first cache space into the first cache space queue, and determining the first cache space as a valid cache space in the first cache space queue, so that the first data is output in the first output direction through the first cache space; After determining the first cache space as a valid cache space in the first cache space queue, the method further includes: In case of receiving second data, determining a second output direction of the second data, and determining whether the second output direction is consistent with the first output direction; When it is determined that the second output direction is consistent with the first output direction, determining whether there is valid cache space in the first cache space queue, and writing the second data into the cache space corresponding to the first cache space queue according to whether there is valid cache space in the first cache space queue; When it is determined that the second output direction is inconsistent with the first output direction, determine whether there is valid cache space in the second cache space queue corresponding to the second output direction, and write the second data to the cache space corresponding to the second cache space queue according to the existence of the valid cache space in the second cache space queue.

2. The method according to claim 1, characterized in that Before determining the first output direction of the first data, the method further includes: In the case of determining that the target system is in an initialization state, dividing a public cache space in the target system into a plurality of cache spaces, and determining a cache space identifier corresponding to each divided cache space, wherein the target system is used to receive the first data; Writing the cache space identifier corresponding to each divided cache space into the public cache space queue, wherein the multiple cache spaces include: the first cache space; When it is determined that the target system initialization is completed, it is detected whether the first data is received.

3. The method according to claim 1, characterized in that Determining whether there is valid cache space in the first cache space queue corresponding to the first output direction includes: Determine whether the identifier of the valid flag bit corresponding to the first cache space queue is a target identifier; In a case where it is determined that the identifier is the target identifier, determining that there is no valid cache space in the first cache space queue; When it is determined that the identifier is not the target identifier, it is determined that there is valid cache space in the first cache space queue.

4. The method according to claim 3, characterized in that Before determining whether the identifier of the valid flag bit corresponding to the first cache space queue is a target identifier, the method further includes: When it is determined that there is no cache space identifier corresponding to the cache space in the first cache space queue, adjusting the identifier of the valid flag bit to the target identifier; or, When it is determined that a second cache space identifier corresponding to the second cache space exists in the first cache space queue and the space state corresponding to the second cache space is a full space state, the identifier of the valid flag is adjusted to the target identifier.

5. The method according to claim 1, characterized in that Writing the second data into the cache space corresponding to the second cache space queue according to the existence of the valid cache space in the second cache space queue includes: When it is determined that there is valid cache space in the first cache space queue, the second data is written into the first cache space, so that the second data is output in the first output direction through the first cache space.

6. The method according to claim 1, characterized in that Writing the second data into the cache space corresponding to the second cache space queue according to the existence of the valid cache space in the second cache space queue includes: In the case of determining that there is no valid cache space in the first cache space queue, applying for a third cache space in the public cache space, and writing the second data into the third cache space; The third cache space identifier corresponding to the third cache space is written into the first cache space queue, and the third cache space is determined as a valid cache space in the first cache space queue, so that the second data is output in the first output direction through the third cache space.

7. The method according to claim 1, characterized in that After determining the first cache space as a valid cache space in the first cache space queue, the method further includes: Obtaining a cache release vector, wherein each bit of the cache release vector is used to indicate whether there is a cache space to be released to the public cache space queue in the cache space queue corresponding to each output direction in the target system; Determine whether the bit value corresponding to each bit position is a target bit value; When it is determined that the bit value corresponding to any bit is the target bit value, the cache space to be released to the public cache space queue corresponding to the output direction corresponding to the any bit is released to the public cache space queue.

8. The method according to claim 7, characterized in that Releasing the cache space to be released to the public cache space queue corresponding to the output direction corresponding to any one of the bits to the public cache space queue includes: Determine the number of target bits, wherein the target bits are bits whose bit values ​​are target bit values; When it is determined that the number of bits is a target value, determining a third output direction corresponding to the target bit; Determine a first cache space quantity of the cache space to be released to the public cache space queue corresponding to the third output direction; When it is determined that the first cache space quantity is the target value, the cache space corresponding to the third output direction to be released to the public cache space queue is released to the public cache space queue.

9. The method according to claim 8, characterized in that After determining a first cache space quantity corresponding to the third output direction to be released to the cache space in the public cache space queue, the method further includes: When it is determined that the first cache space quantity is not the target value, the first cache space among the multiple cache spaces to be released to the public cache space queue corresponding to the third output direction is released to the public cache space queue, and the fourth cache space identifiers corresponding to the other cache spaces among the multiple cache spaces to be released to the public cache space queue corresponding to the third output direction are sequentially written into the first released cache space queue corresponding to the third output direction, wherein the fourth cache space identifier in the first released cache space queue is used to indicate the cache space to be released to the public cache space queue corresponding to the third output direction; When it is determined that the first cache space has been successfully released to the public cache space queue, the other cache spaces are released to the public cache space queue in sequence according to the writing order of the fourth cache space identifier.

10. The method according to claim 8, characterized in that After determining the number of target bits, the method further includes: In a case where it is determined that the number of bits of the target bit position is not the target value, determining a bit order of multiple target bits in the cache release vector; Determine a first target bit position among the multiple target bit positions according to the bit sequence, and determine a fourth output direction corresponding to the first target bit position; Determine whether the second cache space quantity of the fourth cache space corresponding to the fourth output direction is the target value; The fourth cache space is released to the public cache space queue according to whether the second cache space quantity is the target value.

11. The method according to claim 10, characterized in that After determining the bit order of the plurality of target bits in the cache release vector, the method further comprises: Determining other target bit positions among the multiple target bit positions according to the bit sequence, wherein the other target bit positions are the bit positions among the multiple target bit positions except the first target bit position; Determine a fifth output direction corresponding to the other target bit positions; Writing a fifth cache space identifier corresponding to the fifth cache space corresponding to the fifth output direction into a second released cache space queue corresponding to the fifth output direction, wherein the fifth cache space identifier in the second released cache space queue is used to indicate the cache space corresponding to the fifth output direction to be released to the public cache space queue; When it is determined that the fourth cache space has been successfully released to the public cache space queue, the fifth cache space corresponding to the fifth cache space identifier in the second released cache space queue is released to the public cache space queue.

12. The method according to claim 1, characterized in that After determining the first cache space as a valid cache space in the first cache space queue, the method further includes: In the case of receiving a plurality of third data, determining an output direction of each third data, and determining whether there is valid cache space in the cache space queue corresponding to the output direction of each third data; When it is determined that there is valid cache space in the third cache space queue and there is no valid cache space in the fourth cache space queue, the third data with an output direction of the sixth output direction is written into the third cache space queue, and the third data with an output direction of the seventh output direction is written into the fourth cache space queue, wherein the cache space queues corresponding to the output direction of each third data include: the third cache space queue and the fourth cache space queue, the sixth output direction is the output direction corresponding to each fourth cache space queue, and the seventh output direction is the output direction corresponding to each fourth cache space queue.

13. The method according to claim 12, characterized in that Writing third data whose output direction is a sixth output direction into the third cache space queue includes: The third data whose output direction is the sixth output direction is written into the effective cache space in the fourth cache space queue, so that the third data whose output direction is the sixth output direction is output in the sixth output direction through the effective cache space in the fourth cache space queue.

14. The method according to claim 12, characterized in that Writing the third data whose output direction is the seventh output direction into the fourth cache space queue includes: Applying for a sixth cache space in the public cache space queue, and writing the third data whose output direction is a seventh output direction into the sixth cache space; The sixth cache space identifier corresponding to the sixth cache space is written into the fourth cache space queue, and the sixth cache space is determined as a valid cache space in the fourth cache space queue, so that the third data with the output direction as the seventh output direction is output in the seventh output direction through the sixth cache space.

15. The method according to claim 1, characterized in that After determining the first cache space as a valid cache space in the first cache space queue, the method further includes: When a plurality of fourth data are received and the output direction of each of the fourth data is the eighth output direction, determining whether there is valid cache space in the fifth cache space queue corresponding to the eighth output direction; In the case of determining that there is valid cache space in the fifth cache space queue, determining a remaining cache space of the valid cache space in the fifth cache space queue, and determining a size relationship between the remaining cache space and a total data space of the plurality of fourth data; The plurality of fourth data are written into the eighth output direction according to the size relationship, so that each of the fourth data is output in the eighth output direction.

16. The method according to claim 15, characterized in that Writing the plurality of fourth data into the eighth output direction according to the size relationship comprises: When the size relationship indicates that the remaining cache space is greater than or equal to the total data space, each fourth data is written to the valid cache space in the fifth cache space queue, so that each fourth data is output in the eighth output direction through the valid cache space in the fifth cache space queue.

17. The method according to claim 15, characterized in that Writing the plurality of fourth data into the eighth output direction according to the size relationship comprises: In a case where the size relationship indicates that the remaining cache space is smaller than the total data space, applying for a seventh cache space from the public cache space queue; Writing a target number of fourth data into a valid cache space in the fifth cache space queue, and writing other fourth data into the seventh cache space, wherein the other fourth data is fourth data other than the target number of fourth data among the plurality of fourth data; Writing a seventh cache space identifier corresponding to the seventh cache space into the fifth cache space queue; When it is determined that the target number of fourth data has been successfully output in the eighth output direction, the seventh cache space is determined as the valid cache space in the fifth cache space queue, so that the other fourth data can be output in the eighth output direction through the valid cache space in the fifth cache space queue.

18. A data output device, characterized in that: include: a determination module, configured to determine, upon receiving first data, a first output direction of the first data, and determine whether there is valid cache space in a first cache space queue corresponding to the first output direction, wherein data in the cache space corresponding to the first cache space queue is output via the first output direction; an application module, configured to apply for a first cache space according to a public cache space queue and write the first data into the first cache space when it is determined that no valid cache space exists; a writing module, configured to write a first cache space identifier corresponding to the first cache space into the first cache space queue, and determine the first cache space as a valid cache space in the first cache space queue, so that the first data is output in the first output direction through the first cache space; The write module is also used to determine a second output direction of the second data when receiving second data, and determine whether the second output direction is consistent with the first output direction; when it is determined that the second output direction is consistent with the first output direction, determine whether there is valid cache space in the first cache space queue, and write the second data to the cache space corresponding to the first cache space queue according to whether there is valid cache space in the first cache space queue; when it is determined that the second output direction is inconsistent with the first output direction, determine whether there is valid cache space in the second cache space queue corresponding to the second output direction, and write the second data to the cache space corresponding to the second cache space queue according to the existence of valid cache space in the second cache space queue.

19. A computer-readable storage medium, characterized in that: include: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method according to any one of claims 1 to 17 when executed by a processor.

20. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: include: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 17 are implemented.

21. A computer program product, comprising a computer program, characterized in that The computer program is used by a processor to execute the method described in any one of claims 1 to 17.