CN113986150A - Double-buffer-area alternate reading and multi-buffer-area circulating temporary storage method - Google Patents

Double-buffer-area alternate reading and multi-buffer-area circulating temporary storage method Download PDF

Info

Publication number
CN113986150A
CN113986150A CN202111615581.6A CN202111615581A CN113986150A CN 113986150 A CN113986150 A CN 113986150A CN 202111615581 A CN202111615581 A CN 202111615581A CN 113986150 A CN113986150 A CN 113986150A
Authority
CN
China
Prior art keywords
temporary storage
buffer area
data
storage buffer
reading
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN202111615581.6A
Other languages
Chinese (zh)
Inventor
程竟然
张锐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Ironman Technology Co ltd
Original Assignee
Beijing Ironman Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Ironman Technology Co ltd filed Critical Beijing Ironman Technology Co ltd
Priority to CN202111615581.6A priority Critical patent/CN113986150A/en
Publication of CN113986150A publication Critical patent/CN113986150A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements

Abstract

The invention discloses a double-buffer-area alternate reading and multi-buffer-area circulating temporary storage method, which is characterized in that two reading buffer areas and three temporary storage buffer areas forming a circulating linked list are set. The method utilizes the two reading buffer zones to deal with the condition that the frame head is not at the initial position of the buffer zone, even the condition that the frame head crosses the buffer zone, and avoids the problems of real-time reduction, performance loss and the like caused by refreshing of a single reading buffer zone in the prior art. And three temporary storage buffer areas are arranged, if the result frame of the current temporary storage buffer area is damaged, linear estimation can be carried out through the data of the previous two temporary storage buffer areas, a new result frame is obtained to replace the damaged result frame, and the subsequent problem caused by the damage of the result frame is avoided. Meanwhile, only after the result frame data of the current temporary storage buffer area is verified to be correct, the current node pointer points to the current temporary storage buffer area, so that other threads can use the structure frame through the pointer, and the race problem of multi-thread read-write operation under the condition of a single temporary storage buffer area is solved.

Description

Double-buffer-area alternate reading and multi-buffer-area circulating temporary storage method
Technical Field
The invention relates to the field of data reading and temporary storage, in particular to a double-buffer-area alternate reading and multi-buffer-area circulating temporary storage method.
Background
In real-time control systems, the I/O process requires acquisition of various sensor data for control planning, which must be accomplished in a very short and bounded time. This requires that the read and check data be as fault tolerant as possible and avoid unnecessary resource consumption, and in addition, when the result data is provided to the control algorithm process/thread after reading and checking, read and write race conditions should be prevented from occurring in the access of both the I/O process/thread and the control algorithm process/thread to the global/shared result data variable/memory. Typical I/O programs employ single buffer reads and ignore read-write protection of global/shared result data variables/memory.
In the prior art, some reading programs recognize a fixed length byte starting from a frame header as a data frame after detecting the frame header, so that when the current data frame is not enough to an expected length (transmission error occurs), the program can incorporate the frame header of a next frame into the current frame, so that when the current frame fails to be checked, a new search for the frame header can only locate the frame header of the next frame, and the next frame is wasted. Some reading programs can always detect the frame head of the next frame in order to avoid the disadvantages, however, because only a single reading buffer area is adopted, when an incomplete frame head is found at the tail of the buffer area, a look-ahead is needed to determine whether the frame head is really the frame head at the tail of the buffer area, so that the reading operation is needed to refresh the buffer area under the condition of the single buffer area, and the data at the tail of the buffer area can not be immediately copied to the temporary buffer area because whether the frame head is the frame head at the tail of the buffer area can not be determined before the refreshing, and the data at the tail of the buffer area needs to be temporarily stored at a certain position and then the frame head determination result is needed to determine whether the data are copied to the temporary buffer area, so that the negative effect that the real-time performance is reduced and the frame head is longer is more obvious.
The normal I/O program cannot use the semaphore/mutex lock to perform read-write protection on the global/shared result data variable/memory due to the real-time requirement, so that the read-write protection is abandoned, which is obviously not preferable.
Disclosure of Invention
The invention provides a double-buffer-area alternate reading and multi-buffer-area circulating temporary storage method, aiming at the problem of data processing in a single-read-write buffer area and a single temporary storage buffer area in the prior art.
The invention adopts the following technical scheme:
a data driving type double-buffer area alternate reading and multi-buffer area circulation temporary storage method comprises the following steps:
step 1: setting a first reading buffer area and a second reading buffer area which are both n bytes in size, and setting three temporary storage buffer areas which are a first temporary storage buffer area, a second temporary storage buffer area and a third temporary storage buffer area respectively;
step 2: reading n bytes of data, putting the data into a first reading buffer area, retrieving m result frames in the first reading buffer area, and circularly writing the m result frames into a first temporary storage buffer area, a second temporary storage buffer area and a third temporary storage buffer area in sequence;
when the data retrieval of the first reading buffer area is finished, reading n bytes of data, placing the data into a second reading buffer area, retrieving the data in the second reading buffer area to obtain p result frames, and circularly and backwards sequentially writing the p result frames into the corresponding temporary storage buffer areas according to the sequence of the temporary storage buffer areas written by the last result frame of the first reading buffer area;
and step 3: when the data retrieval of the second reading buffer area is finished, repeating the step 2;
and 4, step 4: when the result frames are respectively written into the three temporary storage buffer areas, checking the result frames in the temporary storage buffer areas, if the result frames which are just written into the current temporary storage buffer area are found to be damaged, carrying out linear estimation according to the result frame data of the first two temporary storage buffer areas of the current temporary storage buffer area to obtain a new result frame to replace the data in the current temporary storage buffer area, and then enabling the current node pointer to move to the current temporary storage buffer area;
if the result frame just written into the current temporary storage buffer area, the current node pointer is directly made to point to the current temporary storage buffer area.
Preferably, the sizes of the first temporary storage buffer area, the second temporary storage buffer area and the third temporary storage buffer area are all at least 2n bytes.
Preferably, the result frame is less than or equal to 2n bytes.
Preferably, the values of m and p are both (0, 1,2, … …), the frame headers are retrieved in the first read buffer and the second read buffer, and the data between one frame header and the next frame header is retrieved as a result frame.
Preferably, if m is equal to 0 and p is equal to 0, copying and writing all data in the first read buffer into the first temporary buffer, and copying and writing data before the last frame header in the second read buffer into the first temporary buffer, so as to form a complete result frame in the first temporary buffer; after the data in the second reading buffer area is searched, a part of data which does not form a result frame is remained and is called residual data, the residual data is copied and written into the second temporary storage buffer area, then n bytes of data are read and put into the first reading buffer area, the data before the first frame head searched in the first reading buffer area is written into the second temporary storage buffer area, a complete result frame is formed in the second temporary storage buffer area, and the residual other data search result frames in the first reading buffer area are sequentially and circularly written into a third temporary storage buffer area, the first temporary storage buffer area and the second temporary storage buffer area.
Preferably, if m is greater than 0, that is, m is (1, 2, … …), then sequentially and circularly placing m result frames into the first temporary storage buffer, the second temporary storage buffer and the third temporary storage buffer; after the data of the first reading buffer area is searched, a part of data which does not form a result frame is remained to be called residual data, and the residual data is copied and written into a temporary storage buffer area behind the temporary storage buffer area written by the mth result frame; and reading the data of n bytes and putting the data into a second reading buffer area, writing the data before the first frame header retrieved from the second reading buffer area into a temporary storage buffer area which is the same as the rest data to form a complete result frame, and circularly writing the rest other data retrieval result frames in the second reading buffer area into the subsequent temporary storage buffer area in sequence.
The invention has the beneficial effects that:
the method for alternately reading the double buffers and circularly temporarily storing the multiple buffers provided by the invention can deal with the condition that the frame header is not at the initial position of the buffer zone and even the condition that the frame header spans the buffer zone by setting the two reading buffer zones and the three circularly temporarily storing buffer zones, can process the data frame with any length (as long as the length of the data frame is less than the total length of the two reading buffer zones), and only loses the data of the damaged frame when the damaged frame is encountered (the next intact frame is not influenced). In addition, the method utilizes two reading buffer areas to always meet the data requirement of analysis behaviors, and perfectly avoids the problems of real-time performance reduction, performance loss and the like caused by refreshing of a single reading buffer area in the prior art. In addition, the method is different from most reading methods that the data is read first and then analyzed, but the data is read as required in the process of analyzing the data, which is the reason called as a data driving type.
The invention also sets three circulating temporary storage buffer areas, if the result frame just written in the current temporary storage buffer area is damaged, the result frame of the current temporary storage buffer area can be linearly estimated through the data of the two temporary storage buffer areas before the current temporary storage buffer area, a new result frame is obtained to replace the damaged result frame, and the subsequent problem caused by the damage of the result frame is avoided. At the same time, only after the data of the result frame just written in the current temporary buffer area is checked to be correct, the current node pointer is made to point to the current temporary buffer area, so that the control algorithm/logic using the data via the current node pointer can not read the data from a certain node while the I/O thread/process is still writing to the node. This eliminates read and write races from being intangible and the control algorithm/logic will not take out incomplete data. The problem that the integrity of a data frame taken by another thread is defective under the condition that the other thread needing to utilize the data just reads the data from the temporary storage buffer when a program writes the data into the single temporary storage buffer is solved.
Drawings
Fig. 1 is a schematic diagram illustrating the operation of a read buffer according to embodiment 1 of the present invention.
FIG. 2 is a diagram illustrating operations of a temporary buffer according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made with reference to the accompanying drawings:
combine fig. 1 and fig. 2.
Example 1
In this embodiment, n is 5, and m and p are both 0.
A data driving type double-buffer area alternate reading and multi-buffer area circulation temporary storage method comprises the following steps:
step 1: a first reading buffer area and a second reading buffer area which are 5 bytes in size are set up, and three temporary storage buffer areas are set up, namely a first temporary storage buffer area, a second temporary storage buffer area and a third temporary storage buffer area.
The sizes of the first temporary storage buffer area, the second temporary storage buffer area and the third temporary storage buffer area are all at least 10 bytes.
Step 2: the read 5 bytes of data are placed in the first read buffer, and for convenience of illustration, the first header of the initially read 5 bytes of data is located at the start of the first read buffer in this embodiment.
And retrieving the frame headers in the first reading buffer, wherein data from one frame header to the next frame header is a result frame. And sets a result frame to be 10 bytes or less.
In this embodiment, after the data in the first read buffer is retrieved, 0 result frames are retrieved from the first read buffer, and then all the data in the first read buffer is copied and written into the first temporary storage buffer, where a result frame is not formed in the first temporary storage buffer.
And the data of 5 bytes is read again and put into a second read buffer.
On the premise that the result frame is set to be less than or equal to 10 bytes, it indicates that the header of the next frame can be retrieved in the second read buffer, but the header of the next frame is not available.
In this case, the data before a frame header in the second read buffer is copied and written into the first temporary buffer, so that a complete result frame is formed in the first temporary buffer.
If part of data which does not form a result frame is left behind the frame head of the second reading buffer area and is called residual data, copying and writing the residual data into the second temporary storage buffer area.
And step 3: and then reading n bytes of data and placing the data into a first reading buffer area, writing the data before the first frame head retrieved from the first reading buffer area into a second temporary storage buffer area, forming a complete result frame in the second temporary storage buffer area, and sequentially and circularly writing the rest other data retrieval result frames in the first reading buffer area into the subsequent temporary storage buffer areas.
If the result frame crosses the read buffer, the process is the same as the process of step 2 in this embodiment.
And 4, step 4: checking the result frame of the temporary storage buffer area, wherein the process is synchronously performed with the steps 2 and 3, namely, the result frame written into the first temporary storage buffer area is checked immediately after the result frame of the first temporary storage buffer area is complete in the step 2, and if the result frame of the first temporary storage buffer area is normal, the current node pointer points to the first temporary storage buffer area, so that other threads can read data from the first temporary storage buffer area conveniently; if the result frame of the first temporary storage buffer area is damaged, linear estimation is carried out according to the data of the second temporary storage buffer area and the third temporary storage buffer area to obtain a new result frame to replace the result frame of the first temporary storage buffer area. The current node pointer will point to the first staging buffer after the corrupted result frame is replaced.
Similarly, when the result frame of the first buffer is complete, the result frame written into the second buffer is verified, and the process is repeated.
As shown in FIG. 1, A in FIG. 1 is a first read buffer, B is a second read buffer, and the first read buffer and the second read buffer are both 5 bytes in size in this embodiment, so in FIG. 1, A [0] represents the position of the first byte in the first read buffer, A [1] represents the position of the second byte in the first read buffer, A [2] represents the position of the third byte in the first read buffer, A [3] represents the position of the fourth byte in the first read buffer, and A [4] represents the position of the fifth byte in the first read buffer; similarly, in FIG. 1, B [0] represents the position of the first byte in the second read buffer, B [1] represents the position of the second byte in the second read buffer, B [2] represents the position of the third byte in the second read buffer, B [3] represents the position of the fourth byte in the second read buffer, and B [4] represents the position of the fifth byte in the second read buffer.
The linked list nodes with numbers 0 to 9 in fig. 1 represent 10 states of the program during read buffer retrieval. The linked list node with the number 0 points to A [0] representing the location of the first byte in the first read buffer to be retrieved; moving forward from the linked list node with the number 0 to the linked list node with the number 1 to represent to enter the next state, wherein the linked list node with the number 1 points to A [1] to represent that the position of the second byte in the first reading buffer zone is searched; moving forward from the linked list node with number 1 to the module with number 2 to represent the next state, the linked list node with number 2 points to A [2] to represent the position of the third byte in the first read buffer for searching; moving forward from the linked list node with the number 2 to the linked list node with the number 3 to represent to enter the next state, wherein the linked list node with the number 3 points to the position represented by A [3] of the fourth byte in the first reading buffer area for retrieval; moving forward from the linked list node with the number 3 to the linked list node with the number 4 to represent to enter the next state, wherein the linked list node with the number 4 points to A [4] to represent that the position of the fifth byte in the first reading buffer zone is searched; moving forward from the linked list node with the number 4 to the linked list node with the number 5 to represent that the linked list node enters the next state, reading 5 bytes of data and placing the data into a second reading buffer area, wherein the linked list node with the number 5 points to B [0] to represent that the position of the first byte in the second reading buffer area is searched; moving forward from the linked list node with the number 5 to the linked list node with the number 6 to represent the next state, wherein the linked list node with the number 6 points to B [1] to represent the position of the second byte in the second read buffer for retrieval; moving forward from the linked list node with the number 6 to the linked list node with the number 7 to represent the next state, wherein the linked list node with the number 7 points to B [2] to represent the position of the third byte in the second read buffer for retrieval; moving forward from the linked list node with the number 7 to the module with the number 8 to represent the next state, the linked list node with the number 8 points to B [3] to represent the position of the fourth byte in the second read buffer for retrieval; moving forward from the linked list node with the number 8 to the linked list node with the number 9 to represent the next state, wherein the linked list node with the number 9 points to B [4] to represent the position of the fifth byte in the second read buffer for retrieval; moving forward from the linked list node with the number 9 to the linked list node with the number 0 represents entering the next state, at this time, reading 5 bytes of data and placing the data into the first reading buffer, and the subsequent process loops the above operation.
As shown in fig. 2, fig. 2 is a circular linked list of three scratch buffers. Wherein, C is the first temporary storage buffer area, D is the second temporary storage buffer area, and E is the third temporary storage buffer area.
In fig. 2, C points D, D to E, E to C represent the process of three scratch pad buffers to write data in a circular manner; the point C is E, E and the point D represents the process of reading the data of the third buffer area and the second buffer area in reverse direction for linear estimation when the data in the first buffer area is verified to be damaged; similarly, the point D refers to C, C refers to E, which represents the process of reading the data of the first buffer area and the third buffer area in reverse direction for linear estimation when the data in the second buffer area is verified to be damaged; the E point D, D point C represents the process of reading the data of the second temporary buffer and the first temporary buffer in reverse for linear estimation when the data in the third temporary buffer is verified to be corrupted.
Example 2
In this embodiment n is 20, m is 4 and p is 3.
A data driving type double-buffer area alternate reading and multi-buffer area circulation temporary storage method comprises the following steps:
step 1: a first read buffer area and a second read buffer area which are 20 bytes in size are set up, and a first temporary storage buffer area, a second temporary storage buffer area and a third temporary storage buffer area are set up.
The sizes of the first temporary storage buffer area, the second temporary storage buffer area and the third temporary storage buffer area are all at least 40 bytes.
Step 2: the 20 bytes of data are read and placed in the first read buffer, and for convenience of illustration, the first header of the 20 bytes of data read initially in this embodiment is located at the beginning of the first read buffer.
And retrieving the frame headers in the first reading buffer, wherein data from one frame header to the next frame header is a result frame. And sets a result frame to 40 bytes or less.
In this embodiment, after the data in the first read buffer is retrieved, 4 result frames are retrieved from the first read buffer, and the 4 result frames are written into the first temporary storage buffer, the second temporary storage buffer, the third temporary storage buffer, and the first temporary storage buffer.
The above process is actually that the first read buffer retrieves the first result frame and copies and writes the result frame into the first temporary buffer, the first read buffer retrieves the second result frame and copies and writes the result frame into the second temporary buffer, the first read buffer retrieves the third result frame and copies and writes the result frame into the third temporary buffer, and the first read buffer retrieves the fourth result frame and copies and writes the result frame into the first temporary buffer.
Similarly, if a greater number of result frames can be retrieved from the first read buffer, the sequence of writing the result frames into the buffer is cycled through.
Certainly, after the first result frame in the first read buffer is copied and written into the first temporary storage buffer, the following step 4 is performed synchronously, and after the data in the first temporary storage buffer is verified normally in step 4, the subsequent thread will read the data in the first temporary storage buffer, and the writing of the fourth result frame will not be affected.
In this embodiment, after the data in the first read buffer is retrieved, a part of the data that does not form a result frame is left as residual data, and the residual data is copied and written into the second temporary storage buffer.
And the data of the 20 bytes are read again and put into a second read buffer, and 3 result frames are obtained by searching in the second read buffer.
In this embodiment, the data before the first frame header of the data in the second read buffer is to be copied and written into the second temporary buffer, so as to form a complete result frame in the second temporary buffer.
And sequentially writing the 3 result frames of the second reading buffer area into a third temporary storage buffer area, a first temporary storage buffer area and a second temporary storage buffer area.
The above process is actually that the second read buffer copies and writes the result frame into the third temporary buffer when retrieving the first result frame, the second read buffer copies and writes the result frame into the first temporary buffer when retrieving the second result frame, and the second read buffer copies and writes the result frame into the second temporary buffer when retrieving the third result frame.
Similarly, if a greater number of result frames can be retrieved from the second read buffer, the sequence of writing the result frames into the buffer is cycled through.
Of course, after the first result frame in the second read buffer is copied and written into the third temporary storage buffer, the following step 4 is performed synchronously, and after the data in the third temporary storage buffer is verified normally in step 4, the subsequent thread will read the data in the third temporary storage buffer, and the writing of other result frames will not be affected.
If a part of data which does not form a result frame is left in the second reading buffer area and is called residual data, copying and writing the residual data into the third temporary storage buffer area.
And step 3: and reading the data of 20 bytes and putting the data into a first reading buffer area, writing the data before the first frame head retrieved from the first reading buffer area into a third temporary storage buffer area to form a complete result frame in the third temporary storage buffer area, and circularly writing the rest other data retrieval result frames in the first reading buffer area into the subsequent temporary storage buffer areas in sequence.
If the result frame crosses the read buffer, the processing procedure is the same as that of step 2 and step 3 in this embodiment.
And 4, step 4: checking the result frame of the temporary storage buffer area, wherein the process is synchronously performed with the steps 2 and 3, namely, the result frame written into the first temporary storage buffer area is checked immediately after the result frame of the first temporary storage buffer area is complete in the step 2, and if the result frame of the first temporary storage buffer area is normal, the current node pointer points to the first temporary storage buffer area, so that other threads can read data from the first temporary storage buffer area conveniently;
if the result frame of the first temporary storage buffer area is damaged, linear estimation is carried out according to the data of the second temporary storage buffer area and the third temporary storage buffer area to obtain a new result frame to replace the result frame of the first temporary storage buffer area. The current node pointer will point to the first staging buffer after the corrupted result frame is replaced.
It is to be understood that the above description is not intended to limit the present invention, and the present invention is not limited to the above examples, and those skilled in the art may make modifications, alterations, additions or substitutions within the spirit and scope of the present invention.

Claims (6)

1. A data driving type double-buffer area alternate reading and multi-buffer area circulation temporary storage method is characterized by comprising the following steps:
step 1: setting a first reading buffer area and a second reading buffer area which are both n bytes in size, and setting three temporary storage buffer areas which are a first temporary storage buffer area, a second temporary storage buffer area and a third temporary storage buffer area respectively;
step 2: reading n bytes of data, putting the data into a first reading buffer area, retrieving m result frames in the first reading buffer area, and circularly writing the m result frames into a first temporary storage buffer area, a second temporary storage buffer area and a third temporary storage buffer area in sequence;
when the data retrieval of the first reading buffer area is finished, reading n bytes of data, placing the data into a second reading buffer area, retrieving the data in the second reading buffer area to obtain p result frames, and circularly and backwards sequentially writing the p result frames into the corresponding temporary storage buffer areas according to the sequence of the temporary storage buffer areas written by the last result frame of the first reading buffer area;
and step 3: when the data retrieval of the second reading buffer area is finished, repeating the step 2;
and 4, step 4: when the result frames are respectively written into the three temporary storage buffer areas, checking the result frames in the temporary storage buffer areas, if the result frames which are just written into the current temporary storage buffer area are found to be damaged, carrying out linear estimation according to the result frame data of the first two temporary storage buffer areas of the current temporary storage buffer area to obtain a new result frame to replace the data in the current temporary storage buffer area, and then enabling the current node pointer to move to the current temporary storage buffer area;
if the result frame just written into the current temporary storage buffer area, the current node pointer is directly made to point to the current temporary storage buffer area.
2. The method of claim 1, wherein the first, second and third temporary buffers are each at least 2n bytes in size.
3. The method of claim 1, wherein the result frame is less than or equal to 2n bytes.
4. The method as claimed in claim 1, wherein m and p are both (0, 1,2, … …), and the frame headers are retrieved in the first read buffer and the second buffer, and the data retrieved from one frame header to the next frame header is a result frame.
5. The method as claimed in claim 4, wherein if m equals 0 and p equals 0, copying all data in the first read buffer into the first buffer, and copying data before the last frame header in the second read buffer into the first buffer, so as to form a complete result frame in the first buffer; after the data in the second reading buffer area is searched, a part of data which does not form a result frame is remained and is called residual data, the residual data is copied and written into the second temporary storage buffer area, then n bytes of data are read and put into the first reading buffer area, the data before the first frame head searched in the first reading buffer area is written into the second temporary storage buffer area, a complete result frame is formed in the second temporary storage buffer area, and the residual other data search result frames in the first reading buffer area are sequentially and circularly written into a third temporary storage buffer area, the first temporary storage buffer area and the second temporary storage buffer area.
6. The method of claim 4, wherein if m is greater than 0, i.e. m is equal to (1, 2, … …), m result frames are sequentially placed into the first buffer, the second buffer and the third buffer in a circular manner; after the data of the first reading buffer area is searched, a part of data which does not form a result frame is remained to be called residual data, and the residual data is copied and written into a temporary storage buffer area behind the temporary storage buffer area written by the mth result frame; and reading the data of n bytes and putting the data into a second reading buffer area, writing the data before the first frame header retrieved from the second reading buffer area into a temporary storage buffer area which is the same as the rest data to form a complete result frame, and circularly writing the rest other data retrieval result frames in the second reading buffer area into the subsequent temporary storage buffer area in sequence.
CN202111615581.6A 2021-12-28 2021-12-28 Double-buffer-area alternate reading and multi-buffer-area circulating temporary storage method Withdrawn CN113986150A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111615581.6A CN113986150A (en) 2021-12-28 2021-12-28 Double-buffer-area alternate reading and multi-buffer-area circulating temporary storage method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111615581.6A CN113986150A (en) 2021-12-28 2021-12-28 Double-buffer-area alternate reading and multi-buffer-area circulating temporary storage method

Publications (1)

Publication Number Publication Date
CN113986150A true CN113986150A (en) 2022-01-28

Family

ID=79734596

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111615581.6A Withdrawn CN113986150A (en) 2021-12-28 2021-12-28 Double-buffer-area alternate reading and multi-buffer-area circulating temporary storage method

Country Status (1)

Country Link
CN (1) CN113986150A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1629806A (en) * 2003-12-16 2005-06-22 英业达股份有限公司 System and method for updating BIOS via buffer area
CN105426112A (en) * 2014-08-28 2016-03-23 广明光电股份有限公司 Method for dynamically adjusting high-speed buffer area by solid state drive
US20170242628A1 (en) * 2015-06-26 2017-08-24 Intel Corporation Hardware apparatuses and methods for distributed durable and atomic transactions in non-volatile memory
US20170308296A1 (en) * 2016-04-22 2017-10-26 Hewlett Packard Enterprise Development Lp Staging write requests

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1629806A (en) * 2003-12-16 2005-06-22 英业达股份有限公司 System and method for updating BIOS via buffer area
CN105426112A (en) * 2014-08-28 2016-03-23 广明光电股份有限公司 Method for dynamically adjusting high-speed buffer area by solid state drive
US20170242628A1 (en) * 2015-06-26 2017-08-24 Intel Corporation Hardware apparatuses and methods for distributed durable and atomic transactions in non-volatile memory
US20170308296A1 (en) * 2016-04-22 2017-10-26 Hewlett Packard Enterprise Development Lp Staging write requests

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CJRCL: ""一种数据驱动型双缓冲区交替读取及多缓冲区循环暂存算法(应用于串口读取及暂存陀螺仪数据)"", 《知乎 HTTPS://ZHUANLAN.ZHIHU.COM/P/417400286》 *

Similar Documents

Publication Publication Date Title
US4694454A (en) Dynamic memory diagnosis and error correction apparatus
US20090089631A1 (en) Memory diagnosis apparatus
US6112319A (en) Method and system for verifying the accuracy of stored data
EP1206739B1 (en) Methods and apparatus for correcting soft errors in digital data
US6578138B1 (en) System and method for unrolling loops in a trace cache
US20140195867A1 (en) Memory testing with selective use of an error correction code decoder
KR20110114432A (en) Method and system for detecting deadlock in multithread program
CN112148221B (en) Method, device, equipment and storage medium for inspecting redundant array of inexpensive disks
US20140164724A1 (en) Method and apparatus for processing system command during memory backup
CN102243884B (en) Method for storing streaming media data and apparatus thereof
CN113986150A (en) Double-buffer-area alternate reading and multi-buffer-area circulating temporary storage method
CN106484618A (en) A kind of based on memory access rely on to parallel playback method and device
DE102022208557A1 (en) METHOD FOR DEBUG CHECKING AND CLEANING OPERATION AND SEMICONDUCTOR SYSTEM USING THE SAME
CN110555056B (en) Time scale instruction sequence management method based on double ring buffer
JPS62245348A (en) Method and device for updating data base
US20060236185A1 (en) Multiple function results using single pattern and method
US20150113244A1 (en) Concurrently accessing memory
US5146458A (en) Data transfer checking system
CN117037884B (en) Fuse unit used in memory array, processing method thereof and memory array
US11817169B2 (en) Memory, memory system and operation method of memory system
KR100421316B1 (en) An Event Selection Algorithm for Two-pass On-the-fly Detection of the First Races in Parallel Programs with Synchronization
JPH11219293A (en) Address tracing method and tracer memory controller
KR100328818B1 (en) How to save data in flash memory
Nicolaidis et al. Transparent BIST for ECC-based memory repair
JPH0644238B2 (en) Instruction re-execution control method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20220128

WW01 Invention patent application withdrawn after publication