Data reading and writing method, device and equipment and readable storage medium
By reserving cache areas for different categories of data in the FIFO memory and using data status identifiers to process write requests, the problem of data discarding and cache filling in the FIFO memory when the writing speed is faster than the reading speed is solved, and the data timely processing and stability.
Patent Information
- Application Number
- CN202411279377.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2025-01-24
AI Technical Summary
Existing FIFO memory is easily filled when the writing speed is faster than the reading speed, resulting in random discarding of data, and the same data is filled with the cache when it is continuously written, resulting in other data being unable to be read in time, affecting processing efficiency.
A cache area is reserved in the first-in-first-out memory for various categories of target data to be written, and a flag bit is set for each type of data to store the data status identification. When obtaining a data write request, read the data status identifier of the target data and decide whether to write data based on the identifier to avoid repeated writing and data discarding.
By reserving cache areas and using data status identifiers, we ensure that all types of data can be written and processed in a timely manner, avoid data discarding and cache filling problems, and improve the efficiency and stability of data processing.
Smart Images

Figure CN119356637A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a data reading and writing method, device, equipment, and readable storage medium. Background Art
[0002] In system design, in order to increase data transmission rate, process large amounts of data streams, and match systems with different transmission rates, first in first out (FIFO) memories are widely used, thereby improving system performance.
[0003] FIFO memory is a first-in-first-out dual-port buffer, that is, the first data to enter the FIFO is the first to be removed, one port is the input port of the memory, and the other port is the output port of the memory. The read and write operations of the FIFO memory can be performed asynchronously, similar to a buffer that absorbs the speed difference between the write end and the read end.
[0004] The function of the existing FIFO is mainly to cache all input data and then output them losslessly in the order of input. However, if the request generation speed is greater than the request execution speed, that is, the data is written faster and the data is read slower, the FIFO will soon be full. When the FIFO is full, if data continues to be written, data will be randomly discarded, resulting in the inability to process the data normally. In addition, when the same type of data is written to the FIFO multiple times in a row, the FIFO will be filled with the same type of data. At this time, the data read is the same type of data, resulting in other types of data not being read in time, especially when the data is read slowly, which seriously affects the processing of other types of data. Summary of the invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a data reading and writing method, device, equipment and readable storage medium to avoid the phenomenon of random data discarding, ensure that data is processed normally, and ensure that all types of data can be processed in a timely manner.
[0006] In a first aspect, an embodiment of the present disclosure provides a data reading and writing method, in which a cache area is reserved in advance in a first-in-first-out memory for each category of target data to be written, and a corresponding mark bit is set for each category of target data based on an index of each category of target data, and the mark bit is used to store a data status identifier of each category of target data, and the method includes:
[0007] Obtaining a data write request, wherein the data write request includes target data to be written into a first-in-first-out memory;
[0008] Based on the index of the target data, reading a data status identifier of the target data;
[0009] The target data is processed according to the data status identifier of the target data.
[0010] In a second aspect, an embodiment of the present disclosure provides a data reading and writing device, which reserves a cache area in advance in a first-in-first-out memory for various types of target data to be written, and sets a corresponding mark bit for each type of target data based on the index of each type of target data, wherein the mark bit is used to store data status identifiers of each type of target data, and the device includes:
[0011] A first acquisition module, used for acquiring a data write request, wherein the data write request includes target data to be written into the first-in-first-out memory;
[0012] A first reading module, configured to read a data status identifier of the target data based on an index of the target data;
[0013] A processing module is used to process the target data according to the data status identifier of the target data.
[0014] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
[0015] Memory;
[0016] Processor; and
[0017] Computer programs;
[0018] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the first aspect.
[0019] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method as described in the first aspect.
[0020] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the method described in the first aspect is implemented.
[0021] The data reading and writing method, device, equipment and readable storage medium provided by the embodiments of the present disclosure reserve a cache area in advance in a first-in-first-out memory for each category of target data to be written, and set a corresponding mark bit for each category of target data based on the index of each category of target data, and the mark bit is used to store the data status identifier of each category of target data. Further, a data write request is obtained, the data write request includes the target data to be written to the first-in-first-out memory, based on the index of the target data, the data status identifier of the target data is read, and the target data is processed according to the data status identifier of the target data. Compared with the prior art, the embodiment of the present disclosure reserves a cache area in advance in the first-in-first-out memory for each category of target data to be written, thereby ensuring that each category of data can be written into the first-in-first-out memory, so that each category of data can be processed in a timely manner, and a corresponding mark bit is set for each category of target data, and the mark bit is used to store the data status identifier of each category of target data. Based on the index of the target data, the data status identifier of the target data is read, and then the target data is processed according to the data status identifier of the target data. Through the data status identifier of the target data, it can be known whether the target data has been stored in the first-in-first-out memory, and the data can be written without being repeated, further avoiding the phenomenon of random data discarding, and ensuring that the data is processed normally. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0023] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0024] Figure 1 A flow chart of a data reading and writing method provided in an embodiment of the present disclosure;
[0025] Figure 2 A flow chart of a data reading and writing method provided by another embodiment of the present disclosure;
[0026] Figure 3 A flow chart of a data reading and writing method provided by another embodiment of the present disclosure;
[0027] Figure 4 A schematic diagram of the overall process of the data reading and writing method provided by the embodiment of the present disclosure;
[0028] Figure 5 A schematic diagram of the structure of a data reading and writing device provided in an embodiment of the present disclosure;
[0029] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0031] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0032] In system design, in order to increase data transmission rate, process large amounts of data streams, and match systems with different transmission rates, first in first out (FIFO) memories are widely used, thereby improving system performance.
[0033] FIFO memory is a first-in-first-out dual-port buffer, that is, the first data to enter the FIFO is the first to be removed, one port is the input port of the memory, and the other port is the output port of the memory. The read and write operations of the FIFO memory can be performed asynchronously, similar to a buffer that absorbs the speed difference between the write end and the read end.
[0034] The function of the existing FIFO is mainly to cache all input data and then output them losslessly in the order of input. However, if the request generation speed is greater than the request execution speed, that is, the writing data is faster and the reading data is slower, the FIFO will soon be full. When the FIFO is full, if data continues to be written, the data will be randomly discarded, resulting in the data being unable to be processed normally. In addition, when the same type of data is written to the FIFO multiple times in succession, the FIFO will be filled with the same type of data. At this time, the data read is the same type of data, resulting in other types of data being unable to be read in time, especially when the reading data is slow, which seriously affects the processing of other types of data. In response to this problem, the embodiments of the present disclosure provide a data reading and writing method, which is described below in conjunction with specific embodiments.
[0035] Figure 1A flow chart of a data reading and writing method provided in an embodiment of the present disclosure. The executor of the method is an electronic device. The electronic device may be a portable mobile device such as a smart phone, a tablet computer, a laptop computer, a car navigation device, an intelligent sports equipment, or a fixed device such as a personal computer, a smart home appliance, or a server, wherein the server may be a single server or a server cluster, and the server cluster may be a distributed cluster or a centralized cluster. The method may be applied to scenarios where data is read and written, and may also be applied to scenarios where data in a first-in-first-out memory is processed. It is understandable that the data reading and writing method provided in an embodiment of the present disclosure may also be applied in other scenarios.
[0036] Below Figure 1 The data reading and writing method shown in the figure is introduced, a cache area is reserved in advance in the first-in-first-out memory for each category of target data to be written, and a corresponding mark bit is set for each category of target data based on the index of each category of target data, and the mark bit is used to store the data status identifier of each category of target data. The specific steps of the method are as follows:
[0037] According to the type of target data, a cache area is reserved for each category of target data in advance, that is, the depth of the first-in-first-out memory is set to be the same as the type of target data. Each category of target data has a unique index, and a corresponding flag bit is set for each category of target data according to the index of each category of target data, and the flag bit is used to store the data status identifier of each category of target data. For example, there are five types of target data, and the depth of the first-in-first-out memory is set to 5, and the indexes of the five types of target data are A, B, C, D, and E respectively. A corresponding flag bit is set for each of the five indexes, and the flag bit is used to store the data status identifier of each category of target data.
[0038] S101. Obtain a data write request, where the data write request includes target data to be written into a first-in-first-out memory.
[0039] In this step, the electronic device obtains a data write request, which may come from a write end without limitation. The data write request includes target data to be written into the FIFO memory.
[0040] S102: Read a data status identifier of the target data based on an index of the target data.
[0041] In this step, the electronic device reads the data status identifier of the target data according to the index of the target data. Specifically, the data status identifier of the target data can be found according to the index of the target data. Figure 4As shown, after obtaining the data write request, the mark state is read with the data as the index, that is, the data state identifier of the target data is read.
[0042] In some embodiments, the data status identifier includes one of a first status identifier and a second status identifier; the first status identifier is used to indicate that the target data already exists in the first-in-first-out memory, and the second status identifier is used to indicate that the target data does not exist in the first-in-first-out memory. Optionally, the data status identifier can be represented by a simple binary representation, or can be represented by letters, numbers, symbols, etc., or can be represented by a random combination of letters, numbers, and symbols, which is not limited here.
[0043] S103: Process the target data according to the data status identifier of the target data.
[0044] After reading the data status identifier of the target data, the electronic device processes the target data according to the data status identifier of the target data. In some embodiments, if the data status identifier indicates that the target data already exists, the target data is not written repeatedly; if the data status identifier indicates that the target data does not exist, the target data is written.
[0045] The disclosed embodiment reserves a cache area in advance in a first-in-first-out memory for each category of target data to be written, and sets a corresponding mark bit for each category of target data based on the index of each category of target data, and the mark bit is used to store the data status identifier of each category of target data. Further, a data write request is obtained, the data write request includes the target data to be written into the first-in-first-out memory, and based on the index of the target data, the data status identifier of the target data is read, and the target data is processed according to the data status identifier of the target data. Compared with the prior art, the embodiment of the present disclosure reserves a cache area in advance in the first-in-first-out memory for each category of target data to be written, thereby ensuring that each category of data can be written into the first-in-first-out memory, so that each category of data can be processed in a timely manner, and a corresponding mark bit is set for each category of target data, and the mark bit is used to store the data status identifier of each category of target data. Based on the index of the target data, the data status identifier of the target data is read, and then the target data is processed according to the data status identifier of the target data. Through the data status identifier of the target data, it can be known whether the target data has been stored in the first-in-first-out memory, and the data can be written without being repeated, further avoiding the phenomenon of random data discarding, and ensuring that the data is processed normally.
[0046] Figure 2A flow chart of a data reading and writing method provided by another embodiment of the present disclosure is provided. A cache area is reserved in advance in a first-in-first-out memory for each category of target data to be written. A corresponding flag bit is set for each category of target data based on the index of each category of target data. The flag bit is used to store the data status identifier of each category of target data, such as Figure 2 As shown, the method includes the following steps:
[0047] S201. Obtain a data write request, where the data write request includes target data to be written into a first-in-first-out memory.
[0048] Specifically, the implementation process and principle of S201 and S101 are the same, and will not be repeated here.
[0049] S202: Based on the target data, generate an index of the target data in a preset manner.
[0050] In this step, the electronic device generates the index of the target data in a preset manner based on the target data. In some embodiments, the index of the target data can be calculated according to the data content of the target data, or the index of the target data can be obtained by other means, which are not specifically limited.
[0051] S203. Based on the index of the target data, find a mark bit corresponding to the index of the target data.
[0052] like Figure 4 As shown, each type of data is provided with a mark bit. In this step, the electronic device searches for the mark bit corresponding to the index of the target data according to the index of the target data.
[0053] S204: Read a data status identifier of the target data from a mark bit corresponding to the index of the target data.
[0054] Furthermore, the electronic device can read the data status identifier of the target data from the mark bit corresponding to the index of the target data. In some embodiments, the data status identifier includes one of a first status identifier and a second status identifier; the first status identifier is used to indicate that the target data already exists in the first-in-first-out memory, and the second status identifier is used to indicate that the target data does not exist in the first-in-first-out memory. Optionally, the data status identifier can be represented by a simple binary representation, or by letters, numbers, symbols, etc., or by a random combination of letters, numbers, and symbols, which is not limited here.
[0055] S205: Determine whether the data state identifier of the target data is a first state identifier.
[0056] After reading the data status identifier of the target data, the electronic device determines whether the data status identifier of the target data is the first status identifier, and if the data status identifier is the first status identifier, S206 is executed, and if the data status identifier is not the first status identifier, S207 is executed. The essence is to determine whether the target data already exists in the first-in-first-out memory, and if the target data already exists in the first-in-first-out memory, S206 is executed, and if the target data does not exist in the first-in-first-out memory, S207 is executed.
[0057] S206: If the data state identifier of the target data is the first state identifier, discard the target data and do not write the target data into the first-in-first-out memory.
[0058] If the data state identifier is the first state identifier, the target data is discarded and not written into the FIFO memory. The essence of this step is that if the target data already exists in the FIFO memory, it is discarded and not stored repeatedly, thereby reducing the storage space required for the cache.
[0059] S207: If the data state identifier of the target data is the second state identifier, write the target data into a first-in-first-out memory, and change the data state identifier of the target data to the first state identifier.
[0060] If the data state identifier is not the first state identifier but the second state identifier, the target data is written into the first-in-first-out memory, and then the data state identifier of the target data is changed to the first state identifier. The essence of this step is that if the target data does not exist in the first-in-first-out memory, the target data is written into the first-in-first-out memory, ensuring that each type of target data can be written into the first-in-first-out memory, and the data state identifier of the target data is changed to the first state identifier.
[0061] The disclosed embodiment obtains a data write request, wherein the data write request includes target data to be written into a first-in-first-out memory, and based on the target data, generates an index of the target data in a preset manner. Further, based on the index of the target data, a mark bit corresponding to the index of the target data is found, and a data status identifier of the target data is read from the mark bit corresponding to the index of the target data. Then, it is determined whether the data status identifier of the target data is a first status identifier. If the data status identifier of the target data is a first status identifier, the target data is discarded and the target data is not written into the first-in-first-out memory; if the data status identifier of the target data is a second status identifier, the target data is written into the first-in-first-out memory, and the data status identifier of the target data is changed to the first status identifier. Compared with the prior art, the embodiment of the present disclosure reserves a cache area in advance in the first-in-first-out memory for each category of target data to be written, thereby ensuring that each category of data can be written into the first-in-first-out memory, so that each category of data can be processed in a timely manner. Through the data status identifier of the target data, it can be known whether the target data has been stored in the first-in-first-out memory, and the data can be written without being repeated, further avoiding the phenomenon of random data discarding and ensuring that the data is processed normally.
[0062] Figure 3 A flow chart of a data reading and writing method provided by another embodiment of the present disclosure is shown in FIG. Figure 3 As shown, the method includes the following steps:
[0063] S301. Obtain a data write request, where the data write request includes target data to be written into a first-in-first-out memory.
[0064] Specifically, the implementation process and principle of S301 and S101 are the same, and will not be repeated here.
[0065] S302: Read a data status identifier of the target data based on an index of the target data.
[0066] Specifically, the implementation process and principle of S302 and S102 are the same, and will not be repeated here.
[0067] S303: Process the target data according to the data status identifier of the target data.
[0068] Specifically, the implementation process and principle of S303 and S103 are the same, and will not be repeated here.
[0069] S304: Obtain a data read request, where the data read request includes target data to be read from a first-in-first-out memory.
[0070] In this step, the electronic device obtains a data read request, which may come from a reading end without limitation. The data read request includes target data to be read from the first-in-first-out memory.
[0071] S305 . Based on the data read request, read the target data to be read from the first-in-first-out memory.
[0072] After receiving the data read request, the electronic device may read the target data to be read from the first-in-first-out memory according to the data read request.
[0073] S306: Based on the target data, generate an index of the target data in a preset manner.
[0074] In this step, the electronic device generates the index of the target data in a preset manner based on the target data. In some embodiments, the index of the target data can be calculated according to the data content of the target data, or the index of the target data can be obtained by other means, which are not specifically limited.
[0075] S307: Set a data status identifier of the target data according to the index of the target data.
[0076] like Figure 4 As shown, the electronic device sets the mark state with the data as the index, that is, sets the data state identifier of the target data.
[0077] In some embodiments, S307 may include but is not limited to S3071 and S3072:
[0078] S3071. Based on the index of the target data, find a mark bit corresponding to the index of the target data.
[0079] like Figure 4 As shown, each type of data is provided with a mark bit. In this step, the electronic device searches for the mark bit corresponding to the index of the target data according to the index of the target data.
[0080] S3072: Change the data status identifier of the target data stored in the mark bit.
[0081] Furthermore, the data status identifier of the target data stored in the flag bit is changed. Since the target data is read out, the state of the target data changes, so the data status identifier needs to be changed.
[0082] In some embodiments, changing the data status identifier of the target data stored in the mark bit includes: changing the data status identifier of the target data to a second status identifier; and / or clearing the data status identifier of the target data.
[0083] In this step, the electronic device may change the data status identifier of the target data to a second status identifier, and / or may clear the data status identifier of the target data.
[0084] The disclosed embodiment obtains a data write request, the data write request includes the target data to be written into the first-in-first-out memory, reads the data status identifier of the target data based on the index of the target data, and processes the target data according to the data status identifier of the target data. In addition, obtains a data read request, the data read request includes the target data to be read from the first-in-first-out memory, and reads the target data to be read from the first-in-first-out memory based on the data read request. Further, based on the target data, the index of the target data is generated in a preset manner, and the data status identifier of the target data is set according to the index of the target data. Compared with the prior art, the disclosed embodiment can identify the data that has been stored and has not been read out, and no longer store it repeatedly, thereby reducing the storage space required for the cache, while retaining the first-in-first-out characteristics of the cache. By pre-reserving a cache area for each type of target data to be written in the first-in-first-out memory, it can be ensured that each type of data can be written into the first-in-first-out memory, so that each type of data can be processed in a timely manner.
[0085] Figure 5 The data reading and writing device provided in the embodiment of the present disclosure is a schematic diagram of the structure. The data reading and writing device can be the electronic device described in the above embodiment, or the data reading and writing device can be a component or assembly in the electronic device. The data reading and writing device provided in the embodiment of the present disclosure can execute the processing flow provided in the data reading and writing method embodiment, such as Figure 5 As shown, a cache area is reserved in advance in the first-in-first-out memory for various categories of target data to be written, and a corresponding mark bit is set for each category of target data based on the index of each category of target data, and the mark bit is used to store the data status identifier of each category of target data. The data reading and writing device 40 includes: a first acquisition module 41, a first reading module 42, and a processing module 43; wherein the first acquisition module 41 is used to obtain a data write request, and the data write request includes the target data to be written into the first-in-first-out memory; the first reading module 42 is used to read the data status identifier of the target data based on the index of the target data; the processing module 43 is used to process the target data according to the data status identifier of the target data.
[0086] Optionally, before the first reading module 42 reads the data status identifier of the target data based on the index of the target data, the first reading module 42 is further used to: generate the index of the target data in a preset manner based on the target data.
[0087] Optionally, when the first reading module 42 reads the data status identifier of the target data based on the index of the target data, it is specifically used to: find the mark bit corresponding to the index of the target data based on the index of the target data; and read the data status identifier of the target data from the mark bit corresponding to the index of the target data.
[0088] Optionally, the data state identifier includes one of a first state identifier and a second state identifier; the first state identifier is used to indicate that the target data already exists in the first-in-first-out memory, and the second state identifier is used to indicate that the target data does not exist in the first-in-first-out memory;
[0089] When processing the target data according to the data status identifier of the target data, the processing module 43 is specifically used to: determine whether the data status identifier of the target data is a first status identifier; if the data status identifier of the target data is the first status identifier, discard the target data and do not write the target data into a first-in-first-out memory; if the data status identifier of the target data is a second status identifier, write the target data into the first-in-first-out memory and change the data status identifier of the target data to the first status identifier.
[0090] Optionally, the device 40 also includes: a second acquisition module 44, a second reading module 45, and a setting module 46; wherein the second acquisition module 44 is used to obtain a data read request, and the data read request includes target data to be read from a first-in-first-out memory; the second reading module 45 is used to read the target data to be read from the first-in-first-out memory based on the data read request; the setting module 46 is used to generate an index of the target data in a preset manner based on the target data; and set a data status identifier of the target data according to the index of the target data.
[0091] Optionally, when the setting module 46 sets the data status identifier of the target data according to the index of the target data, it is specifically used to: find a mark bit corresponding to the index of the target data based on the index of the target data; and change the data status identifier of the target data stored in the mark bit.
[0092] Optionally, when the setting module 46 changes the data status identifier of the target data stored in the mark bit, it is specifically used to: change the data status identifier of the target data to a second status identifier; and / or clear the data status identifier of the target data.
[0093] Figure 5 The data reading and writing device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment, and its implementation principle and technical effect are similar and will not be described in detail here.
[0094] Figure 6 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Figure 6 , which shows a structural schematic diagram of an electronic device 600 suitable for implementing the embodiments of the present disclosure. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0095] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603 to implement the data reading and writing method of the embodiment described in the present disclosure. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0096] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0097] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart, thereby implementing the data reading and writing method as described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0098] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0099] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0100] The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0101] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0102] Obtaining a data write request, wherein the data write request includes target data to be written into a first-in-first-out memory;
[0103] Based on the index of the target data, reading a data status identifier of the target data;
[0104] The target data is processed according to the data status identifier of the target data.
[0105] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.
[0106] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0107] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0108] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0109] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0110] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0111] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0112] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0113] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A data reading and writing method, characterized in that: A cache area is reserved in advance in a first-in-first-out memory for each category of target data to be written, and a corresponding mark bit is set for each category of target data based on the index of each category of target data, and the mark bit is used to store data status identifiers of each category of target data. The method includes: Obtaining a data write request, wherein the data write request includes target data to be written into a first-in-first-out memory; Based on the index of the target data, reading a data status identifier of the target data; The target data is processed according to the data status identifier of the target data.
2. The method according to claim 1, characterized in that Before reading the data status identifier of the target data based on the index of the target data, the method further includes: Based on the target data, an index of the target data is generated in a preset manner.
3. The method according to claim 1, characterized in that The step of reading a data status identifier of the target data based on an index of the target data includes: Based on the index of the target data, find a mark bit corresponding to the index of the target data; A data status identifier of the target data is read from a mark bit corresponding to the index of the target data.
4. The method according to claim 1, characterized in that: The data status identifier includes one of a first status identifier and a second status identifier; the first status identifier is used to indicate that the target data already exists in the first-in-first-out memory, and the second status identifier is used to indicate that the target data does not exist in the first-in-first-out memory; The processing of the target data according to the data status identifier of the target data includes: Determining whether the data state identifier of the target data is a first state identifier; If the data state identifier of the target data is the first state identifier, discarding the target data and not writing the target data into the first-in-first-out memory; If the data state identifier of the target data is the second state identifier, the target data is written into a first-in-first-out memory, and the data state identifier of the target data is changed to the first state identifier.
5. The method according to claim 1, characterized in that The method further comprises: Obtaining a data read request, wherein the data read request includes target data to be read from a first-in-first-out memory; Based on the data read request, read the target data to be read from the first-in-first-out memory; Based on the target data, generating an index of the target data in a preset manner; According to the index of the target data, a data status identifier of the target data is set.
6. The method according to claim 5, characterized in that The step of setting a data status identifier of the target data according to an index of the target data includes: Based on the index of the target data, find a mark bit corresponding to the index of the target data; The data status identifier of the target data stored in the mark bit is changed.
7. The method according to claim 6, characterized in that The step of changing the data status identifier of the target data stored in the flag bit includes: Changing the data state identifier of the target data to a second state identifier; and / or The data status identifier of the target data is cleared.
8. A data reading and writing device, characterized in that: A cache area is reserved in advance in a first-in-first-out memory for each category of target data to be written, and a corresponding mark bit is set for each category of target data based on the index of each category of target data, and the mark bit is used to store the data state identifier of each category of target data. The device includes: A first acquisition module, used for acquiring a data write request, wherein the data write request includes target data to be written into the first-in-first-out memory; A first reading module, configured to read a data status identifier of the target data based on an index of the target data; A processing module is used to process the target data according to the data status identifier of the target data.
9. An electronic device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.