Systems and methods for data synchronization

By using a looping and clamping mechanism of producer and consumer loop indicators in embedded systems, the complexity of buffer state determination and deadlock problems are solved, achieving efficient and reliable data synchronization and improving system performance and resource utilization.

CN122374823APending Publication Date: 2026-07-10
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Filing Date
2025-04-03
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

In embedded systems, traditional solutions for efficiently determining whether a shared circular buffer is full or empty to enable parallel processing suffer from deadlock, priority inversion, low resource efficiency, high complexity, and poor scalability, especially with large buffers.

Method used

By using producer circle indicators and consumer circle indicators, combined with circling and clamping mechanisms, the buffer state is determined, and data synchronization is initiated when the buffer is full or empty, thus avoiding locking mechanisms and hardware dependencies and achieving wait-free parallel processing.

Benefits of technology

It improves buffer utilization, avoids deadlock and priority inversion, simplifies system management, increases system throughput and real-time performance, and is suitable for resource-constrained embedded systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122374823A_ABST
    Figure CN122374823A_ABST
Patent Text Reader

Abstract

Embodiments describe a data synchronization mechanism, focusing on efficient management of a circular buffer between producer and consumer processes. In one embodiment, a method uses a round-robin technique to facilitate parallel processing without requiring locking mechanisms, ensuring continuous data flow and real-time responsiveness. Furthermore, the method uses a pinning technique to record the state of the buffer before a round is converted to accurately determine buffer fullness, without ambiguity even if the producer and consumer pointers coincide. Additionally, a reset technique enables the system to mitigate loss of production entries by allowing the producer to overwrite outdated data when the buffer is full while the consumer lags behind. The mechanism is hardware-agnostic, operating system-agnostic, and can be implemented across a variety of programming languages, making it highly adaptable for a wide range of applications in computing systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to data storage systems, and more specifically, to computer-implemented systems and methods for data synchronization. Background Technology

[0002] Embedded systems are specialized computing systems designed to perform dedicated functions or manage specific tasks within large systems. Unlike general-purpose computers that can run a wide variety of applications, embedded systems are optimized for efficiency and reliability for their target applications. They are integral parts of a wide range of devices, from simple household appliances like microwave ovens and washing machines to complex systems such as automotive control systems, medical devices, and industrial machines.

[0003] In embedded systems, buffers play a crucial role in managing data flow between different components or systems. A buffer is a temporary storage area used to hold data as it moves from one place to another, ensuring smooth and efficient data processing. This is especially important in embedded systems because data must often be processed in real time, or the system is connected to external devices operating at different speeds.

[0004] There are various types of buffers, including but not limited to circular buffers, direct memory access (DMA) buffers, and input / output (I / O) buffers. Circular buffers are commonly used in embedded systems because they are efficient when data is generated and consumed at different rates. Circular buffers are particularly useful in serial communication and streaming data applications. DMA buffers are used in situations where data needs to be transferred between peripheral devices and memory without continuous processor intervention, thus improving system performance. I / O buffers are used to balance the data flow between the system's core logic and its input / output interfaces, which is crucial for ensuring responsive and reliable system operation.

[0005] In embedded systems, effective buffer management is crucial for preventing data loss, avoiding buffer overflows, and ensuring timely data processing. This includes techniques for determining when a buffer is full or empty, managing read / write pointers, and handling buffer resets or overwrites when real-time data processing is critical. Buffers in these systems are essential for managing data flow, ensuring that embedded systems meet their real-time performance and reliability requirements.

[0006] A fundamental challenge in computing and embedded systems is efficiently determining whether a shared circular buffer is full or empty in order to enable parallel processing without complex, inefficient, or hardware-dependent solutions. This challenge highlights the difficulty of ensuring that producer entities do not overwrite data in buffers that consumer entities have not yet read, and conversely, that consumer entities do not read the same data multiple times or attempt to read data from an empty buffer. This state must be reliably determined even during context switches and variable updates. This challenge, often referred to as the producer-consumer problem, has existed in the field of computing since its early days, and various approaches have attempted to solve it, each with its limitations.

[0007] Traditional solutions either involve locking mechanisms, forcing producer and consumer business entities to operate sequentially, or lock-free mechanisms, relying on specific hardware features or involving data replication to maintain atomicity. In traditional systems, achieving parallel processing often means sacrificing buffer slots to clearly divide the full or empty state of the buffer, which may not always be feasible, especially with large buffers.

[0008] In locking mechanisms, mutexes are used to prevent multiple threads from accessing shared resources (such as buffers) simultaneously. While mutexes effectively prevent data corruption, they can lead to deadlocks, where two processes are waiting for the other to release its lock. Semaphores, on the other hand, are used to allow a limited number of threads to access resources concurrently. However, semaphores still introduce overhead and complexity, can lead to priority inversion, and are prone to semaphore leaks, where threads fail to release the semaphore, resulting in blocking.

[0009] Some traditional solutions are implemented using critical sections—parts of the code that cannot be executed concurrently by multiple threads or processes. Managing access to critical sections requires careful design to avoid deadlocks and ensure no thread resource shortages. This management often involves complex algorithms and significant overhead, especially in systems with many concurrent threads.

[0010] Some traditional solutions use busy waiting or polling mechanisms to continuously check the state of the buffer. This approach is resource-intensive and inefficient because it involves repeatedly executing loops until the condition changes, consuming valuable processor time available for other tasks. Busy waiting is often due to the mutual exclusion of critical segments.

[0011] Single-threaded approaches simplify buffer management by avoiding concurrent access issues, but at the cost of significantly reduced system throughput. Blocking solutions, where either the producer or consumer business entity waits for an entry to be deleted or added, can lead to deadlocks, priority inversion, underutilization of system resources, and increased latency.

[0012] Given the above, the problems with traditional solutions include resource efficiency, complexity, real-time performance, and scalability. Many traditional solutions require additional resources, such as memory for semaphore variables or CPU cycles for busy waiting, which can be prohibitive in resource-constrained embedded systems. Implementing and maintaining solutions involving locks, semaphores, or critical components significantly increases the complexity of embedded software, making it more difficult to debug and verify. Ensuring real-time performance using traditional solutions can be challenging, especially in systems with strict time constraints. The overhead of synchronization mechanisms can lead to missed deadlines. As the number of concurrent threads increases, managing access to shared resources becomes more complex and error-prone, impacting the scalability of traditional solutions.

[0013] Therefore, based on the above, there is a technical need for improved, efficient, and reliable computer-implemented data synchronization systems and methods, especially for circular buffers. Summary of the Invention

[0014] In one aspect, this disclosure relates to a system for data synchronization, including a processor and a memory operatively coupled to the processor, the memory including processor-executable instructions that, when executed, cause the processor to determine a producer lap indicator associated with a producer business entity corresponding to a buffer, determine a consumer lap indicator associated with a consumer business entity, determine the state of the buffer based on the producer lap indicator and the consumer lap indicator, and, in response to the determination that the state of the buffer is full or empty, enable data synchronization by initiating lapping and / or paperclipping at the buffer.

[0015] In one embodiment, in order to initiate clamping, the processor can be configured to record the producer clamping indicator and the consumer clamping indicator before the corresponding producer loop indicator and consumer loop indicator associated with the producer business entity and the consumer business entity change, and determine the state of the buffer based on the producer clamping indicator and the consumer clamping indicator.

[0016] In one embodiment, to initiate looping, the processor can be configured to determine the position of the in-pointer associated with the producer business entity and corresponding to the buffer, and the position of the out-pointer associated with the consumer business entity. The state of the buffer is further determined based on the positions of the in-pointer and out-pointer. In response to the buffer being full, the producer business entity is restricted from writing data to the buffer, or the consumer business entity is restricted from reading data from the buffer, until an entry is deleted or added respectively within a predetermined duration. In response to the buffer being empty, the position allows the producer business entity to write data to the buffer. The in-pointer in the buffer or the consumer business entity reads data from the position of the out-pointer in the buffer.

[0017] In one embodiment, the processor can be configured to initiate clamping based on the position of the write pointer, where the loop change occurs, being the same as the position of the output pointer.

[0018] In one embodiment, in response to a full buffer state, the processor can be configured to set the producer flag associated with the producer business entity to 1, indicating that the buffer is full.

[0019] In one embodiment, the processor may also be configured to reset the positions of the consumer circle indicator and the output pointer to 0, and set the consumer flag associated with the consumer business entity to 1.

[0020] In one embodiment, the processor can also be configured to reset the producer circle indicator and write pointer positions to 0 based on the consumer flag being set to 1, and reset the producer flag to 0.

[0021] In one embodiment, the processor may also be configured to set the consumer flag associated with the consumer business entity, the position of the output pointer, the consumer circle indicator, and the consumer clamp indicator to be equal to the corresponding producer flag, the position of the write pointer, the producer circle indicator, and the producer clamp indicator, and restrict the producer business entity from writing data until the consumer flag is 0.

[0022] In one embodiment, the buffer can be empty when the producer circle indicator and the consumer circle indicator are equal and / or the write pointer position is equal to the output pointer position, and the buffer can be full when the producer circle indicator and the consumer circle indicator are not equal.

[0023] In another aspect, this disclosure relates to a method for data synchronization, comprising: a processor determining a producer loop indicator associated with a producer business entity corresponding to a buffer; the processor determining a consumer loop indicator associated with the producer loop indicator and the consumer loop indicator; the processor determining the state of the buffer based on the producer loop indicator and the consumer loop indicator; and, in response to determining that the buffer state is full or empty, the processor implementing data synchronization based on initiating looping and / or clamping in the buffer.

[0024] In one embodiment, to initiate clamping, the method may include having the processor record the producer clamping indicator and the consumer clamping indicator before the corresponding producer loop indicator and consumer loop indicator associated with the producer business entity and the consumer business entity change, and having the processor further determine the state of the buffer based on the producer clamping indicator and the consumer loop indicator.

[0025] In one embodiment, to initiate overlap, the method may include having the processor determine the position of a write pointer associated with a buffer corresponding to a producer business entity, and having the processor determine the position of an output pointer associated with a consumer business entity. In response to a full buffer state, the processor further determines the state of the buffer based on the positions of the write pointer and the output pointer. For a predetermined duration, the processor restricts the producer business entity from writing data to the buffer, or restricts the consumer business entity from reading data from the buffer, until an entry is deleted or added, respectively. If empty, the processor enables the producer business entity to write data to the buffer at the write pointer position, or enables the consumer business entity to read data from the buffer at the overlapping output pointer position.

[0026] In one embodiment, clamping can be initiated based on the position of the write pointer being the same as the position of the output pointer.

[0027] In one embodiment, in response to a buffer full state, the method may include the processor setting a producer flag associated with the producer business entity to 1, indicating that the buffer is full.

[0028] In one embodiment, the method may include resetting the positions of the consumer circle indicator and the output pointer to 0 by the processor, and setting the consumer flag associated with the consumer business entity to 1 by the processor.

[0029] In one embodiment, the method may include resetting the positions of the producer circle indicator and the write pointer to 0 by the processor based on the consumer flag being set to 1, and resetting the producer flag to 0 based on the producer flag being set to 0.

[0030] In one embodiment, the method may include the processor setting the consumer flag, output pointer position, consumer circle indicator, and consumer clamp indicator associated with the consumer business entity to be equal to the corresponding producer flag, write pointer position, producer circle indicator, and producer clamp indicator, and the processor restricting the producer business entity from writing data until the consumer flag is 0.

[0031] In one embodiment, the buffer can be empty when the producer circle indicator and the consumer circle indicator are equal and / or the write pointer position is equal to the output pointer position, and the buffer can be full when the producer circle indicator and the consumer circle indicator are not equal.

[0032] In another aspect, this disclosure relates to a non-transient computer-readable medium comprising executable instructions that cause a processor to determine a producer circle indicator associated with a producer business entity corresponding to a buffer, determine a consumer circle indicator associated with a consumer business entity, determine the state of the buffer based on the producer circle indicator and the consumer circle indicator, and, in response to the determination that the state of the buffer is full or empty, enable data synchronization based on initiating looping and / or clamping at the buffer. Attached Figure Description

[0033] The following detailed description of illustrative embodiments can be better understood when read in conjunction with the accompanying drawings. Exemplary constructions of this disclosure are shown in the drawings to illustrate the present disclosure. However, this disclosure is not limited to the specific devices, tools, and apparatuses disclosed herein. Furthermore, those skilled in the art will understand that the drawings are not drawn to scale.

[0034] Figure 1 An example representation of a network architecture according to embodiments of the present disclosure is shown;

[0035] Figure 2 This is a simplified block diagram of a server for facilitating data synchronization according to embodiments of the present disclosure;

[0036] Figure 3 A flowchart of an example method for multi-buffer looping according to embodiments of the present disclosure is shown;

[0037] Figure 4 A flowchart of an example method for looping around a single buffer according to an embodiment of the present disclosure is shown;

[0038] Figure 5 A flowchart illustrating an example method for implementing loop reset according to embodiments of the present disclosure is shown; and

[0039] Figure 6Example computer systems of various embodiments of the present disclosure are shown that can be used in or with, according to embodiments of the present disclosure.

[0040] Unless otherwise specified, the figures referenced in this specification should not be construed as being drawn to scale, and are merely illustrative in nature. Detailed Implementation

[0041] In the following description, numerous specific details are set forth for purposes of explanation, in order to provide a thorough understanding of this disclosure. However, it will be apparent to those skilled in the art that this disclosure may be practiced without these specific details. Descriptions of well-known components and processing techniques have been omitted so as not to unnecessarily obscure the embodiments herein. The examples used herein are intended only to facilitate an understanding of how the embodiments herein are practiced and to further enable those skilled in the art to practice the embodiments herein. Therefore, these examples should not be construed as limiting the scope of the embodiments herein.

[0042] In this specification, references to "an embodiment" or "embodiment" mean that a particular feature, structure, or characteristic described in connection with that embodiment is included in at least one implementation of this disclosure. The phrase "in an embodiment" appearing in various places in the specification does not necessarily refer to the same embodiment, nor is it necessarily a separate or alternative embodiment that is mutually exclusive with other embodiments. Furthermore, various features that some embodiments may exhibit but not others are described. Similarly, various requirements are described that may be required in some embodiments but not in others.

[0043] Furthermore, although the following description contains numerous details for illustrative purposes, those skilled in the art will understand that many variations and / or modifications to these details are within the scope of this disclosure. Similarly, although many features of this disclosure are described by way of each other or in combination with each other, those skilled in the art will understand that many of these features may be provided independently of the others. Therefore, the description of this disclosure is set forth without losing its generality or imposing any limitation on it.

[0044] The various examples disclosed herein provide systems and methods for computer-implemented data synchronization.

[0045] The following is for reference Figures 1 to 6 Various embodiments of the present invention are described.

[0046] Figure 1 An example representation of a network architecture 100 according to an embodiment of the present disclosure is shown. While the network architecture 100 is presented in one arrangement, other embodiments may include portions (or other parts) of the network architecture 100 that are otherwise arranged, for example, to facilitate data synchronization.

[0047] Network architecture 100 typically includes server 102 (which may be interchangeably referred to as "system 102") and one or more clients (106(1)...106(N)). It should be noted that, for ease of reference, one or more clients (106(1)...106(N)) may be collectively referred to as client 106, and individually as client 106. Client 106 and server 102 are coupled to and communicate with (and / or access) network 104. In some embodiments, each client 106 sends requests to server 102 via network 104 and receives responses from server 102. In some embodiments, client 106 may generate and / or consume data.

[0048] In some embodiments, network 104 may include, but is not limited to, optical fidelity (Li-Fi) networks, local area networks (LANs), wide area networks (WANs), metropolitan area networks (MANs), satellite networks, the Internet, fiber optic networks, coaxial cable networks, infrared (IR) networks, radio frequency (RF) networks, virtual networks, and / or be able to support Figure 1 Another suitable public and / or private network, or any combination thereof, for communication between the business entities shown.

[0049] Various service entities in network architecture 100 can connect to network 104 according to various wired and wireless communication protocols, such as Transmission Control Protocol and Internet Protocol (TCP / IP), User Datagram Protocol (UDP), second-generation (2G), third-generation (3G), fourth-generation (4G), fifth-generation (5G) communication protocols, Long Term Evolution (LTE) communication protocols, or any combination thereof. For example, network 104 may include multiple different networks, such as a private network accessible by client 106, and a public network (e.g., the Internet) through which client 106 and server 102 can communicate.

[0050] refer to Figure 1 Server 102 can act as a central hub, processing requests from client 106 and facilitating data exchange between producer business entity 108 and consumer business entity 110. According to embodiments of this disclosure, server 102 can effectively synchronize data exchange, ensuring that buffers managed by server 102 are used accurately and efficiently. Those skilled in the art will understand that a buffer can refer to a physical storage area used to temporarily store data as it moves from one place to another. In some embodiments, server 102 can be deployed as a standalone server or implemented as Software as a Service (SaaS) in the cloud. Server 102 is embodied in at least one computing device communicating with network 104 and / or embodied in at least one non-transient computer-readable medium.

[0051] The producer-consumer problem exists around circular buffers because the state of the buffer, whether full or empty, needs to be known. The buffer's state must be preserved during context switches and when variables are updated. Traditionally, solutions to achieve this have involved locking mechanisms that require producer business entities 108 and consumer business entities 110 to operate one at a time, and locking-free mechanisms that require hardware or replication to maintain atomicity.

[0052] The lap cycle involves either two runners running side-by-side being tied together or one leading the other. On buffers that are either empty or full, if runners are not running side-by-side, there is a task of catching up or overtaking other runners; this means on-demand production and consumption without waiting one-to-one. Laps are represented by 0 or 1. The buffer is empty if both producer entity 108 and consumer entity 110 are on the same lap as at the start; it is full if they are not on the same lap as producer entity 108 and have overtaken consumer entity 110. Producer entity 108 cannot produce on a full buffer, and consumer entity 110 cannot consume on an empty buffer; if the buffer is neither full nor empty, there is only one other state: parallel processing. Both producer entity 108 and consumer entity 110 indicate the completion of a transaction by moving to the next buffer slot and checking each other's buffers before each slot begins a transaction to see if the buffer is full or empty. The only problem is when the loop at the finish line changes; if both producer business entity 108 and consumer business entity 110 are in the last slot of the buffer before returning to slot 0, their loops could be the loops before they reach slot 0 and the loops they will have at slot 0, while they are side-by-side at slot 0 before slot 0. This produces two contradictory results after the initial determination: full and empty, because either consumer business entity 110 or producer business entity 108 must update its loop before moving from its current position, as will be described in detail throughout the disclosure.

[0053] Producer entity 108 can refer to a process, task, or component responsible for generating data or output. For example, the data can be anything, from sensor readings in an Internet of Things (IoT) device to video frames in a streaming application. The data is stored in a buffer before being sent over network 104 to client 106 or other systems. The role of producer entity 108 is to ensure a stable and reliable supply of data to the shared buffer from which consumer entity 110 can retrieve data for further processing or use. According to embodiments of this disclosure, producer entity 108 does not need to wait for consumer entity 110 to catch up before generating more data, as long as buffer space is available. This helps reduce idle time and improve system responsiveness. In some embodiments, producer entity 108 can use looping to mark its progress in the buffer, which will be discussed in detail throughout the disclosure. In some other embodiments, when the buffer is full and consumer entity 110 is slow, producer entity 108 can utilize a reset function to overwrite old data with new, more relevant data, ensuring the system is always up-to-date.

[0054] Consumer entity 110 can refer to the process, task, or component responsible for consuming data from the buffer, i.e., retrieving and processing data generated by producer entity 108. Consumer entity 110 reads and deletes data from the buffer for processing, such as displaying it to a user (or client 106), storing it for long-term use, or using it as input for further computational tasks. Data consumption must be frequently synchronized with the production rate to prevent buffer underflow, i.e., when consumer entity 110 runs out of data to process. Consumer entity 110 may need to determine if there is data to consume. Based on looping and clamping, consumer entity 110 can determine whether the buffer is empty or full without causing delays. It is understood that consumer entity 110 can operate in parallel with producer entity 108; that is, once consumer entity 110 has finished processing a portion of the data from the buffer, it can immediately move on to the next portion, thereby improving throughput. If the buffer is overwritten by producer entity 108, consumer entity 110 can reset and begin processing the latest data.

[0055] Therefore, according to embodiments of this disclosure, server-side buffer management is more efficient, avoiding common problems associated with traditional solutions, such as deadlock, priority inversion, and reliability issues related to hardware-specific functions. Producer entity 108 and consumer entity 110 can operate independently and in parallel, with server 102 acting as an intermediary to ensure synchronization and proper data flow. It is understood that looping allows server 102 to maximize buffer utilization by allowing producer entity 108 to continue producing (as long as there is space in the buffer) and allowing consumer entity 110 to consume (as long as data is available). Looping can potentially revolutionize the use of bounded buffers in computing systems. Furthermore, clamping helps resolve any ambiguity in buffer state, particularly at critical transaction points, ensuring data consistency and reliability.

[0056] Figure 1 The number and arrangement of systems, devices, and / or networks shown are provided as examples. Other systems, devices, and / or networks may exist; fewer systems, devices, and / or networks; different systems, devices, and / or networks; and / or networks with... Figure 1 The diagram shows different arrangements of systems, equipment, and / or networks. Furthermore, Figure 1 The two or more systems or devices shown can be implemented within a single system or device, or Figure 1 The single system or device shown may be implemented as multiple distributed systems or devices. Alternatively, a group of systems (e.g., one or more systems) or a group of devices (e.g., another or more devices) of network architecture 100 may perform one or more functions described as being performed by another group of systems or another group of devices in network architecture 100.

[0057] Figure 2 This is a simplified block diagram 200 of a server (such as server 102) for facilitating data synchronization according to embodiments of the present disclosure.

[0058] In some embodiments, such as Figure 2As shown, server 102 may include one or more processors 202. The one or more processors 202 may be implemented as one or more microprocessors, microcomputers, microcontrollers, digital signal processors, central processing units, logic circuits, and / or any device that manipulates data based on operating instructions. Among other functions, the one or more processors 202 may be configured to retrieve and execute computer-readable instructions stored in memory 204 of server 102. Memory 204 may store one or more computer-readable instructions or routines that can be retrieved and executed to create or share data units via network services. Memory 204 may include any non-transient storage device, including, for example, volatile memory such as random access memory (RAM), or non-volatile memory such as erasable programmable read-only memory (EPROM), flash memory, etc.

[0059] In some embodiments, server 102 may further include interface 206. Interface 206 may include various interfaces, such as interfaces for data input and output devices (referred to as I / O devices, storage devices, etc.). Interface 206 may facilitate communication between server 102 and various devices coupled to it. Interface 206 may also provide communication paths for one or more components of server 102. Examples of such components include, but are not limited to, processing module 208 and database 218.

[0060] In some embodiments, processing module 208 may be implemented as a combination of hardware and programming (e.g., programmable instructions) to implement one or more functions of processing module 208. In the examples described herein, this combination of hardware and programming can be implemented in several different ways. For example, programming of processing module 208 may be processor-executable instructions stored on a non-transient machine-readable storage medium, and the hardware of one or more processors 202 may include processing resources (e.g., one or more processors) to execute these instructions. In this example, the machine-readable storage medium may store instructions that, when executed by the processing resources, implement processing module 208. In these examples, server 102 may include a machine-readable storage medium storing instructions and processing resources executing the instructions, or the machine-readable storage medium may be separate, but server 102 and processing resources may be accessible to it. In other examples, processing module 208 may be implemented by electronic circuitry.

[0061] In some embodiments, database 218 may include data that may be stored or generated as a result of functionality implemented by any component of processor 202, processing module 208, or server 102.

[0062] It should be noted that the server 102 shown in the figures and described below is only for illustrating devices that can benefit from embodiments of this disclosure and should not be considered as limiting the scope of this disclosure. It should be noted that server 102 may include, but is not limited to, devices that can benefit from embodiments of this disclosure. Figure 2 The number of components shown is less or more.

[0063] In an exemplary embodiment, processing module 208 may include one or more modules selected from those of the producer business entity (…). Figure 1 The write pointer module 210 corresponding to 108) and the consumer business entity (e.g. Figure 1 The output pointer module 212, the winding module 214 (which also includes the clamping module, which can be interchangeably referred to as "clamping module 214"), the reset module 216, and any of the other modules. Other modules may include, but are not limited to, monitoring modules, determination modules, and notification modules. It is understood that, for ease of reference, the winding and clamping modules are represented as a single module.

[0064] In some embodiments, server 102 represents a central system that uses, for example, a circular buffer to handle I / O operation synchronization between producer business entity 108 and consumer business entity 110. The pointer in-module 210 may determine and / or store information corresponding to the pointer in-module indicating the current position of data written by producer business entity 108 within the circular buffer, ensuring that data is correctly placed without overwriting unconsumed data. The write pointer module 210 is integrated with the looping module 214 to ensure that the movement of the write pointer around the buffer is accurately reflected in the loop count. The output pointer module 212 may determine and / or store information corresponding to the output pointer indicating the position of data read by consumer business entity 110 within the circular buffer. The output pointer module 212 is integrated with the clamping module (also 214) to resolve any potential ambiguity when the pointers are in the same position, ensuring reliable data consumption.

[0065] In some embodiments, the looping module 214 can initiate looping operations and / or clamping operations. For example, the looping module 214 can initiate looping operations to track the looping of the write pointer associated with the write pointer module 210 and the output pointer associated with the output pointer module 212 around a circular buffer to determine when the buffer is full or empty without locking. The looping module 214 can determine the producer loop indicator associated with the producer business entity 108 and the consumer loop indicator associated with the consumer business entity 110. A loop is considered complete when the pointers return to the starting point after traversing the entire buffer. The functions of the looping operation may include, but are not limited to, pointer tracking, buffer state determination, lock-free synchronization, facilitating parallel processing, and wait-free operations.

[0066] In some embodiments, the looping module 214 can monitor the positions of the write pointer module 210 and the output pointer module 212, i.e., the write pointer and the output pointer, within the circular buffer, thereby effectively tracking the number of times each pointer loops around the buffer. Using the number of loops, the looping module 214 can determine the state of the buffer, such as full, empty, or partially filled. This is crucial for enabling the producer business entity 108 to determine when it is safe to write data to the buffer and for the consumer business entity 110 to determine when to read data from the buffer without any data loss or collisions.

[0067] By tracking the number of loops, the looping module 214 allows the system (or server 102) to synchronize the actions of producer business entity 108 and consumer business entity 110. This is particularly advantageous in real-time systems where lock contention can lead to unacceptable latency. The looping operation allows producer business entity 108 and consumer business entity 110 to process in parallel, thereby improving the overall throughput of the system. The looping module 214 coordinates these parallel operations to maintain system integrity. Because the looping module 214 can provide immediate information about the buffer state, both producer business entity 108 and consumer business entity 110 can operate in a wait-free manner. For example, as long as the buffer is not full or empty, producer business entity 108 does not need to wait for consumer business entity 110 to catch up, and vice versa.

[0068] In some embodiments, the looping / clamping module 214 can initiate a clamping operation, particularly when the write pointer of the producer business entity 108 and the output pointer of the consumer business entity 110 are at a transition point crossing the end of the buffer. This is crucial for ensuring the integrity of the buffer state. The functions of the clamping operation may include, but are not limited to, state recording, buffer integrity, and transaction verification.

[0069] In some embodiments, clamping module 214 may record the state of the buffer before the pointer wraps around the buffer, thereby effectively clamping the state for reference in case of potential ambiguity. When producer business entity 108 or consumer business entity 110 reaches the penultimate position in the buffer (i.e., one slot before wrapping to the start), clamping module 214 records the current number of wraps for that business entity. If the write pointer and output pointer meet at the wrap point (e.g., the last slot of the buffer), clamping module 214 uses the recorded number of wraps, i.e., the producer wrap indicator and / or the consumer wrap indicator, to determine the correct state of the buffer, i.e., whether the buffer is actually full or empty. In the case where producer business entity 108 and consumer business entity 110 reach the wrap point simultaneously, clamping module 214 uses the recorded state to ensure that each business entity, i.e., producer business entity 108 and consumer business entity 110, correctly interprets the state of the buffer and acts accordingly. By tracking the last known state, clamping module 214 ensures the integrity of the buffer even when the write pointer and output pointer are in the same position. In some embodiments, before the consumer business entity 110 or the producer business entity 108 performs any read or write operation, the clamping module 214 may check the status of the record to verify whether the operation can continue, ensuring that the producer business entity 108 does not write to the full buffer and the consumer business entity 110 does not read from the empty buffer.

[0070] In some embodiments, the reset module 216 can initiate a reset operation, allowing the producer entity 108 to overwrite old data with new data when the buffer is full and the consumer entity 110 is slow. When the buffer is full, the producer entity 108 can activate a flag indicating that no more data can be produced until the consumer entity 110 catches up. The reset module 216 can initiate a four-way handshake between the producer entity 108 and the consumer entity 110. The producer entity 108 sets a flag indicating that the buffer is full (e.g., to 1). The consumer entity 110 acknowledges and resets its read position, and then the producer entity 108 resets its write operation. This is crucial for maintaining a continuous data stream, especially in real-time systems.

[0071] It should be noted that if a bounded buffer is used in a consumer-producer paradigm, the components described herein can be configured in a variety of ways, including electronic circuits, digital arithmetic and logic blocks, and storage systems combined with software, firmware and embedded technologies.

[0072] Figure 3 A flowchart of an example method 300 for multi-buffer looping according to an embodiment of the present disclosure is shown. It will be understood that the flowchart depicts the producer and consumer business entity sides for managing bounded shared buffers.

[0073] Initially, the buffer is empty, and the consumer business entity (e.g., Figure 1 110) and producer business entities (e.g., Figure 1 Both producer business entity 108 and consumer business entity 110 are located in the first buffer slot (0). Producer business entity 108 must start first so that consumer business entity 110 has something to consume. Producer business entity 108 produces data in the first buffer slot and moves to the second buffer slot to indicate that an entry is in the buffer. Consumer business entity 110 can consume data from slot 0, and producer business entity 108 can produce data from slot 1. This is always the case when the write pointer is not equal to the output pointer anywhere around the buffer. For parallel or simultaneous processing, there is always one empty slot and one full slot. For example, the flowchart shows a buffer of size 6. The current pointer position is shown in the following figure:

[0074]

[0075] Logically, the buffer is circular, meaning slot 0 connects to slot 5. Data can be generated and used if the write pointer (i) is not equal to the output pointer (o). The buffer is either full or empty when the write pointer of any slot around the buffer is equal to the output pointer. The pointer positions are shown in the diagram below:

[0076]

[0077] When either the producer's or consumer's pointer (input or output) returns from slot 5 to slot 0, the producer's and consumer's circle indicators are updated. The circle indicator is numbered 0 or 1. The buffer is empty when the consumer's and producer's circle indicators are equal, and full when they are not equal. If the buffer is full, producer business entity 108 pauses; if the buffer is empty, consumer business entity 110 pauses. Knowing when the buffer is full or empty works well until the two pointers are equal at slot 5. This is where the circle indicator changes from its value at slot 5 to its value at slot 0; simultaneously, the pointers are equal at the same position. The pointer positions are shown in the diagram below:

[0078]

[0079] Both circle indicators are initially 0, and the write and output pointers are located in slot 5 (i.e., the buffer is empty). If producer business entity 108 decides to add an entry, its circle indicator, i.e., the producer circle indicator, becomes 1, and now the buffer of consumer business entity 110 appears to be full (because the circle indicators are not equal). The pointer positions are shown in the following diagram:

[0080]

[0081] Within a transaction, producer business entity 108 adds an entry, updates the producer circle indicator (only at slot 5), and then moves the write pointer to the next slot (transaction complete). Consumer business entity 110 periodically checks if the buffer is full or empty, and sees the change in the producer circle indicator when the write pointer equals the output pointer, consumes the entries in the buffer, and moves to slot 0 while producer business entity 108 is still completing the transaction. The pointer positions are shown in the following diagram:

[0082]

[0083] In the above results, the write pointer is not equal to the output pointer, and the consumer business entity 110 can attempt to consume data from the empty buffer slot 0. This can also happen in the opposite way, with the producer business entity 108 attempting to produce data into the full buffer slot 0. The pointer positions are shown in the following diagram:

[0084]

[0085] To mitigate this synchronization problem, clamping modules (e.g., Figure 2 The winding module 214 can initiate a clamping operation. Clamping occurs before a change of winding (e.g., in slot 4 above) where the number of windings is recorded in the slot (i.e., the clamping indicator). The clamping winding indicator can be recorded in any slot before the slot where the winding change occurs. The clamping winding indicator, i.e., the producer clamping indicator and the consumer clamping indicator, is used for comparison when the write pointer at slot 5 equals the output pointer. The producer business entity 108 (i.e., the write pointer) and the consumer business entity 110 (i.e., the output pointer) can safely complete their transactions by appropriately pausing when the buffer is full or empty in slot 5 (the slot before a complete winding around the buffer).

[0086] Reference Figure 3 On the producer business entity side, the production process begins. The producer business entity (e.g., Figure 1 108) Create or generate the entity that needs to be passed to the consumer business entity (e.g. Figure 1 The data (110) can include, for example, sensor readings, calculation results, user-generated content, etc. Additionally, the system (or server 102) checks if the buffer is full. This check is performed using a looping module (e.g., Figure 2 The process is performed by comparing the circle of the producer business entity (i.e., the position of the write pointer, determined by the write pointer module 210) with the circle of the consumer business entity (i.e., the position of the output pointer, determined by the output pointer 212) to determine the occupancy of the buffer.

[0087] In some embodiments, if the buffer is full, producer entity 108 must pause until an entry is removed for a predetermined duration, e.g., until the buffer is no longer full or consumer entity 110 removes an entry from the buffer. During this state, producer entity 108 does not write new data to the buffer. This prevents the buffer from being overwritten by new data before consumer entity 110 processes existing data. In some other embodiments, if the buffer is not full, producer entity 108 can proceed to the next step, where it writes the generated data to the buffer. Producer entity 108 writes the data to the buffer at its current pointer position and updates the pointer.

[0088] Server 102 checks whether data generation is complete or if more data is needed. If data generation is complete, the production process ends. If data generation is incomplete, it loops back to complete the data generation process.

[0089] On the consumer business entity side, the consumption process begins. The consumer business entity processes data from the buffer. Additionally, server 102 checks if the buffer is empty. This check is performed using a looping module (e.g., ...). Figure 2 The process is performed by comparing the circle of the producer business entity (i.e., the position of the write pointer, determined by the write pointer module 210) with the circle of the consumer business entity (i.e., the position of the output pointer, determined by the output pointer 212) to determine the occupancy of the buffer when the write pointer equals the output pointer.

[0090] In some embodiments, if the buffer is empty, the consumer business entity 110 must pause for a predetermined duration, e.g., until the buffer is no longer empty or the producer business entity 108 adds an entry to the buffer. During this state, the consumer business entity 110 does not read data from the buffer. This prevents the consumer business entity 110 from reading unfilled slots in the buffer. In some other embodiments, if the buffer is not empty, the consumer business entity 110 can proceed to the next step, i.e., the consumer business entity 110 reads data from the buffer. The consumer business entity 110 reads data from the buffer at its current output pointer position and updates the output pointer.

[0091] Server 102 checks whether data consumption is complete, or whether more data is expected to be consumed. If data consumption is complete, the consumption process ends. If data consumption is not complete, it loops back to complete the consumption process.

[0092] Determining whether a producer-consumer problem involves an empty or full buffer has led to numerous complex, inefficient, and resource-intensive solutions. The circular buffer is either full or empty when producer entity 108 overtakes consumer entity 110 or consumer entity 110 catches up with producer entity 108. The original loop is recorded at (buffer size - 2) for comparison (e.g., a clamping loop indicator); due to the loop change at (buffer size - 1). In some embodiments, if the pointer moves before the loop change, the clamping indicator can be read at slot 0 instead of at buffer size - 1, since this is where the loop change occurs.

[0093] Therefore, using multi-buffer looping and clamping, bounded and shared buffers allow producer business entity 108 to write data synchronously and consumer business entity 110 to read data synchronously, ensuring data integrity and processing efficiency. The looping operation allows producer-consumer operations to occur simultaneously without locks, thus improving performance, especially in systems requiring real-time processing or high data throughput. Method 300 presents a simplified view of these operations, abstracting the underlying complexity of the looping logic, which carefully manages pointer positions to maintain the buffer state.

[0094] Figure 4 A flowchart of an example method 400 for single-buffer looping according to an embodiment of the present disclosure is shown. It will be understood that the flowchart depicts the producer and consumer business entity sides for managing a shared buffer slot.

[0095] A single buffer does not have a pointer, i.e., a write pointer or an output pointer, because there is only one slot. See the diagram below.

[0096] [] Single buffer slot (slot 0)

[0097] Initially, both the consumer's and producer's circle indicators are set to 0. A circle can only be 0 or 1. The buffer is empty when the circle indicators are equal, and full when they are not equal. When producer business entity 108 adds an entry, its circle indicator is updated, as shown below.

[0098] [x] The producer circle is equal to 1. The consumer circle is still 0. The buffer is full and the process pauses.

[0099] When consumer business entity 110 removes an entry, its circle indicator is updated, as shown below.

[0100] [] Consumer circle equals 1. Producer circle also equals 1. Buffer is empty and paused.

[0101] [x] The producer circle is equal to 0. The consumer circle remains 1. The buffer is full, so the process pauses.

[0102] The consumer circle is equal to 0. The producer circle is also equal to 0. The buffer is empty and paused.

[0103] Reference Figure 4 On the producer business entity side, the production process begins. Producer business entity 108 creates or generates data that needs to be passed to consumer business entity 110. Additionally, server 102 checks if the buffer is full.

[0104] In some embodiments, if the buffer is full, the producer business entity 108 must pause for a predetermined duration, for example, until the buffer is no longer full or the consumer business entity 110 deletes an entry. During this state, the producer business entity 108 does not write new data to the buffer. This prevents the buffer from being overwritten by new data before the consumer business entity 110 processes existing data. In some other embodiments, if the buffer is not full, the producer business entity 108 can proceed to the next step, whereby the producer business entity 108 writes the generated data to the buffer.

[0105] Server 102 checks whether data generation is complete, or whether more data is expected. If data generation is complete, the production process ends. If data generation is incomplete, it loops back to complete the data generation process.

[0106] On the consumer business entity side, the consumption process begins. The consumer business entity processes data from the buffer. Additionally, server 102 checks if the buffer is empty.

[0107] In some embodiments, if the buffer is empty, the consumer business entity 110 must pause for a predetermined duration, for example, until the buffer is no longer empty or an entry is added to the buffer. During this state, the consumer business entity 110 does not read data from the buffer. In some other embodiments, if the buffer is not empty, the consumer business entity 110 can proceed to the next step, i.e., the consumer business entity 110 reads data from the buffer.

[0108] Server 102 checks whether data consumption is complete, or whether more data is expected to be consumed. If data consumption is complete, the consumption process ends. If data consumption is not complete, it loops back to complete the consumption process.

[0109] Therefore, a single buffer loop ensures that two business entities 108 and 110 can operate on the same buffer slot without requiring complex locking mechanisms. It facilitates synchronization by using a simple full / empty status indicator that determines whether the producer business entity 108 can write to the buffer or whether the consumer business entity 110 can read from it. This mechanism is particularly useful in systems with limited space and where managing multiple buffer slots is prohibitively expensive. The single buffer loop process symbolizes systems requiring tight control and predictable behavior from both data producers and consumers.

[0110] Figure 5 A flowchart is shown for an example method 500 for implementing loop reset according to an embodiment of the present disclosure.

[0111] When consumer business entity 110 is slow, the circular reset operation (via...) Figure 2 The reset module 216 will overwrite the entire buffer instead of pausing. In some cases, system designers may want to overwrite older input data with more current data, or the buffer may be full of old data due to the slow speed of consumer business entity 110, and they may not want to lose current data. In this case, a loop reset may be initiated.

[0112] In some embodiments, when producer entity 108 determines that the buffer is full and cannot write, producer entity 108 changes its flag (e.g., overPro) from 0 to 1 and pauses the consumer entity flag. Consumer entity 110 checks if an entry is in the buffer but recognizes the producer entity flag set to 1. Consumer entity 110 pauses, resets its own circle indicator and output pointer to 0, and then updates its flag (e.g., overCon) to 1 for producer entity 108 to check. Producer entity 108 recognizes the consumer entity flag set to 1, resets its circle indicator and pointer to 0, and resets its flag to 0. Simultaneously, it remains paused to update the consumer entity flag to 0. When consumer entity 110 recognizes that the producer entity flag is set to 0, it sets its flag to zero and waits to produce an entry. Producer entity 108 recognizes the consumer entity flag set to 0 and produces data.

[0113] Therefore, the lap reset is implemented as a four-wave gesture, checking if both flags are 1, and finally checking if both flags are 0. This wave prevents game-breaking situations because after the reset / buffer is cleared, an entry must be produced before starting.

[0114] Below is an example of a full and empty buffer of size 10, where the pointers are equal at slot 9. Specifically, the following example shows that consumer business entity 110 is about to consume by updating its loop indicator to 1, but at slot 8, Chk clamps the actual number of loops to reach a fully buffered state at slot 9. Producer business entity 108 will recognize that the buffer is empty when looking at the loop indicator (Lap), but checking that Chk is clamped at slot 9 indicates that the buffer is full and consumer business entity 110 is completing consumption in slot 9.

[0115]

[0116] The following example shows that producer business entity 108 is about to begin production by updating its loop indicator to 0, but performs a Chk clamp on the actual loop at slot 8 to achieve an empty buffer state at slot 9. Consumer business entity 110 can recognize that the buffer is full when looking at the loop indicator, but knows that checking the Chk clamp at slot 9 indicates that the buffer is empty and producer business entity 108 is completing production in slot 9.

[0117]

[0118] Therefore, clamping allows us to display the actual looping of consumer business entity 110 and producer business entity 108, whose buffer size is greater than 1, at the last buffer slot. Single-slot buffers only update the loop indicator when the transaction completes, as the pointers are always equal.

[0119] The following example shows producer business entity 108 updating a buffer of size 2 in slot 0 before moving to slot 1. (A) Both producer business entity 108 and consumer business entity 110 have completed one loop around the buffer and updated their loop indicators to 1. (B) Producer business entity 108 first updates the producer clamp indicator with the current loop, produces an entry, and moves from slot 0 (buffer size - 2) to slot 1 (buffer size - 1). (C) Consumer business entity 110 first updates the consumer clamp indicator with the current loop, consumes an entry, and moves from slot 0 (buffer size - 2) to slot 1 (buffer size - 1). The buffer is now empty, and only producer business entity 108 can produce and move back to slot 0, while consumer business entity 110 continuously checks for entries to consume. (D) Producer business entity 108 must change the loop before moving back to slot 0. If producer entity 108 experiences a context switch / interruption at this point in time, consumer entity 110 decides to check if the buffer is full or empty when producer entity 108 leaves; however, it checks the clamp indicator instead of the circle indicator because the consumer and producer pointers are equal at all circle changes (buffer size - 1). The clamp indicator tells consumer entity 110 that the buffer is empty; because producer entity 108's transaction only completes when it moves to the next buffer slot, in which case the next buffer slot will return to slot 0. (E) Producer entity 108 returns from the context switch and completes its transaction by moving back to slot 0. Now consumer entity 110 can consume, producer entity 108 can produce again, and they can produce autonomously simultaneously.

[0120]

[0121]

[0122]

[0123]

[0124]

[0125] Therefore, according to embodiments of this disclosure, the system 102 discussed herein is twice as fast as a locking system because it simultaneously consumes and produces buffers larger than 1. There are no critical sections because consumer and producer business entities update their own variables (without sharing). It is a thread / process-safe processing chip that is hardware-independent, language-independent, operating system-independent, inexpensive, has no priority inversion / critical sections, no starvation, efficient buffer space utilization, no deadlocks, easy to use, barrier-free, lock-free, wait-free, and suitable for both small and large data. Furthermore, it is understood that system 102 can be used, but is not limited to, embedded systems, operating systems, etc.

[0126] For example, the following is pseudocode for a single-slot loop. All variables are initialized to zero.

[0127] while(l)

[0128] {

[0129] / * Generate another entry in nextProduced* /

[0130] If (lapPro != lapCon) / / buffer is full

[0131] {

[0132] continue; / / Continue repeating the iteration loop.

[0133] }

[0134] buffer[0] = nextProduced; / / Generate the next entry in the buffer.

[0135] lapPro = (lapPro + 1) % 2 / / Update circle producer has completed 0 or 1

[0136] }

[0137] while (l)

[0138] {

[0139] if (lapPro == lapCon) / / Buffer is empty

[0140] {

[0141] continue;

[0142] }

[0143] NextConsumerd = bufferfO]; / / The next entry in the consumer buffer.

[0144] lapCon = (lapCon + 1) % 2 / / Update the consumer's completed loop 0 or 1

[0145] / * Consume the entry in nextConsumed * /

[0146] }

[0147] For example, the following is pseudocode for multi-slot loops.

[0148] while(l)

[0149] {

[0150] / ^ Generate another entry in nextProduced* /

[0151] if (+2 == BUF SIZE)

[0152] {

[0153] chkPro=lapPro; / / Mark the two slots of the circle from the start / end point, BUF SIZE>1

[0154] }

[0155] if (in == out)

[0156] {

[0157] if ((in+1) == BUF_SIZE && chkPro != chkCon) / / Buffer is full

[0158] {

[0159] continue;

[0160] }

[0161] else if (lapPro != lapCon) / / Buffer is full

[0162] {

[0163] continue;

[0164] }

[0165] }

[0166] buffer[i] = nextProduced; / / Generate the next entry in the buffer.

[0167] if (in + 1 == BUF SIZE) / / The producer completes one loop around the buffer.

[0168] {

[0169] lapPro = (lapPro + 1) % 2 / / Update circle producer has completed 0 or 1

[0170] }

[0171] in = (in + 1) % BUF_SIZE; / / Move the write pointer to the next buffer position.

[0172] while(l)

[0173] {

[0174] if (out + 2 == BUF_SIZE) / / Consumer records the number of laps in n-2

[0175] {

[0176] chkCon=lapCon;

[0177] }

[0178] if (in == out)

[0179] {

[0180] If (out+1) == BUF_SIZE & chkPro == chkCon / / the buffer is empty

[0181] {

[0182] continue;

[0183] }

[0184] else if (lapPro == lapCon) / / Buffer is empty

[0185] {

[0186] continue;

[0187] }

[0188] }

[0189] nextConsumerd=bufferout]; / / The next entry in the consumer buffer.

[0190] if (out + 1) == BUF SIZE) / / The consumer completes one lap around the buffer zone

[0191] {

[0192] lapCon = (lapCon + 1) % 2 / / Update the consumer's completed loop 0 or 1

[0193] }

[0194] out = (out + 1) % BUF SIZE; / / Move the output pointer to the next buffer position.

[0195] / * Consume the entry in nextConsumed * /

[0196] }

[0197] For example, the following is pseudocode for multi-slot reset.

[0198] while(l)

[0199] {

[0200] / * Generate another entry in nextProduced* /

[0201] if (overPro == 1 && overCon == 1) / / Security coverage condition, producer and consumer reset

[0202] {

[0203] in=0; / / Reset in-ptr

[0204] lapPro=0; / / Reset the producer circle

[0205] overPro=0; / / Producer reset complete

[0206] }

[0207] else if (loverPro==1‖overCon==1) / / Wait for the consumer to reset the flag

[0208] {

[0209] continue?

[0210] }

[0211] If (in + 2 == BUF SIZE)

[0212] {

[0213] chkPro=lapPro; / / Mark the two slots from the start / end of the loop, BUF SIZE>1

[0214] }

[0215] if (in = out)

[0216] {

[0217] if ((in+1) == BUF_SIZE && chkPro != chkCon) / / Buffer is full

[0218] {

[0219] overPro=1; / / Producer flag used for overlay

[0220] continue; / / Repeat the loop

[0221] }

[0222] else if (lapPro != lapCon) / / Buffer is full

[0223] {

[0224] overPro=1; / / Producer flag used for overlay

[0225] continue; / / Repeat the loop

[0226] }

[0227] }

[0228] buffer[in] = nextProduced; / / Generate the next entry in the buffer.

[0229] if (in + 1 == BUF SIZE) / / The producer completes one loop around the buffer.

[0230] {

[0231] lapPro = (lapPro + 1) % 2 / / Update circle producer has completed 0 or 1

[0232] }

[0233] in = (in + 1) % BUF SIZE; / / Move the write pointer to the next buffer position.

[0234] }

[0235] while(l){

[0236] if (overPro == 1 && overCon == l) / / Wait for the producer to reset

[0237] {

[0238] continue?

[0239] }

[0240] if (overPro == l) / / Check if the producer is being reset

[0241] {

[0242] out = 0; / / Reset pointer

[0243] lapCon = 0; / / Reset consumer circle

[0244] overCon=1; / / Set consumer reset flag

[0245] continue; / / Re-iterate the loop when the producer is reset.

[0246] }

[0247] else if (overCon == l) / / In this case, only update

[0248] {

[0249] overCon = 0; / / Reset complete

[0250] }

[0251] if (out + 2 == BUF_SIZE) / / Record the number of consumer laps

[0252] {

[0253] chkCon=lapCon;

[0254] }

[0255] if (in == out) / / If the buffer is full, the producer will initiate a reset.

[0256] {

[0257] continue;

[0258] }

[0259] nextConsumerd=bufferout]; / / The next entry in the consumer buffer.

[0260] if (out + 1) == BUF SIZE) / / The consumer completes one lap around the buffer zone

[0261] {

[0262] lapCon = (lapCon + 1) % 2 / / Update the number of laps completed by the consumer (0 or 1)

[0263] }

[0264] out = (out + 1) % BUF_SIZE; / / Move the output pointer to the next buffer position.

[0265] / * Consume entries in nextConsumed * /

[0266] }

[0267] For example, the following is pseudocode for single-slot reset.

[0268] while(l)

[0269] {

[0270] / * Generate another entry in nextProduced* /

[0271] if (overPro == 1 && overCon == 1) / / Security coverage condition, producer and consumer reset

[0272] {

[0273] lapPro=0; / / Reset the producer circle

[0274] overPro=0; / / Reset producer flag

[0275] }

[0276] if (overpPro == 1 || overCon == 1) / / The wait time on overCon is 0

[0277] {

[0278] continue;

[0279] }

[0280] if (lapPro != lapCon) / / Buffer is full

[0281] {

[0282] overPro=1; / / Reset the producer flag

[0283] continue; / / Repeat the loop

[0284] }

[0285] buffer[0] = nextProduced; / / Generate the next entry in the buffer.

[0286] lapPro = (lapPro + 1) % 2 / / Update circle producer has completed 0 or 1

[0287] }

[0288] while (1)

[0289] {

[0290] if(overPro==1&&overCon==1)

[0291] {

[0292] continue;

[0293] }

[0294] if (overPro == 1) / / The producer wants to overwrite the old data

[0295] {

[0296] lapCon = 0; / / Reset consumer circle

[0297] overCon=1; / / Consumer flag used for resetting

[0298] continue; / / Repeat the loop

[0299] }

[0300] else if (overCon == 1) / / Only change in this case

[0301] {

[0302] overCon = 0; / / Consumer reset flag

[0303] }

[0304] if (lapPro == lapCon) / / Buffer is empty

[0305] {

[0306] continue;

[0307] }

[0308] NextConsumerd = bufferfO]; / / The next entry in the consumer buffer.

[0309] lapCon = (lapCon + 1) % 2 / / Update circle consumer has completed 0 or 1

[0310] / * Consume the entry in nextConsumed * /

[0311] }

[0312] In some embodiments, multi-slot reset consumer catch-up can be implemented as a four-way handshake, where once consumer entity 110 sees the producer entity 108's flag OverPro set to 1, all consumer condition variables out, lapCon, and chkCon are set to equal the corresponding producer condition variables. Producer entity 108 does not write until the four-way handshake is complete, or in other words, the OverCon flag changes back from 1 to 0. This method requires one less line of code than resetting all producer and consumer condition variables back to 0, except for clamping chkCon and chkPro, which will be recorded with a buffer size of -2. Clamping must be reset in the catch-up method because the reset value can be anywhere around the buffer, including where a loop change occurs. After being reset to 0, all variables are placed at position 0, and clamping is recorded as normal before the loop change. The four-way handshake is important because both consumer entity 110 and producer entity 108 stop operating before the reset, and finally both consumer entity 110 and producer entity 108 restart operating after the reset.

[0313] For example, below is pseudocode for multi-slot reset catch-up.

[0314] while(l)

[0315] {

[0316] / * Generate another entry in nextProduced* /

[0317] if (overPro == 1 && overCon == 1) / / Security coverage condition, producer and consumer reset

[0318] {

[0319] overPro=0; / / Producer reset complete

[0320] }

[0321] if (overCon == 1 || overPro == 1) / / Wait for the consumer to reset the flag

[0322] {

[0323] continue;

[0324] }

[0325] if (+2 == BUF size)

[0326] {

[0327] chkPro=lapPro; / / Update clamping

[0328] }

[0329] if (in == out)

[0330] {

[0331] if ((in+1) == BUF_SIZE && chkPro != chkCon) / / Buffer is full

[0332] {

[0333] overPro=1; / / Producer flag used for overlay

[0334] continue; / / Repeat the loop

[0335] }

[0336] else if (lapPro != lapCon) / / Buffer is full

[0337] {

[0338] overPro=1; / / Producer flag used for overlay

[0339] continue; / / Repeat the loop

[0340] }

[0341] }

[0342] buffer[in] = nextProduced; / / Generate the next entry in the buffer.

[0343] if (in + 1 == BUF SIZE) / / The producer completes one loop around the buffer.

[0344] {

[0345] lapPro = (lapPro + 1) % 2 / / Update circle producer has completed 0 or 1

[0346] }

[0347] in = (in + 1) % BUF_SIZE; / / Move the write pointer to the next buffer position.

[0348] while (l) / / Consumer loop

[0349] {

[0350] if (overPro == 1 && overCon == l) / / Wait for the producer to reset the flag 0

[0351] {

[0352] continue;

[0353] }

[0354] if (overPro == l) / / Check if the producer is being reset

[0355] {

[0356] out = in; / / Reset pointer

[0357] lapCon=lapPro; / / Reset the consumer's knee joint

[0358] chkCon=chkPro; / / Reset consumer clamping

[0359] overCon=1 / Consumer Reset Flag Set

[0360] continue; / / Re-iterate the loop when the producer is reset.

[0361] }

[0362] else if (overCon == l) / / In this case, only update

[0363] {

[0364] overCon = 0; / / Reset complete

[0365] }

[0366] if (out + 2 == BUF SIZE) / / Record the number of consumer laps

[0367] {

[0368] chkCon=lapCon;

[0369] }

[0370] if (in == out) / / If the buffer is full, the producer will initiate a reset.

[0371] {

[0372] continue;

[0373] }

[0374] nextConsumerd=bufferout]; / / Consume the next entry in the buffer.

[0375] if (out + 1) == BUF SIZE) / / The consumer completes one lap around the buffer zone

[0376] {

[0377] lapCon = (lapCon + 1) % 2 / / Update circle consumer has completed 0 or 1

[0378] }

[0379] out = (out + 1) % BUF_SIZE; / / Move the output pointer to the next buffer position.

[0380] / * Consume the entry in nextProduced * /

[0381] }

[0382] For example, below is the pseudocode for single-slot reset catch-up.

[0383] while(l)

[0384] {

[0385] / * Generate another entry in nextProduced* /

[0386] if (overPro == 1 && overCon == 1) / / indicates that the consumer shakes hands

[0387] {

[0388] overPro=0; / / Reset producer flag

[0389] }

[0390] ifoverpPro==1||overCon==1) / / Wait for overCon to equal 0

[0391] {

[0392] continue;

[0393] }

[0394] if (lapPro != lapCon) / / Buffer is full

[0395] {

[0396] overPro=1; / / Reset the producer flag

[0397] continue; / / Repeat the loop

[0398] }

[0399] buffer[0] = nextProduced; / / Generate the next item in the buffer.

[0400] lapPro = (lapPro + 1) % 2 / / Update circle producer has completed 0 or 1

[0401] }

[0402] while(l)

[0403] {

[0404] if(overPro==1&&overCon==1)

[0405] {

[0406] continue;

[0407] }

[0408] if (overPro == 1) / / The producer wants to overwrite the old data

[0409] {

[0410] lapCon=lapPro; / / Reset consumer circle

[0411] overCon=1; / / Consumer flag used for resetting

[0412] continue; / / Repeat the loop

[0413] }

[0414] else if (overCon == 1) / / Only change in this case

[0415] {

[0416] overCon = 0; / / Consumer reset flag

[0417] }

[0418] if (lapPro == lapCon) / / Buffer is empty

[0419] {

[0420] continue;

[0421] }

[0422] NextConsumerd=bufferfO]; / / Consume the next entry in the buffer.

[0423] lapCon = (lapCon + 1) % 2 / / Update circle consumer has completed 0 or 1

[0424] / * Consume the entry in NextConsumerd * /

[0425] }

[0426] Figure 6An example computer system 600 is illustrated, in which or with various embodiments of the present disclosure may be implemented according to embodiments of the present disclosure. In some embodiments, server 102 or system 102 may be implemented as computer system 600.

[0427] like Figure 6 As shown, computer system 600 may include external storage device 610, bus 620, main memory 630, read-only memory 640, mass storage device 650, communication port 660, and processor 670. Those skilled in the art will understand that computer system 600 may include more than one processor and communication port. Processor 670 may include various modules associated with embodiments of this disclosure. Communication port 660 may be any of the following: an RS-232 port for modem-based dial-up connections, a 10 / 100 Ethernet port, a gigabit or 10 gigabit port using copper or fiber optics, a serial port, a parallel port, or other existing or future ports. Communication port 660 may be selected depending on the network, such as a local area network (LAN), a wide area network (WAN), or any network to which computer system 600 is connected.

[0428] Main memory 630 may be random access memory (RAM) or any other dynamic storage device known in the art. Read-only memory 640 may be any static storage device, such as, but not limited to, a programmable read-only memory (PROM) chip for storing static information, such as boot or basic input / output system (BIOS) instructions for processor 670. Mass storage device 650 may be any current or future mass storage solution that can be used to store information and / or instructions. Exemplary mass storage device 650 includes, but is not limited to, parallel advanced technology accessory (PATA) or serial advanced technology accessory (SATA) hard disk drives or solid-state drives (internal or external, such as having a universal serial bus (USB) and / or FireWire interface), one or more optical discs, redundant array of independent disks (RAID) storage, such as a disk array.

[0429] Bus 620 communicatively couples processor 670 with other memory, storage, and communication blocks. Bus 620 may be, for example, a Peripheral Component Interconnect (PC1) / PC1 Expansion (PCLX) bus, a Small Computer System Interface (SCSI), USB, etc., for connecting expansion cards, drives, and other subsystems, as well as other buses, such as connecting processor 670 to the front side bus (FSB) of computer system 600.

[0430] Optionally, operator and management interfaces, such as displays, keyboards, joysticks, and cursor control devices, may also be connected to bus 620 to support direct operator interaction with computer system 600. Other operator and management interfaces may be provided via a network connection connected to communication port 660. The components described above are merely illustrative of various possibilities. The exemplary computer system 600 described above should in no way limit the scope of this disclosure.

[0431] The methods described herein can be performed using the system described herein. Furthermore, it is contemplated that the methods described herein can be performed using a system different from the system described herein. Additionally, the system described herein can perform the methods described herein and can execute or execute instructions stored in a non-transitory computer-readable storage medium (CRSM). The CRSM can include any electronic, magnetic, optical, or other physical storage device storing executable instructions. The instructions can include instructions that cause a processor to perform or control the operational performance of the proposed methods. It is also contemplated that the system described herein can perform functions or execute instructions other than those associated with the methods and CRSM described herein.

[0432] Furthermore, the CRSM described herein can store instructions corresponding to the methods described herein, and can also store instructions that can be executed by the system described herein. Additionally, it is conceivable that the CRSM described herein can store instructions different from those corresponding to the methods described herein, and can also store instructions that can be executed by systems other than the system described herein.

[0433] The methods, systems, and CRSMs described herein may include or perform the functions described herein and may be associated with any one or more of the other methods, systems, and CRSMs described herein.

[0434] In some embodiments, one or more of the above methods can be performed by a computing system (e.g., Figure 6The computer system 600 executes or implements the methods, processes, and / or tasks described above, including a tangible computer-readable storage medium, also referred to herein as a storage machine, which holds machine-readable instructions executable by a logic machine (i.e., a processor or programmable control device) to provide, implement, execute, and / or carry out the methods, processes, and / or tasks described above. The state of the storage machine may change to store different data when these methods and processes are implemented. For example, the storage machine may include storage devices such as various hard disk drives, CDs, or DVDs. The logic machine may execute the machine-readable instructions through one or more physical information and / or logical processing devices. For example, the logic machine may be configured to execute instructions to perform the tasks of a computer program. The logic machine may include one or more processors to execute the machine-readable instructions. The computing system may include a display subsystem for displaying a graphical user interface (GUI) or any visual elements of the methods or processes described above. For example, the display subsystem, storage machine, and logic machine may be integrated such that the methods described above can be executed while visual elements of the disclosed system and / or methods are displayed on a display screen for user consumption. The computing system may include an input subsystem for receiving user input. The input subsystem may be configured to connect to and receive input from a device such as a mouse, keyboard, or game controller. For example, user input can indicate a request for the computing system to perform a specific task, such as requesting the computing system to display any of the aforementioned information, or requesting user input to update or modify existing stored information for processing. A communication subsystem can allow the execution or provision of the aforementioned methods on a computer network. For example, a communication subsystem can be configured to enable the computing system to communicate with multiple personal computing devices. The communication subsystem may include wired and / or wireless communication devices to facilitate networked communication. The described methods or processes can be executed, provided, or implemented for a user or one or more computing devices via a computer program product, such as via an application programming interface (API).

[0435] Since many modifications, variations, and changes in detail can be made to the preferred embodiments described in this disclosure, all matters shown in the foregoing description and drawings are intended to be illustrative rather than restrictive. Therefore, the scope of the invention should be determined by the appended claims and their legal equivalents.

Claims

1. A system for data synchronization, comprising: processor; and A memory operatively coupled to the processor, the memory including processor-executable instructions that, when executed, cause the processor to: Determine the producer circle indicator associated with the producer business entity corresponding to the buffer; Identify the consumer circle indicator associated with the consumer business entity; The state of the buffer is determined based on the producer circle indicator and the consumer circle indicator; and In response to the determination of whether the buffer is full or empty, data synchronization is achieved by initiating looping and / or clamping at the buffer.

2. The system according to claim 1, wherein, In order to initiate the clamping, the processor is configured to record the producer clamping indicator and the consumer clamping indicator before the corresponding producer circle indicator and consumer circle indicator associated with the producer business entity and the consumer business entity change, and to determine the state of the buffer based on the producer clamping indicator and the consumer clamping indicator.

3. The system of claim 2, wherein, in order to initiate the circling, the processor is configured to: Determine the location of the write pointer associated with the buffer and related to the producer business entity; Determine the position of the output pointer associated with the consumer business entity; further determine the state of the buffer based on the position of the write pointer and the position of the output pointer; In response to a full buffer, for a predetermined duration, restrict producer business entities from writing data to the buffer, or restrict consumer business entities from reading data from the buffer, until an entry is deleted or added, respectively; and In response to the buffer being empty, the producer business entity can write data to the write pointer position in the buffer, or the consumer business entity can read data from the output pointer position in the buffer.

4. The system of claim 3, wherein the processor is further configured to initiate clamping based on the position of the write pointer being the same as the position of the output pointer where the loop change occurs.

5. The system according to claim 3, wherein, In response to the buffer being full, the processor is configured to set the producer flag associated with the producer business entity to 1, indicating that the buffer is full.

6. The system of claim 5, wherein the processor is further configured to: Reset the positions of the consumer circle indicator and output pointer to 0; and set the consumer flag associated with the consumer business entity to 1.

7. The system of claim 6, wherein the processor is further configured to: Based on the consumer flag being set to 1, the positions of the producer circle indicator and write pointer are reset to 0, and the producer flag is also reset to 0; Based on the producer flag being set to 0, the consumer flag is set to 0 and the system waits for data to be written to the buffer. and By setting the consumer flag to 0, the producer business entity is able to write data to the buffer.

8. The system of claim 5, wherein the processor is further configured to: Set the consumer flags associated with the consumer business entity, the output pointer position, the consumer circle indicator, and the consumer clamp indicator to be equal to the corresponding producer flags, the write pointer position, the producer circle indicator, and the consumer clamp indicator; and Restrict the producer business entity from writing data until the consumer flag is 0.

9. The system according to claim 1, wherein, The buffer is empty when the producer circle indicator and the consumer circle indicator are equal and / or the position of the write pointer is equal to the position of the output pointer, and the buffer is full when the producer circle indicator and the consumer circle indicator are not equal.

10. A method for data synchronization, comprising: The processor determines the producer circle indicator associated with the producer business entity corresponding to the buffer. The processor determines the consumer circle indicator associated with the consumer business entity; The processor determines the state of the buffer based on the producer circle indicator and the consumer circle indicator; and In response to determining whether the buffer is full or empty, the processor synchronizes the data by initiating looping and / or clamping at the buffer.

11. The method according to claim 10, wherein, In order to initiate the clamping, the method includes having the processor record a producer clamping indicator and a consumer clamping indicator before the corresponding producer circle indicator and consumer circle indicator associated with the producer business entity and the consumer business entity change; and having the processor further determine the state of the buffer based on the producer clamping indicator and the consumer clamping indicator.

12. The method according to claim 11, wherein, To initiate the circling process, the method further includes: The processor determines the location of the write pointer corresponding to the buffer and associated with the producer business entity; The processor determines the location of the output pointer associated with the consumer business entity; The processor further determines the state of the buffer based on the positions of the write pointer and the output pointer. In response to a full buffer, the processor restricts producer entities from writing data to the buffer or restricts consumer entities from reading data from the buffer for a predetermined duration, until an entry is deleted or added, respectively; and In response to the buffer being empty, the processor enables the producer business entity to write data to the write pointer position in the buffer, or enables the consumer business entity to read data from the output pointer position in the buffer.

13. The method according to claim 12, wherein, The clamping is initiated based on the fact that the position of the write pointer is the same as the position of the output pointer where the loop change occurs.

14. The method according to claim 12, wherein, In response to the buffer being full, the method includes the processor setting a producer flag associated with the producer business entity to 1, indicating that the buffer is full.

15. The method of claim 14, further comprising: The processor resets the positions of the consumer circle indicator and the output pointer to 0. and The processor sets the consumer flag associated with the consumer business entity to 1.

16. The method of claim 15, further comprising: With the consumer flag set to 1, the processor resets the positions of the producer circle indicator and write pointer to 0, and also resets the producer flag to 0; Based on the producer flag being set to 0, the processor sets the consumer flag to 0 and waits for data to be written to the buffer; and With the consumer flag set to 0, the processor enables the producer business entity to write data to the buffer.

17. The method of claim 14, further comprising: The processor sets the consumer flag associated with the consumer business entity, the position of the output pointer, the consumer circle indicator, and the consumer clamp indicator to be equal to the corresponding producer flag, the position of the output pointer, the producer circle indicator, and the producer clamp indicator. and The processor restricts the producer business entity from writing data until the consumer flag is 0.

18. The method according to claim 10, wherein, The buffer is empty when the producer circle indicator and the consumer circle indicator are equal and / or the position of the write pointer is equal to the position of the output pointer, and the buffer is full when the producer circle indicator and the consumer circle indicator are not equal.

19. A non-transient computer-readable medium comprising executable instructions that cause a processor to perform the following operations: Determine the producer circle indicator associated with the producer business entity corresponding to the buffer; Identify the consumer circle indicator associated with the consumer business entity; The state of the buffer is determined based on the producer circle indicator and the consumer circle indicator; and Data synchronization is initiated based on determining whether the buffer is full or empty, and by starting looping and / or clamping at the buffer.