A Sampling Message Management Method for a Dual-Buffer Unit

By locking and unlocking the buffer unit during read and write operations, the problem of read and write errors in the double buffer unit structure is solved, and the reliability of the system is improved.

CN114443312BActive Publication Date: 2025-07-04XIAN AVIATION COMPUTING TECH RES INST OF AVIATION IND CORP OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111636745.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-07-04
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

In the existing sampling message management method, the double buffer unit structure has the problem of reading and writing operations on the same buffer unit, resulting in data reading and writing errors and low system reliability.

Method used

During read or write operations, the operated buffer unit is locked and unlocked after the operation is completed to ensure the atomicity of the read and write operations and avoid the read and write operations of the same buffer unit.

Benefits of technology

Through the locking and unlocking mechanism, the atomicity of the sampled messages to the buffer unit's read and write operations is ensured, and the reliability of the system is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114443312B_ABST
    Figure CN114443312B_ABST
Patent Text Reader

Abstract

The present invention provides a method for managing sampled messages of a double-buffer unit, including: (1) transparently managing the sampled messages using the double-buffer unit, so that when the reading end and the writing end perform read and write operations, they obtain the buffer unit addresses for their read and write operations from the buffer management unit; (2) locking the buffer unit being operated on during the read or write operation to prevent the operation from being interrupted; (3) unlocking the buffer unit being operated on when the read or write operation is completed. By the method of the present invention, the problem that there may be two operations of reading and writing the same buffer unit for the sampled messages is solved, the atomicity of the read and write operations of the sampled messages to the buffer unit is ensured, and the reliability of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of network communication technologies, and in particular, to a method for managing sampled messages of a dual-buffer unit. Background Art

[0002] With the development of information technology, the development of avionics systems has been strengthened, which has become the core of current mature aircraft construction and will play an important role in subsequent generations of aircraft. Especially in civil aircraft, the safety and reliability of avionics systems play a key role in the significant development of flight safety and play an important role in providing passengers with a safe journey.

[0003] According to the ARINC653 protocol, from the perspective of avionics partitions, the end system should provide sampling services between partitions. In the sampling mode, messages can be sent at any time without queuing; when receiving messages, as long as a message arrives, regardless of whether the previous received message has been read, it will be overwritten. Therefore, it can be ensured that the received message is the latest. When managing sampled messages, after reading and writing are completed, it is necessary to exchange the read and write pointers so that reading and writing point to other buffer unit numbers; when one party's operation is completed, the completed party will exchange the pointers and operate on the other buffer unit. If the other party's operation is not completed, at this time, reading and writing will operate on the same buffer unit, resulting in data reading and writing errors.

[0004] Therefore, in the current method for managing sampled messages, there is a problem that the dual-buffer unit structure of sampled messages performs two operations of reading and writing on the same buffer unit, resulting in data reading and writing errors and low system reliability. Summary of the Invention

[0005] In view of this, the embodiments of the present disclosure provide a method for managing sampled messages of a dual-buffer unit. When reading or writing, the buffer unit being operated is locked, and unlocked after the operation is completed, ensuring the atomicity of the read and write operations of the sampled messages on the buffer unit, avoiding the problem of performing two operations of reading and writing on the same buffer unit during the reading and writing process of the sampled messages, ensuring the atomicity of the read and write operations of the sampled messages on the buffer unit, and improving the reliability of the system.

[0006] To achieve the above object, the present invention provides the following technical solutions:

[0007] A method for managing sampled messages of a dual-buffer unit includes the following steps:

[0008] (1) Transparently manage the sampled messages using a dual-buffer unit, so that when the reading end and the writing end perform reading and writing operations, they obtain the read and write buffer unit addresses from the buffer management unit;

[0009] (2) During a read or write operation, lock the buffer unit being operated on to prevent the operation from being interrupted;

[0010] (3) When the read or write operation is completed, unlock the buffer unit being operated on.

[0011] Furthermore, in step (2), the process of locking the buffer unit being operated on includes: when reading, first obtain the read buffer unit address from the buffer management unit, and set the read status rlock of this buffer unit address to 1.

[0012] Furthermore, in step (3), the process of unlocking the buffer unit being operated on includes: when reading, after the data reading is completed, set the read status rlock to 0, and at the same time update the refresh flag, and judge whether the write status wlock of the write buffer unit is 0, whether the write length is 0, and whether the refresh flag is 1. If the write status wlock is 0, the write length is non - zero, and the refresh flag is 1, then exchange the read and write buffer unit address values; otherwise, end the operation to complete the unlocking.

[0013] Furthermore, in step (2), the process of locking the buffer unit being operated on also includes: when writing, first obtain the write buffer unit address from the buffer management unit, and set the write status wlock of this buffer unit address to 1.

[0014] Furthermore, in step (3), the process of unlocking the buffer unit being operated on includes: when writing, after the data writing is completed, set the write status wlock to 0, and at the same time update the refresh flag and the write length, and judge whether the read status rlock of the read buffer unit is 0. If the read status rlock is 0, then exchange the read and write buffer unit address values; otherwise, end the operation to complete the unlocking.

[0015] Furthermore, when performing a read operation, after new data is written to the write buffer unit, then exchange the read buffer unit address value and the write buffer unit address value to read the new data; otherwise, do not exchange the pointers, and the read buffer unit repeats reading the old data until the pointers are exchanged.

[0016] Furthermore, the buffer management unit preferentially responds to the write - end operation and updates the internal state.

[0017] A sampling message management method for a dual - buffer unit of the present invention effectively avoids the problem of performing both read and write operations on the same buffer unit during the reading and writing process of sampling messages, ensures the atomicity of the read and write operations of sampling messages on the buffer unit, and thus improves the reliability of the entire system. Description of the Drawings

[0018] To more clearly illustrate the technical solutions of the embodiments of the present disclosure, the accompanying drawings required for the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present disclosure. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0019] Figure 1 Schematic diagram of sampling message management of the double-buffer unit in the embodiment of the present invention;

[0020] Figure 2 Schematic diagram of the operation method of the write end W in the embodiment of the present invention;

[0021] Figure 3 Schematic diagram of the operation method of the read end R in the embodiment of the present invention. Detailed implementation manners

[0022] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0023] The following uses specific specific examples to illustrate the implementation manners of the present disclosure. Those skilled in the art can easily understand other advantages and effects of the present disclosure from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. The present disclosure can also be implemented or applied through other different specific implementation manners. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that, without conflict, the following embodiments and the features in the embodiments can be combined with each other. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present disclosure without creative efforts belong to the scope of protection of the present disclosure.

[0024] It should be noted that the following describes various aspects of the embodiments within the scope of the appended claims. It should be obvious that the aspects described herein can be embodied in a wide variety of forms, and any specific structure and / or function described herein is illustrative only. Based on the present disclosure, those skilled in the art should understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects described herein can be used to implement the device and / or practice the method. In addition, this device can be implemented and this method can be practiced using other structures and / or functions in addition to one or more of the aspects described herein.

[0025] It should also be noted that the diagrams provided in the following embodiments only illustrate the basic concept of the present disclosure schematically. The diagrams only show the components related to the present disclosure, rather than being drawn according to the number, shape, and size of the components in actual implementation. The type, quantity, and ratio of each component in actual implementation can be arbitrarily changed, and the component layout type may also be more complex.

[0026] In addition, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, those skilled in the art will understand that the described aspects can be practiced without these specific details.

[0027] An embodiment of the present disclosure provides a method for managing sampling messages of a double buffer unit, including the following steps:

[0028] (1) Use the double buffer unit to transparently manage the sampling messages, so that when the reading end and the writing end perform read and write operations, they obtain the read and write buffer unit addresses from the buffer management unit.

[0029] The sampling double buffer unit uses a transparent management method. When the reading end and the writing end operate on the buffer unit, they uniformly use one address, and the buffer management unit points to the buffer unit indicated by its corresponding pointer; the sampling messages are stored and managed using the double buffer unit, and there is a writing end W and a reading end R outside.

[0030] (2) When performing a read or write operation, lock the buffer unit being operated on to prevent the operation from being interrupted.

[0031] (3) When the read or write operation is completed, unlock the buffer unit being operated on.

[0032] In the above steps, the process of locking the buffer unit being operated on includes: when reading, first obtain the read buffer unit address from the buffer management unit, and set the read status rlock of this buffer unit address to 1. The process of unlocking the buffer unit being operated on includes: when reading, after the data is read, set the read status rlock to 0, and at the same time update the refresh flag, and judge whether the write status wlock of the write buffer unit is 0, whether the write length is 0, and whether the refresh flag is 1. If the write status wlock is 0, the write length is non-zero, and the refresh flag is 1, then exchange the read and write buffer unit address values, otherwise, end the operation and complete the unlocking.

[0033] In the above steps, the process of locking the buffer unit being operated includes: when writing, first obtain the address of the write buffer unit from the buffer management unit, and set the write status wlock of this buffer unit address to 1. The process of unlocking the buffer unit being operated includes: when writing, after the data writing is completed, set the write status wlock to 0, and at the same time update the refresh flag and the write length, and determine whether the read status rlock of the read buffer unit is 0. If the read status rlock is 0, then exchange the read and write buffer unit address values; otherwise, end the operation and complete the unlocking.

[0034] Specifically, the internal state of the buffer unit has a write pointer wp = 0, a read pointer rp = 1, a write lock signal wlock = 0, a read lock signal rlock = 0, the status new[0] of buffer unit 0 and the status new[1] of buffer unit 1, and data lengths Len[0] and Len[1].

[0035] The specific steps of the operation method of the write end W are as follows:

[0036] (1) When the W end reads and writes the pointer, the management unit returns wp and automatically sets wlock = 1;

[0037] (2) The W end writes data to the buffer unit indicated by wp;

[0038] (3) After the data writing is completed, the W end clears wlock = 0, and the management unit automatically sets new[wp] = 1 and Len[wp] = len;

[0039] (4) At the same time as the above step: if rlock = 0, then exchange the values of wp and rp; otherwise, end the operation.

[0040] The specific steps of the operation method of the read end R are as follows:

[0041] (1) When the R end reads the read pointer, the management unit returns rp and automatically sets rlock = 1;

[0042] (2) The R end reads data from the buffer unit indicated by rp;

[0043] (3) After the data reading is completed, the R end clears rlock = 0, and the management unit automatically clears new[rp] = 0;

[0044] (4) At the same time as the above step: if Len[wp]!= 0, and wlock = 0 and new[wp] = 1, then exchange the values of wp and rp; otherwise, end the operation.

[0045] In the above steps, when the operations of the write end W and the read end R occur simultaneously, the management unit preferentially responds to the operation of the write end W to update the internal state.

[0046] Next, the present invention will be further described with reference to the attached Figures 1-3 drawings.

[0047] The sampling message management method of the double-buffer unit in this embodiment includes the following steps:

[0048] Step 1: As Figure 1 shown, the sampling message is stored and managed using a double-buffer unit, and different buffer units are used for read and write operations;

[0049] Step 2: There are a write end W and a read end R outside the sampling message management function; when the W end and the R end operate on the buffer unit, a unified address is used, and the buffer management unit points to the buffer unit indicated by its corresponding pointer;

[0050] Step 3: The internal states of the sampling message management function are write pointer wp = 0, read pointer rp = 1, write lock signal wlock = 0, read lock signal rlock = 0, the state of buffer unit 0 new[0] and the state of buffer unit 1 new[1], data lengths Len[0] and Len[1];

[0051] Step 4: As Figure 2 shown, the W operation requires the following steps:

[0052] (1) When the W end reads and writes the pointer, the management unit returns the wp pointer;

[0053] (2) The W end sets wlock = 1;

[0054] (3) The W end writes data to the buffer unit indicated by wp;

[0055] (4) After the data writing is completed, the W end clears wlock = 0, and the management unit automatically sets new[wp] = 1 and Len[wp] = len;

[0056] (5) At the same time as the above step: judge whether the R end rlock is equal to 0, if so, jump to step (6); otherwise, jump to step (7);

[0057] (6) Exchange the values of wp and rp;

[0058] (7) End the operation.

[0059] Step 5: As Figure 3 shown, the R operation requires the following steps:

[0060] (1) When the R end reads the read pointer, the management unit returns the rp pointer;

[0061] (2) The R end automatically sets rlock = 1;

[0062] (3) The R end reads data from the buffer unit indicated by rp;

[0063] (3) After completing the data readout, the R end clears rlock = 0, and the management unit automatically clears new[rp] = 0;

[0064] (4) Process simultaneously with the previous step: Determine whether Len[wp] at the W end is 0. If so, jump to step (8); otherwise, jump to step (5);

[0065] (5) Process simultaneously with the previous step: Determine whether wlock = 0 at the W end is 0. If so, jump to step (8); otherwise, jump to step (6);

[0066] (6) Process simultaneously with the previous step: Determine whether new[wp] at the W end is 1. If so, jump to step (7); otherwise, jump to step (8);

[0067] (7) Exchange the values of wp and rp;

[0068] (8) End the operation.

[0069] Step 6. When performing the operation at the R end, only when new data is written to the wp buffer unit, exchange the values of rp and wp and read the new data; otherwise, do not exchange the pointers, and rp repeatedly reads the old data until the pointers are exchanged;

[0070] Step 7. When the W operation and the R operation are performed simultaneously, the management unit preferentially responds to the W end operation to update the internal state.

[0071] The above is only the specific implementation manner of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present disclosure should be covered by the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A sampling message management method for a double-buffer unit, characterized in that: It includes the following steps: (1) Use a double-buffer unit to transparently manage the sampled messages, so that when the reading end and the writing end perform read and write operations, they obtain the read and write buffer unit addresses from the buffer management unit; (2) When performing a read or write operation, lock the buffer unit being operated on to prevent the operation from being interrupted; (3) When the read or write operation is completed, unlock the buffer unit being operated on; In step (2), the process of locking the buffer unit being operated on includes: when reading, first obtain the read buffer unit address from the buffer management unit, and set the read status rlock of this buffer unit address to 1; In step (3), the process of unlocking the buffer unit being operated on includes: when reading, after the data is read, set the read status rlock to 0, and at the same time update the refresh flag, and judge whether the write status wlock of the write buffer unit is 0, whether the write length is 0, and whether the refresh flag is 1. If the write status wlock is 0, the write length is non-zero, and the refresh flag is 1, then exchange the read and write buffer unit address values; otherwise, end the operation and complete the unlocking; In step (2), the process of locking the buffer unit being operated on also includes: when writing, first obtain the write buffer unit address from the buffer management unit, and set the write status wlock of this buffer unit address to 1; In step (3), the process of unlocking the buffer unit being operated on includes: when writing, after the data is written, set the write status wlock to 0, and at the same time update the refresh flag and the write length, and judge whether the read status rlock of the read buffer unit is 0. If the read status rlock is 0, then exchange the read and write buffer unit address values; otherwise, end the operation and complete the unlocking.

2. The sampling message management method of the double-buffer unit according to claim 1, characterized in that: When performing a read operation, only when new data is written to the write buffer unit, exchange the read buffer unit address value and the write buffer unit address value, and read the new data; otherwise, do not exchange the pointers, and the read buffer unit repeatedly reads the old data until the pointers are exchanged.

3. The sampling message management method of the double buffer unit according to claim 1, characterized in that: The buffer management unit preferentially responds to the operations of the writing end and updates the internal state.

Citation Information

Patent Citations

  • Efficient sampling port buffer management method

    CN104679667A

  • Data-caching access method and data-caching controller

    CN105183665A