A financial accounting dynamic deduction and simulation system based on digital twinning

CN122820362APending Publication Date: 2026-09-25LUOYANG INST OF SCI & TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202611269956.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-20
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

[0008]针对现有技术的不足,本发明提供一种基于数字孪生的财务账务动态推演与模拟系统,以解决现有系统在执行多场景并发的财务账务推演时,因复式记账流转逻辑复杂、动态内存申请频繁与线程锁竞争导致的计算吞吐量受限及数据隔离效率低下的问题

Benefits of technology

本发明通过截取底层数据库的只读视图构建有向无环图,并将传统财务中的借贷记账规则映射为带符号的实数记录与底层处理器的标量加法指令,结合分配权重系数与传导函数,将复杂的业务分摊与结转逻辑转化为内存中的指针调用与浮点乘加运算,避免了底层处理器在数据流转推演过程中频繁执行借贷条件分支判断,直接依赖算术指令完成状态更新,保障了海量数据高并发推演场景下的数据吞吐量。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122820362A_ABST
    Figure CN122820362A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of computer data processing, and discloses a financial accounting dynamic deduction and simulation system based on digital twinning, which comprises network construction, change injection, simulation deduction, concurrent control and alignment verification modules. The network construction module is used for intercepting a read-only view and constructing a directed acyclic graph representing subject dependence; the change injection module is used for converting parameters into a change vector flow with a time sequence label; the simulation deduction module is used for deriving a vector flow based on topological sorting cascade conduction; the concurrent control module is used for allocating a shadow page table, controlling states by using a state machine and adaptively degrading locks; and the alignment verification module is used for aggregating data by pointer operation and outputting a report. According to the application, borrowing and lending rules are converted into scalar addition and multiplication-addition instructions, concurrent states are isolated by using fixed-length split shadow page tables, adaptive lock degradation is combined, hash collision, memory fragmentation and lock competition are eliminated, and the computing power throughput and address resolution speed during high-concurrency deduction are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer data processing technology, specifically to a dynamic simulation and deduction system for financial accounting based on digital twins. Background Technology

[0002] As enterprises deepen their digital transformation, using computer systems for financial data analysis and future business simulation has become a crucial support for corporate decision-making. Digital twin technology provides a foundation for the dynamic calculation of financial data by constructing a virtual mirror image of the real physical world and business processes.

[0003] Among existing technical solutions, Chinese patent application CN121412273A proposes a business-finance aggregation analysis method, system, and storage medium based on digital twins. This solution addresses the problem of siloed business and financial data by unifying the semantic standards of heterogeneous data through a spatiotemporal ontology model and constructing a real-time mapping network between business entities and financial objects based on a graph database. This allows for the quantitative analysis of the dynamic impact of business changes on financial indicators such as return on investment and capital requirements. While this solution employs digital twin technology to achieve data mapping in the financial dimension, its core focus is on the aggregation of business and financial data and the linkage analysis of macroeconomic indicators. The aforementioned system does not specifically design for multi-scenario simulations of the entire underlying accounting process, and the simulation calculations do not extend to the refined processing stages such as double-entry bookkeeping, multiple account carry-forwards and allocations, and account balance verification.

[0004] To achieve simulation of specific scenarios, Chinese patent application CN121351606A discloses a business and financial sandbox simulation method and system based on virtual-real linkage. This technology constructs an isolated sandbox simulation environment by cloning real business and financial data of an enterprise, supporting the configuration of external parameters such as market fluctuations, and simulating the transmission impact of parameter changes on the enterprise's cash flow to complete stress testing. While this solution possesses a financial sandbox isolation mechanism, its simulation object is relatively singular, mainly focusing on the single financial dimension of cash flow. It lacks comprehensive support for a complete accounting subject system, underlying accounting rules, and accounting compliance verification, and cannot achieve closed-loop simulation calculation of the entire general accounting process.

[0005] Furthermore, Chinese invention patent CN117390056B proposes a method for financial forecasting data analysis and processing across all scenarios. This method constructs a financial twin space corresponding to the target business area, integrates batch planning data from the power system to form a multi-batch analysis set, and completes financial forecasting in the power scenario. However, the application scenario of this solution is strictly limited to specific budgeting and forecasting operations in the power industry. It does not involve the abstraction of the causal logic of general enterprise underlying accounting systems and the underlying data flow rules, and lacks the ability to provide a universal accounting calculation foundation applicable to the entire industry.

[0006] In summary, existing financial digital twin and extrapolation technologies generally focus on the aggregation and calculation of macro-level financial indicators or sandbox simulations of specific business dimensions. Faced with the highly complex accounting subject dependencies and multiple proportional allocation logics in real-world enterprise environments, existing systems cannot effectively simulate and execute the causal chain of fund flows based on double-entry bookkeeping at the computer level. Especially when dealing with scenarios where multiple business departments simultaneously conduct concurrent extrapolations of different plans, existing technologies lack memory state isolation and multi-threaded high-concurrency computing power optimization for massive accounting data flows. Without interfering with real-time writes to the production database, existing systems are prone to decreased computational throughput and data consistency anomalies when performing large-scale dynamic transfer calculations due to frequent memory allocation and lock contention.

[0007] Therefore, there is an urgent need in this field for a new technical solution to overcome the aforementioned bottlenecks. Summary of the Invention

[0008] To address the shortcomings of existing technologies, this invention provides a digital twin-based dynamic financial accounting simulation and deduction system. This system solves the problems of limited computational throughput and low data isolation efficiency caused by the complex double-entry bookkeeping logic, frequent dynamic memory allocation, and thread lock contention in existing systems when performing concurrent financial accounting simulations across multiple scenarios.

[0009] To achieve the above objectives, this invention provides a dynamic financial accounting simulation and deduction system based on digital twins, comprising: The network construction module is used to send snapshot instructions to the underlying database to obtain a read-only view, and to construct a directed acyclic graph representing subject dependencies based on the read-only view; The variation injection module is used to acquire simulation instructions and convert the parameters contained in the simulation instructions into a variation vector stream with time-series labels. The simulation and deduction module is used to receive the state data of the corresponding vertices in the directed acyclic graph updated by the changing vector flow, trigger the transmission function in the directed acyclic graph based on the topological sorting algorithm to generate derived vector flows, and sequentially pass the derived vector flows to the downstream target vertices to complete the cascade transmission; The concurrency control module is used to allocate shadow page tables in contiguous memory to isolate and store the derived vector streams under different concurrency scenarios, use an accounting constraint state machine to control the data read and write states of the derived vector streams, and perform adaptive lock degradation based on the thread waiting time. The alignment verification module is used to aggregate the read-only view with the derived vector stream in the shadow page table through pointer operations, verify the aggregated data according to the verification rules, and output a report.

[0010] The system provided by this invention, after acquiring historical static basic data, initializes a directed acyclic graph reflecting financial causal relationships in memory space. The system extracts financial accounting rules and converts them into directional attributes and weight coefficients on directed edges in the node structure. Combined with floating-point data type processing mechanisms, the complex loan direction judgment and allocation calculation are equivalently replaced by continuous scalar multiplication and addition operations and memory pointer calls.

[0011] The system utilizes a fixed-length partitioning strategy to divide contiguous memory space and allocate independent parallel computing slots. This decentralizes data isolation operations in concurrent scenarios to an arithmetic addressing process based on scenario indices and node sequences, replacing the system's dynamic memory allocation steps. The system monitors read / write counter variables and accumulates global balance variations using double-precision calculations. It then verifies financial loan balance by comparing against fixed tolerance limits. Combined with the coordinated control of synchronization locks and system-level mutual exclusion suspended calls, the system manages the computing power usage of the underlying concurrent processors.

[0012] Furthermore, the network construction module includes a read-only view acquisition submodule, used for: Connect to the underlying database that supports multi-version concurrency control mechanisms; The system clock is invoked to generate a global timestamp, the global timestamp is packaged into a snapshot instruction, and the snapshot instruction is sent to the underlying database; The data set whose transaction commit timestamp is less than or equal to the global timestamp is selected to form a read-only view, and the memory space of the read-only view is set to read-only access permission.

[0013] Furthermore, the network construction module includes a directed acyclic graph construction submodule, used for: The chart of accounts in the read-only view is instantiated into multiple vertex objects, each vertex object containing an account code field, an opening balance, and a balance direction coefficient determined based on the account category. Based on the preset financial carry-over rule table and account summary configuration table, source vertex objects and target vertex objects with causal dependencies are extracted from the multiple vertex objects. The causal dependencies are instantiated as directed edges connecting the source vertex objects and the target vertex objects. Transmission functions are bound to the directed edges, and the vertex objects and the directed edges together constitute the directed acyclic graph.

[0014] Furthermore, the change injection module is specifically used for: The simulation instructions obtained are analyzed to extract the deduction parameters, which specifically include the loan change amount and the date of the transaction. Based on the lending attributes, the extracted lending change amount is converted into a floating-point number representing the lending difference with positive and negative algebraic signs; The date of the business occurrence is converted into a standard epoch timestamp, and a time offset is accumulated on the standard epoch timestamp according to the array index order of the inference parameters to generate a time series label; The floating-point number representing the loan difference is structured and encapsulated with the time-series label to generate the variable vector stream with the time-series label.

[0015] Furthermore, the simulation and deduction module specifically includes: The pre-traversal submodule is used to perform pre-traversal calculations on the directed acyclic graph based on the topological sorting algorithm, and to assign topological sequence indices to each vertex object; The queue initialization unit is used to push the original variable data records contained in the variable vector stream into the priority queue, and use the time sequence label as the first sorting basis and the topological sequence index of the target vertex as the second sorting basis to establish the dequeue priority of each data record in the priority queue.

[0016] Furthermore, the simulation and deduction module also includes: The deduction execution unit is used to cyclically retrieve the current data record to be processed from the priority queue according to the dequeue priority, and address and update the balance of the corresponding target vertex in the directed acyclic graph. When the target vertex has an outward edge, the transmission function bound to the outward edge is triggered, a derived loan difference is generated according to the weighting coefficient, and a time increment is added to encapsulate it into a derived change data record; the set of the generated derived change data records constitutes the derived vector stream, and the derived change data records are pushed back into the priority queue, and the subsequent dequeue scheduling of the derived vector stream is controlled by the dequeue priority.

[0017] Furthermore, the concurrency control module includes a shadow page table allocation submodule, used for: Obtain the total number of vertices in the directed acyclic graph and the size of the preset vertex state data structure, and multiply the two to calculate the fixed length of a single shadow page table; Based on the maximum number of concurrent scenarios threshold and the fixed length, a corresponding number of fixed-length shadow page table slots are allocated in a contiguous memory space to complete the allocation of the shadow page table; Extract the scene identifier field from the concurrently received inference transactions, and dynamically bind the scene identifier field to an idle shadow page table slot; Using the starting base address of the contiguous memory space as a reference, the offset between slots is determined according to the shadow page table index number corresponding to the scene identifier field, and the state offset within the slot is determined according to the topology sequence index of the vertex to be updated. Algebraic multiplication and addition addressing operations are performed to accurately locate the physical read and write address of the derived vector stream.

[0018] Furthermore, the concurrency control module includes a read / write status control submodule, used for: The data read / write state is managed by the accounting constraint state machine, and the data read / write state is at least divided into processing state, balance verification state and consistency completion state. Update the write counter and read counter according to the enqueue and dequeue operations of the priority queue; When the write counter equals the read counter and the priority queue is cleared, the accounting constraint state machine is triggered to switch the data read / write state from the processing state to the balanced verification state.

[0019] Furthermore, the read / write state control submodule is also used to accumulate the difference between the ending balance and the beginning balance of the vertices in the shadow page table under the balance verification state. When the absolute value of the global accounting debit / credit imbalance deviation of the difference is less than the tolerance threshold, the accounting constraint state machine is triggered to switch the data read / write state to the consistency completion state.

[0020] Furthermore, the concurrency control module includes an adaptive lock degradation control submodule, used for: Assign a synchronization lock object to the priority queue; When the underlying worker thread executing the deduction transaction accesses the priority queue and fails to modify the occupied flag, the underlying worker thread is controlled to enter a spin-wait loop and the spin-wait time is calculated. When the spin wait time is greater than or equal to the wait time threshold, the adaptive lock downgrade is executed, the synchronization lock object is updated to the blocked state, and the mutex lock interface of the underlying operating system is called to switch the underlying worker thread to the blocked suspended state.

[0021] Furthermore, the alignment verification module includes an aggregation submodule, used for: After the accounting constraint state machine transitions to the consistency completion state, the baseline view base address pointer pointing to the read-only view and the incremental memory base address pointer pointing to the shadow page table are obtained. Using indexed addressing instructions, based on the baseline view base address pointer and the incremental memory base address pointer respectively, and using the topological sequence index of the vertex to be calculated as the offset, the read-only view's stock balance and the cumulative incremental difference of the shadow page table are read, and the final period-end balance is calculated by performing memory aggregation addition operation.

[0022] Furthermore, the alignment verification module includes a verification output submodule, used for: The final ending balance is sent to the rule matching engine to perform constraint verification at the subject level. The constraint verification includes blocking non-compliant data with negative fund balances and expense data that trigger budget overspending interception conditions. After constraint validation, the account code field, account name field, and final period-end balance are concatenated in memory and serialized into a report data stream for output.

[0023] Furthermore, the balance direction coefficient determined based on the account category, and the management of vertex objects, specifically include: When the matching result indicates that the accounting subject belongs to the asset or cost / expense category, the balance direction coefficient is assigned a positive constant value; When the matching result indicates that the accounting item belongs to the liability, owner's equity, or revenue category, the balance direction coefficient is assigned a negative constant value; Using the subject code field as the address key, all vertex objects are written into a hash table for unified management.

[0024] Further, the step of converting the business occurrence date into a standard epoch timestamp and generating a time series label by accumulating a time offset on the standard epoch timestamp according to the array index order of the inference parameters specifically includes: Initialize an integer counter in memory that increments from zero; For multiple change records under the same business occurrence date, the counter is called sequentially in combination with the array index, and a fixed time offset is set for accumulation to ensure that the time series labels generated by all data records under the same scenario remain monotonically increasing on the time axis.

[0025] Furthermore, when the target vertex has an outward edge, the transmission function bound to the outward edge is triggered to generate a derived loan difference based on the assigned weight coefficient, and a time increment is appended and encapsulated into a derived change data record, specifically including: Read the allocation weight coefficients in the directed edge and multiply them with the current borrowing difference to generate the derived borrowing difference; Based on the time series label of the source change record, a nanosecond-level long integer constant within a set range is added as the time increment to generate a new time series label for the derived record, so as to maintain the causal law of flow in the time dimension.

[0026] Furthermore, the step of obtaining the total number of vertices in the directed acyclic graph and the preset size of the vertex state data structure, and multiplying the two to calculate the fixed length of a single shadow page table, specifically includes: multiplying the total number of vertices in the graph by the size of the vertex state data structure, and adding memory alignment padding bytes to ensure that the fixed length of a single shadow page table is an integer multiple of the size of the underlying processor cache line, thereby improving memory read efficiency.

[0027] Furthermore, the step of concatenating the account code field, account name field, and final ending balance in memory and serializing them into a report data stream for output specifically includes: Read the preset account structure template; The subject code field and subject name field in the directed acyclic graph memory object are concatenated with the final period-end balance obtained from the aggregation calculation in memory. The assembled data set is serialized into the report data stream in the specified format, and the report data stream is returned to the application layer as the final result report of the current concurrent scenario simulation.

[0028] The financial accounting dynamic simulation and deduction system based on digital twins provided by this invention has the following beneficial effects: This invention constructs a directed acyclic graph by extracting a read-only view of the underlying database and maps the debit and credit accounting rules in traditional finance to signed real number records and scalar addition instructions of the underlying processor. By combining weighting coefficients and transfer functions, the complex business allocation and transfer logic is transformed into pointer calls and floating-point multiplication and addition operations in memory. This avoids the underlying processor frequently executing debit and credit condition branch judgments during data flow and deduction, and directly relies on arithmetic instructions to complete state updates, thus ensuring data throughput in high-concurrency deduction scenarios with massive amounts of data.

[0029] This invention employs a read-only topology structure and read / write state data separation design in the concurrency control module, and allocates shadow page tables for different concurrent tasks in contiguous memory space through a fixed-length partitioning strategy. This feature transforms state isolation in multi-scenario concurrency into algebraic multiplication-addition addressing based on base address, shadow page table index number, and topology sequence index, avoiding memory fragmentation and allocation latency caused by frequent dynamic memory allocation, and eliminating hash collisions and memory hashing overhead caused by traditional dynamic hash table isolation. It achieves efficient concurrency for multi-service scenario trial calculations with low memory usage.

[0030] This invention allocates synchronization lock objects to priority queues and, in conjunction with a waiting time threshold, executes an adaptive lock degradation mechanism from spin locks to mutexes. When handling enqueue and dequeue operations of derived vector streams, this feature maintains a user-mode spin loop for short-term conflicts to reduce the overhead of system kernel thread context switching. When faced with long-term lock occupancy, it actively triggers lock degradation and suspends the thread. This ensures that memory data structures are not corrupted by concurrent race conditions while avoiding wasted processor cycles due to continuous spinning of worker threads, thus improving the overall system performance. Attached Figure Description

[0031] Figure 1 This is a system architecture and workflow diagram according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a method for dynamic deduction and simulation of financial accounting based on digital twins according to an embodiment of the present invention; Figure 3 This is a flowchart of the sub-steps of the variable injection module receiving external parameters and converting them into a standard data format that can be calculated at the system's underlying layer, as described in this embodiment of the invention. Figure 4 This is a flowchart of the sub-steps of the simulation deduction module receiving the changing vector flow and performing algebraic operations and unidirectional flow in a directed acyclic graph in an embodiment of the present invention. Figure 5 This is a flowchart of the sub-steps of the alignment verification module performing memory aggregation operation, subject constraint verification, and generating the final output report in an embodiment of the present invention; Figure 6 A line graph comparing the system's computational throughput with the number of concurrent scenarios; Figure 7 A graph showing the comparison of memory allocation and addressing times under different methods; Figure 8 A bar chart comparing the average waiting time of threads under different synchronization lock strategies. Detailed Implementation

[0032] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0033] like Figure 1 As shown, this invention provides a dynamic financial accounting simulation and deduction system based on digital twins, comprising: The network building module is used to obtain read-only views from the underlying database and build a directed acyclic graph representing subject dependencies based on the read-only views; The variation injection module is used to acquire simulation instructions and convert the parameters contained in the simulation instructions into a variation vector stream with timing labels. The simulation and deduction module is used to receive the state data of the corresponding vertices in the directed acyclic graph updated by the changing vector flow, trigger the transmission function in the directed acyclic graph based on the topological sorting algorithm to generate derived vector flows, and then pass the derived vector flows to the downstream target vertices in sequence to complete the cascading transmission. The concurrency control module is used to allocate shadow page tables in contiguous memory to isolate and store derived vector streams under different concurrency scenarios. It uses an accounting constraint state machine to control the data read and write states of the derived vector streams and performs adaptive lock degradation based on the thread waiting time to schedule the underlying processor computing resources. The alignment verification module is used to aggregate the read-only view and the derived vector stream in the shadow page table through pointer operations, verify the aggregated data according to the verification rules, and output a report.

[0034] Based on the above system modules, see Figure 2 This invention provides a method for dynamic deduction and simulation of financial accounting based on digital twins, comprising the following steps: S10. Send a snapshot command to the underlying database to obtain a read-only view, and construct a directed acyclic graph representing subject dependencies based on the read-only view; S20. Obtain simulation instructions and convert the parameters contained in the simulation instructions into a variable vector stream with time-series labels; S30. Receive the state data of the corresponding vertex in the directed acyclic graph by the variable vector stream, trigger the transmission function in the directed acyclic graph based on the topological sorting algorithm to generate the derived vector stream, and pass the derived vector stream to the downstream target vertex in sequence to complete the cascade transmission. S40. Allocate shadow page tables in contiguous memory to isolate and store derived vector streams under different concurrency scenarios. Use an accounting constraint state machine to control the data read and write status of the derived vector streams. Perform adaptive lock degradation scheduling of underlying processor computing resources based on thread waiting time. S50. Aggregate the read-only view and the derived vector stream in the shadow page table through pointer operations, verify the aggregated data according to the verification rules, and output a report.

[0035] In this embodiment, in step S10, the network construction module sends a snapshot command to the underlying database to capture a read-only view, and constructs a directed acyclic graph representing subject dependencies based on the read-only view. This is specifically executed by the read-only view acquisition submodule and the directed acyclic graph construction submodule included in the network construction module.

[0036] The specific steps for retrieving a read-only view from a submodule are as follows: S11. Connect to the underlying database that supports multi-version concurrency control. The underlying database is a persistent storage system that stores the enterprise's real financial business records. As a specific implementation of this invention, the underlying database is specifically a relational database system that supports multi-version concurrency control. The system initiates a communication request with isolation level configuration parameters to the underlying database through the database connection pool. In this embodiment, the isolation level configuration parameters are specifically specified as snapshot isolation level to ensure that subsequent read operations are not interfered with by concurrent write transactions.

[0037] S12. The system clock is invoked to generate a global timestamp, which is then packaged into a snapshot instruction and sent to the underlying database. The system reads the hardware clock parameters of the operating system of the server or invokes a distributed unique sequence generator to generate a monotonically increasing unique global timestamp. In this embodiment, the snapshot instruction specifically includes a transaction start instruction, a snapshot isolation level setting instruction, and a global timestamp. The system packages the instruction and parameters and sends them to the transaction management component of the underlying database to request the start of a static read transaction isolated from the current real-time read and write operations in the production environment.

[0038] S13. The underlying database executes the snapshot command and captures a read-only view to obtain a static time slice. After receiving the snapshot command, the underlying database uses a multi-version concurrency control mechanism to traverse the data rows in the storage space. Based on the global timestamp carried by the snapshot command, the underlying database performs a visibility judgment on the data rows to be read, filters out the data set whose transaction commit timestamp is less than or equal to the global timestamp to form a read-only view, and sets the memory space of the read-only view to read-only access permissions.

[0039] In the underlying implementation of relational databases, multi-version concurrency control mechanisms allow the same data row to retain multiple historical updated versions on the physical storage medium. To ensure that the truncated data accurately reflects the true financial status at the global timestamp, in this embodiment, the visibility filtering condition for data rows satisfies the following formula: ; in, This represents the filtered collection of read-only view data; Represents the physical data row in the underlying database; Represents physical data rows The timestamp of the transaction commit corresponding to the most recent update operation. The timestamp is automatically assigned by the database engine when the historical transaction is committed and confirmed, and is recorded in a hidden column of the data row. This indicates the global timestamp carried by the snapshot command.

[0040] The above formula filters out all business changes that occur after the global timestamp. Even if the underlying database receives new real financial voucher write requests during subsequent system calculations, the commit timestamps generated for these new requests are all greater than the current global timestamp, and therefore appear invisible in the currently obtained read-only view. This approach achieves physical freezing and decoupling of the simulation baseline data and real-time production data without locking the actual business writes to the underlying database.

[0041] Through the above filtering process, the system receives the data set constituting the read-only view from the underlying database and sets strict read-only access permissions for the memory space allocated to the read-only view. Because the system intercepts and rejects all write operations to the memory space during the simulation process, the read-only view essentially constitutes a static time slice of the financial data at any given moment. All concurrent simulation tasks in the system read this static time slice as a shared foundational data base, preventing inconsistencies in the simulation baseline data caused by subsequent real-time addition, deletion, and modification operations on the production environment database.

[0042] The specific operations of the directed acyclic graph (DAG) construction submodule in constructing the DAG representing subject dependencies are as follows: S14. The system instantiates the chart of accounts in the read-only view into multiple vertex objects. Each vertex object contains an account code field, an opening balance, and a balance direction coefficient determined based on the account category.

[0043] The system executes a query to scan the chart of accounts in the read-only view, extracting static attribute information for all levels of accounts. This static attribute information specifically includes the account code field, balance direction coefficient field, and beginning balance field. The system initializes the underlying data structure of the directed acyclic graph (DAG) in memory. In this embodiment, the DAG is defined algebraically as a graph structure. ,in Represents the set of vertices in a graph structure. This represents the set of directed edges between vertices.

[0044] The system instantiates each extracted accounting subject as an independent vertex object in a vertex object set. To support financial logic operations in the underlying computer storage medium, the system encapsulates the vertex objects using data structuring. In this embodiment, any vertex object in the vertex object set is specifically defined in memory as a tuple structure containing multiple attribute fields: ; in, Represents the set of vertices The first in One vertex; The subject code field representing the vertex is defined as a string data type in computer memory, and its value is mapped to the accounting subject code string in real business. The balance direction coefficient field representing the vertex is defined as a short integer data type in computer memory and is used to characterize the debit and credit attributes of the corresponding account. The beginning balance field representing the vertex is defined as a double-precision floating-point data type in computer memory, and its value is directly read from the historical snapshot stock data in the read-only view; The kernel level field representing the vertex is defined as an unsigned integer data type in computer memory.

[0045] S15. In the underlying digital implementation, the system determines the balance direction coefficient based on the account category. The system has a built-in account attribute mapping table, extracting the leading number of the account code string as the matching key and comparing it in the account attribute mapping table. When the matching result shows that the accounting account belongs to the asset or cost / expense category, the system will assign a value of constant 1; when the matching result shows that the accounting account belongs to the liability, owner's equity, or revenue category, the system will assign a value of constant -1. At the underlying operation principle level, by setting the direction coefficient, the system converts the traditional debit and credit rules in accounting into signed scalar addition operations that can be directly executed by the computer processor.

[0046] S16. After completing the data structure encapsulation, the system allocates a hash table in memory space for unified management of all vertex objects. The system uses the subject code field as the address key to write all vertex objects into the hash table, so that the corresponding vertex object attributes can be directly located and read by parsing the subject code carried by the variable vector stream.

[0047] S17. Based on the preset financial carry-over rule table and account summary configuration table, the system extracts the source vertex object and the target vertex object that have causal dependencies from multiple vertex objects, and instantiates the causal dependencies into directed edges connecting the source vertex object and the target vertex object. The system binds the transmission function to the directed edges, and the vertex objects and the directed edges together form a directed acyclic graph.

[0048] The system reads the financial carry-over rule table and the account summary configuration table from the underlying database, and retrieves the corresponding source vertex object and target vertex object from the hash table. For two vertex objects with a causal dependency, the system instantiates a directed edge object in memory and adds the directed edge object to the directed edge set of the directed acyclic graph. In this embodiment, any directed edge is defined as a tuple structure containing attribute fields: ; in, Indicates from the source vertex Point to target vertex The directed edges; This represents the source vertex that provides the source of data changes, which is specifically represented in the underlying memory as a memory address reference of the source vertex object; This represents the target vertex that receives the data, which is specifically represented in the underlying memory as a memory address reference of the target vertex object; This represents the weighting coefficient, which is defined as a double-precision floating-point data type in computer memory. It is used to characterize the proportional relationship when source vertex data flows to target vertex, and its value range is a floating-point number greater than 0 and less than or equal to 1. This represents a pointer to a transfer function, used to bind specific numerical calculation rules.

[0049] To unify the underlying computation model, the system matches a corresponding transfer function for each directed edge based on the type of financial transaction. The numerical calculation rules for the transfer function definition satisfy the following standard algebraic formula: ; in, Represents the target vertex The received derived increment value is defined as a double-precision floating-point data type in computer memory; Represents the source vertex The initial change value is defined as a double-precision floating-point data type in computer memory; This represents the weighting coefficient.

[0050] After instantiating all directed edges and binding their transmission functions, the system traverses the set of directed edges to perform cycle checks, verifying that there are no circular dependencies between nodes and ensuring that the constructed graph structure strictly satisfies the topological mathematical properties of a directed acyclic graph. Ultimately, the instantiated vertex objects and directed edges together constitute a directed acyclic graph.

[0051] See Figure 3 In this embodiment, step S20 involves the variable injection module receiving external parameters and converting them into a standard data format that the system's underlying layer can compute. This can be broken down into the following sub-steps: S21. The system obtains simulation instructions through the application programming interface (API), parses the obtained simulation instructions to extract deduction parameters, which specifically include the loan / borrowing change amount and the transaction date. The simulation instructions can be encapsulated in a lightweight data exchange format; in this embodiment, the lightweight data exchange format is specifically JSON or XML. The system calls the message parsing component to deserialize the simulation instructions, parses and extracts the deduction parameters according to the preset parameter mapping table.

[0052] In this embodiment, in addition to the loan change amount and the transaction date, the inference parameters also include concurrent scenario identifiers and related account codes. To ensure the legality and validity of the data injected into the underlying memory, the system performs a legality check on the account codes during the extraction process to verify that all extracted account codes exist in the hash table initialized by the network construction module.

[0053] S22. To convert the derivation parameters into standard inputs that can flow and be computed in a directed acyclic graph, the system performs structured encapsulation in memory, generating a change vector stream with time-series labels. In this embodiment, the change vector stream is defined as an ordered set of multiple data records, and each data record in the set is defined in memory as a tuple structure containing attribute fields. ; in, Represents the first in the variable vector flow One data record; The scene identifier field is defined as a globally unique identifier data type in computer memory, used to distinguish concurrent simulation data under different simulation scenarios in memory space; The accounting subject code field is defined as a string data type in computer memory and serves as the address key for locating vertices in a directed acyclic graph. The field representing the loan difference is defined as a double-precision floating-point data type in computer memory; This indicates a time-series tag field, which is defined as a long integer data type in computer memory.

[0054] S23. The system converts the extracted loan change amount into a floating-point number representing the loan difference with positive and negative algebraic signs based on the loan attributes. After extracting the loan change amount from the derivation parameters, the system maps the amount value to a low-level algebraic form according to preset sign conversion rules to generate a floating-point number representing the loan difference (i.e., the aforementioned loan difference field). The debit / credit difference floating-point number is defined as a double-precision floating-point data type in computer memory. In this embodiment, the system converts the amount value with the debit attribute in the input parameters into a positive floating-point number, and the amount value with the credit attribute into a negative floating-point number.

[0055] At the underlying computational level, symbolic assignment operations, combined with predefined account balance direction coefficients in the network construction module, ensure that balance updates for any type of accounting account can be uniformly performed using scalar addition instructions from the underlying processor. For example, when a positive floating-point debit change acts on an asset account, the positive direction coefficient of the asset account results in a positive increasing balance; conversely, when a positive floating-point debit change acts on a liability account, the negative direction coefficient of the liability account results in a negative decreasing balance after underlying computation. By unifying the algebraic notation system, frequent debit / credit direction logic branch checks are avoided by the underlying processor during calculations.

[0056] S24. The system converts the business occurrence date into a standard epoch timestamp and accumulates a time offset on the standard epoch timestamp according to the array index order of the projection parameters to generate a time series label. The dynamic evolution of financial accounts has a strict causal relationship, and the data records injected into the directed acyclic graph must have a clear time sorting benchmark. The system reads the business occurrence date string from the projection parameters, calls the operating system time processing library to convert the date string into a standard epoch timestamp, and assigns the standard epoch timestamp to the time series label field. .

[0057] In real-world scenarios with multiple concurrent business transactions, the inference parameters include multiple change records for the same transaction date. To address the issue of overlapping times, the system extracts the array index order of the records in the original JSON message and accumulates a fixed time offset based on the standard epoch timestamp. In this embodiment, the system initializes an integer counter in memory that increments from zero, calls the counter in conjunction with the array index order, and sets the fixed time offset to an integer value between 1ms and 999ms. By accumulating the time offset, the system ensures that the time series labels generated by all data records in the same scenario remain monotonically increasing on the timeline.

[0058] S25. The system encapsulates the floating-point number of the loan difference with the time sequence label in a structured manner, generating a change vector stream with the time sequence label. The system encapsulates the converted floating-point number of the loan difference, the time sequence label, the scene identifier field, and the accounting subject code field into the above-mentioned tuple structure, completing the construction of the change vector stream and providing a data foundation for the subsequent simulation and deduction module to determine the calculation priority of graph nodes.

[0059] See Figure 4 In this embodiment, in step S30, the simulation deduction module receives the state data of the corresponding vertices in the directed acyclic graph from the changing vector flow, triggers the transmission function in the directed acyclic graph based on the topological sorting algorithm to generate a derived vector flow, and sequentially passes the derived vector flow to the downstream target vertex to complete the cascade transmission. The specific implementation method is as follows: S31. Before the formal start of the simulation, the system performs a pre-traversal calculation of the directed acyclic graph based on the topological sorting algorithm, assigning a topological sequence index to each vertex object. The topological sequence index field is defined as an unsigned integer data type in computer memory. The system stipulates that vertex objects at the source of a dependency link have smaller index values, and vertex objects at the end of a link have larger index values.

[0060] S32. The system initializes a priority queue in memory, pushes the original variable data records contained in the variable vector stream into the priority queue, and establishes the dequeue priority of each data record within the priority queue by using the time sequence label as the first sorting criterion and the topological sequence index of the target vertex as the second sorting criterion. When two data records have the same time sequence label, the data record with the smaller topological sequence index value of the target vertex is dequeued from the priority queue first. By setting a dual sorting criterion, the system avoids concurrent flow errors where downstream summary accounts are calculated in advance before upstream detailed accounts are calculated, ensuring that the order of graph node calculations conforms to the true financial causal logic.

[0061] S33. Based on the dequeue priority, the system iteratively retrieves the current pending data record from the priority queue and updates the balance of the corresponding target vertex in the directed acyclic graph. The system iteratively retrieves the data record at the head of the priority queue and locates the target vertex object in the directed acyclic graph based on the accounting subject code field contained in the data record. The system reads the current balance of the target vertex object and performs a vertex state update operation. In this embodiment, the vertex state update satisfies the following algebraic formula: ; in, Represents vertices The updated period-end balance field is defined in memory as a double-precision floating-point data type; Represents vertices The current balance field before the update has the same value as the beginning balance field in the initial state. ; The field representing the balance direction coefficient of the vertex; This indicates the debit / credit difference field carried by the data record.

[0062] S34. After completing the vertex state update, if the target vertex has an outward edge, the propagation function bound to the outward edge is triggered, and the derived loan / debit difference is generated based on the assigned weight coefficients. The system checks whether the current target vertex object has outward-pointing directed edges. When the vertex has an outward edge, the system triggers the propagation function bound to the directed edge based on the underlying memory pointer. In real financial transactions, changes in funds often trigger chain reactions. The system reads the assigned weight coefficients from the directed edge and performs derived value calculations. In this embodiment, the derived loan / debit difference calculation satisfies the following algebraic formula: ; in, Indicates generation to the target vertex The derived debit / credit difference is defined as a double-precision floating-point data type in computer memory; This field represents the difference between borrowing and lending amounts. This represents the weight coefficient assigned to the directed edge.

[0063] S35. The system adds a time increment to the derived loan difference and encapsulates it as a derived change data record. The set of generated derived change data records constitutes a derived vector stream, and the derived change data records are pushed back into a priority queue. The subsequent dequeue scheduling of the derived vector stream is controlled by the dequeue priority. To maintain the causal law of the flow in the time dimension, the system adds a time increment to the time sequence label of the source change record as a new time sequence label for the derived record.

[0064] In this embodiment, the time increment is uniformly set in memory to a long integer constant between 1000 nanoseconds and 50000 nanoseconds. The system encapsulates information such as derived loan difference and new time series tags into derived change data records, forming a derived vector stream, and pushes it back into the priority queue. The derived change data records, along with the externally injected original change records, participate in the dequeue priority sorting and scheduling in the priority queue.

[0065] In this embodiment, the sequential transmission and cascading propagation of derived vector flows in the directed acyclic graph are manifested as a dynamic cyclic process. When the out-degree of a vertex is zero, it indicates that the data has flowed to the end node of the business link, and the system does not trigger a derivation action. As the deduction proceeds, the system continuously consumes records in the priority queue and updates the vertex balance. When the priority queue is completely empty and there are no more threads in an active computing state in memory, the system meets the flow termination condition and determines that the deduction has ended, completing the entire cascading propagation process. At this time, the updated vertex state data becomes the basis for the static financial statement data after the deduction ends.

[0066] In this embodiment, in step S40, the concurrency control module allocates shadow page tables in contiguous memory to isolate and store derived vector streams under different concurrency scenarios. It uses an accounting constraint state machine to control the data read / write state of the derived vector streams and performs adaptive lock degradation based on thread waiting time to schedule underlying processor computing resources. Specifically, this is executed by the shadow page table allocation submodule, read / write state control submodule, and adaptive lock degradation control submodule included in the concurrency control module.

[0067] The shadow page table allocation submodule performs the following operations for allocating and addressing shadow page tables: S41. Obtain the total number of vertices in the directed acyclic graph and the preset size of the vertex state data structure, then multiply the two to calculate the fixed length of a single shadow page table. During the initialization phase, the system calls the underlying operating system's memory allocation interface to allocate contiguous memory space in virtual memory. To avoid memory fragmentation and allocation latency caused by frequent dynamic memory requests during concurrent simulations, the system adopts a fixed-length partitioning strategy. In this embodiment, the fixed length calculation of a single page table satisfies the following algebraic formula: ; in, This represents the total length of a single shadow page table in bytes, and is defined as an unsigned integer data type in computer memory. It represents the total number of vertices in a directed acyclic graph, and is defined as an unsigned integer data type in computer memory; The size of the data structure representing the state of a single vertex is defined as an unsigned integer data type in computer memory. The value is obtained by summing the data type lengths of dynamic attribute fields such as vertex balance. This represents the number of bytes used for memory alignment padding. The value is an integer ranging from 0 to 64. It is used to ensure that the page table length is an integer multiple of the underlying processor's cache line size, thereby improving memory read efficiency.

[0068] S42. Based on the maximum concurrency threshold and a fixed length, allocate a corresponding number of fixed-length shadow page table slots in contiguous memory space to complete the allocation of shadow page tables. The total size of the allocated contiguous memory space is the product of the fixed length and the maximum concurrency threshold, and the system divides it into multiple contiguous fixed-length shadow page table slots.

[0069] S43. Extract the scenario identifier field from the concurrently received deduction transactions and dynamically bind the scenario identifier field to an idle shadow page table slot. In real financial trial calculation business, for multiple concurrent scenarios, the directed acyclic graph is read by all concurrent threads as a globally shared read-only template. The system binds the extracted scenario identifier field to the idle slot, and the derived vector stream under the specific scenario is isolated and stored in the bound shadow page table.

[0070] S44. Using the starting base address of the contiguous memory space as a reference, determine the slot offset based on the shadow page table index number corresponding to the scene identifier field, and determine the slot state offset based on the topology sequence index of the vertex to be updated. Perform algebraic multiplication-addition addressing operations to accurately locate the physical read / write address of the derived vector stream data. In this embodiment, the addressing operation satisfies the following formula: ; in, It represents the absolute address of the target vertex state data in contiguous memory space, and is defined as a pointer data type in computer memory; It represents the starting base address of a contiguous memory space and is defined as a pointer data type in computer memory; This represents the shadow page table index number bound to the current concurrent scenario. The value range is an integer greater than or equal to 0 and less than the maximum number of concurrent scenarios threshold. Represents the topological sequence index of a vertex, with values ​​greater than or equal to 0 and less than 0. Integers.

[0071] The specific operations of the read / write status control submodule for controlling the data read / write status are as follows: S45. Data read / write states are managed through an accounting constraint state machine. These states are at least divided into processing, balance verification, and consistency completion states. The system initializes an accounting constraint state machine object in memory for each shadow page table instance to manage the data read / write states.

[0072] S46. Update the write counter and read counter according to the enqueue and dequeue operations of the priority queue. When the change injection module pushes initial data records into the priority queue bound to the shadow page table, the state machine updates the data read / write state to the processing state. During the processing state, when a data record is removed from the queue, the system controls the read counter to increment; when a derived vector stream is generated and re-pushed into the queue, the system controls the write counter to increment.

[0073] S47. When the write counter equals the read counter and the priority queue is empty, the accounting constraint state machine is triggered to transition the data read / write state from the processing state to the balanced verification state. At this time, it is determined that all derived vector streams in the current concurrent scenario have completed their flow, and the system simultaneously locks the write permissions of the current shadow page table. S48. In the balanced verification state, the difference between the ending balance and the beginning balance of each vertex in the shadow page table is accumulated. In this embodiment, the absolute value of the global debit-credit imbalance deviation of the difference is calculated. : In this embodiment, the bookkeeping balance determination satisfies the following algebraic formula: ; in, It represents the absolute value of the global debit-credit imbalance, and is defined as a double-precision floating-point data type in computer memory; It represents the total number of vertices in a directed acyclic graph, and is defined as an unsigned integer data type in computer memory; Represents the topological sequence index of a vertex, with values ​​ranging from 0 to... Integers; This indicates that the topological sequence index of the record in the shadow page table is The vertex ending balance is defined in memory as a double-precision floating-point data type; This represents the initial balance of the corresponding vertex in the read-only template of the directed acyclic graph read before the simulation starts. It is defined as a double-precision floating-point data type in memory.

[0074] The adaptive lock degradation control submodule performs lock scheduling operations as follows: S49. Allocate a synchronization lock object to the priority queue. The synchronization lock object contains an occupancy flag and a lock status identifier field in its memory structure to prevent concurrent race conditions from corrupting memory data.

[0075] S410. When the underlying worker thread executing the deduced transaction accesses the priority queue and fails to modify the occupancy flag, the system controls the underlying worker thread to enter a spin-wait loop and calculates the spin-wait time. When the worker thread requests access and fails to modify the occupancy flag (indicating that the lock is currently occupied), the system records the lock request start time and enters a spin-wait loop in user mode, calculating the spin-wait time by subtracting the lock request start time from the current high-precision system timestamp.

[0076] S411. When the spin wait time is greater than or equal to the wait time threshold, adaptive lock degradation is executed, updating the synchronization lock object to the blocked state and calling the underlying operating system's mutex lock interface to switch the underlying worker thread to a blocked suspended state. When the spin wait time is less than the wait time threshold, the system determines it is a short-term conflict, and the thread continues to spin; when it is greater than or equal to the wait time threshold, the system determines there is a long-term lock holding, triggering adaptive lock degradation, updating the synchronization lock object's state flag to the blocked state, and suspending the thread in the waiting queue through the operating system's mutex lock interface, actively yielding processor time slices. After the holding thread releases the lock, the suspended thread is woken up to resume operation.

[0077] See Figure 5 In this embodiment, in step S50, the alignment verification module aggregates the read-only view and the derived vector stream in the shadow page table through pointer operations, verifies the aggregated data according to the verification rules, and outputs a report. Specifically, this is performed by the aggregation submodule and the verification output submodule included in the alignment verification module.

[0078] The aggregation submodule performs the aggregation operation as follows: S51. After the accounting constraint state machine transitions to the consistency completion state, obtain the baseline view base address pointer pointing to the read-only view and the incremental memory base address pointer pointing to the shadow page table.

[0079] When the finite state machine (i.e., the accounting constraint state machine) in the concurrency control module transitions to the consistency completion state, the aggregation submodule receives an execution signal, and the system releases the memory lock on the shadow page table of the current concurrency scenario.

[0080] In this embodiment, in the design of the computer's underlying memory architecture, since the enterprise financial system contains massive amounts of account node data, allocating the full ledger to each thread during multi-scenario concurrent simulations could easily lead to memory exhaustion. To solve the memory consumption problem, the system adopts a structure that separates baseline stock sharing with incremental records in the shadow page table. After the simulation ends, the system obtains the baseline view base address pointer pointing to the directed acyclic graph static read-only memory region in memory, and obtains the incremental memory base address pointer pointing to the shadow page table of the current scenario.

[0081] S52. Using indexed addressing instructions, based on the baseline view base address pointer and the incremental memory base address pointer respectively, and using the topological sequence index of the vertex to be calculated as the offset, the read-only view's stock balance and the cumulative incremental difference of the shadow page table are read, and the memory aggregation addition operation is performed to calculate the final period-end balance.

[0082] The system traverses the vertex sequence of the directed acyclic graph, using the topological sequence index of the vertex as the offset, and utilizes the indexed addressing instructions of the underlying processor to simultaneously locate the existing basic data address and the incremental state data address of the target vertex. In real financial trial calculations, the static existing balance represents the initial book data, and the incremental difference generated by the calculation represents the net amount incurred during the calculation period. The two data are combined to form the calculated ending book data. In this embodiment, the memory aggregation addition operation satisfies the following algebraic formula: ; in, Represents vertices The final ending balance after aggregation is defined as a double-precision floating-point data type in computer memory; This indicates the vertex read via the baseline view base address pointer. The read-only inventory balance is defined as a double-precision floating-point data type in computer memory; This represents the vertex in the shadow page table read via incremental memory base address pointer addressing. The cumulative increment difference is defined as a double-precision floating-point data type in computer memory; Represents the topological sequence index of a vertex, with values ​​ranging from 0 to... integers, This represents the total number of vertices in a directed acyclic graph.

[0083] The review output submodule performs the review and output operations as follows: S53. Send the final ending balance to the rule matching engine to perform constraint verification at the subject level. Constraint verification includes blocking non-compliant data with negative fund balances and expense data that trigger budget overspending interception conditions.

[0084] After completing the memory aggregation of all vertices, the system calls the verification rules to review the aggregated data. Since the front-end concurrency control module has already completed the global loan balance verification, the alignment verification module focuses on the compliance verification of specific business accounts. The system sends the aggregated final period-end balance to the rule matching engine to perform constraint verification at the account level.

[0085] The system extracts the final ending balance of asset accounts and verifies whether the value is less than 0 to block non-compliant data with negative cash balances. The system compares the final ending balance of expense accounts with the pre-loaded budget limit field to determine whether the budget overspending interception condition has been triggered. When the aggregated data fails to pass the verification rules, the system generates a verification exception flag in memory and interrupts the output process.

[0086] S54. After constraint validation, the account code field, account name field and final period-end balance are concatenated in memory and serialized into a report data stream for output.

[0087] When the aggregated data passes all constraint validation rules, the system encapsulates and outputs a report. The system reads a preset account structure template and concatenates the account code field, account name field, and the final period-end balance calculated from the aggregated data in memory within the directed acyclic graph in-memory object. The system then serializes the concatenated data set into a report data stream in JSON or CSV format. The serialized report data stream is returned to the application layer as the final result report of the current concurrent scenario simulation, completing the entire simulation lifecycle.

[0088] To aid in understanding the underlying operational logic of this invention, the following detailed explanation of the numerical calculation and workflow of each module is provided using a concurrent scenario where manufacturing costs are proportionally allocated to the production costs of multiple products.

[0089] Network construction phase: Assuming the system uses a global timestamp Continuously capture read-only views of the underlying database. The capture rules satisfy the formula: ; The system from Three key accounting items were extracted and instantiated as vertices of a directed acyclic graph: Bank deposits ( ): This represents a debit account (direction coefficient 1) with an initial balance of 500,000 yuan.

[0090] Manufacturing costs ( ): This represents a debit account with an initial balance of 0 yuan.

[0091] Product A (production cost) ): This represents a debit account with an initial balance of 20,000 yuan.

[0092] Product B (production cost) ): This represents a debit account with an initial balance of 30,000 yuan.

[0093] Based on the financial carry-forward rules table, the system establishes directed edges for proportional allocation between vertices. Assume business regulations stipulate that manufacturing costs are allocated to product A and product B at 60% and 40% respectively: side ; side .

[0094] Change injection phase: The system receives a simulation instruction to pay 10,000 yuan in current manufacturing costs via bank deposit. The system parses and generates a time-stamped change vector stream, which is then pushed into a priority queue. Record 1 (Credit to Bank Deposit) (The credit is converted to a negative floating-point number); Record 2 (Debit Manufacturing Overhead): (Debit converted to positive floating-point number).

[0095] Simulation and cascading stage: The system retrieves record 1 from the queue and performs a vertex state update operation. The formula is as follows: ; Substitute the values: for (Bank deposits) .

[0096] The system retrieves record 2 and performs... (Manufacturing Costs) Updated: .

[0097] At this time, the system detected There are two outgoing edges and This immediately triggers the derived pass function.

[0098] The derivation calculation formula is as follows: ; When allocating to product A, substitute the values ​​to derive the increment as follows: .

[0099] When allocating to product B, substitute the values ​​to derive the increment as follows: .

[0100] At the same time, the system automatically generates its own carry-forward and deduction records for manufacturing costs. To complete the settlement.

[0101] After the derived record is added to the queue, it is dequeued again and recalculated, updating the terminal account balance: Product A ( The balance is updated to: 20000.00 + 1 × 6000.00 = 26000.00.

[0102] Product B ( The balance is updated to: 30000.00 + 1 × 4000.00 = 34000.00.

[0103] Concurrency control and accounting balance verification phase: After the queue is emptied, the finite state machine enters the equilibrium check state and executes the following formula to determine the status: ; Substitute the change difference for the current period into the summation: .

[0104] because The system determines that the deduction conforms to the double-entry bookkeeping rule that every debit must have a corresponding credit, and the total debits and credits must equal each other, and the state transitions to a consistent completed state.

[0105] Alignment verification and aggregation phase: The system releases the read-write lock on the memory shadow page table and performs an aggregation operation on the existing and incremental values. The formula is as follows: ; Substitute the value: Final report balance of Product A After data aggregation and legality verification, the final simulated financial report is output.

[0106] To conduct experimental verification and performance comparison, this embodiment establishes a comparative test environment to verify the data processing capabilities and execution efficiency of the system of the present invention in complex financial simulation processes. The test server hardware configuration includes a 64-core CPU and 256GB RAM. The test process compares the various technical indicators of the system of the present invention with those of a traditional concurrent accounting system.

[0107] See Figure 6 The test system's transaction processing throughput under different concurrent simulation scenarios was performed. The X-axis represents the number of concurrent scenarios, and the Y-axis represents the system throughput. The data shows that when the concurrency reaches 100, the traditional system experiences a peak throughput of approximately 2800 TPS due to its reliance on the underlying relational database's transaction control. As concurrency continues to increase, processing efficiency declines due to constraints such as database row-level lock contention, disk I / O queuing, and frequent thread context switching.

[0108] This invention utilizes a directed acyclic graph (DAG) as a read-only template to isolate concurrent data into shadow page tables in memory, transforming the original database transactions into pure in-memory computations. Test data shows that the throughput of this system maintains good growth with increasing concurrency, reaching approximately 14,500 TPS in a 500-concurrency scenario. The test results verify that the pure in-memory arithmetic operations and read-write separation structure of this invention can avoid database lock contention and significantly improve the throughput in high-density concurrency scenarios within a reasonable range.

[0109] See Figure 7 This tests the time required to locate target vertex data when the number of accounting subjects increases. The X-axis represents the total number of vertices in the graph, and the Y-axis represents the average addressing time. Figure 7 The results show that in systems using traditional dynamic hash table allocation, addressing time increases non-linearly with the number of vertices. This is mainly because the probability of hash collisions increases as the hash table size grows, leading to a longer secondary lookup process and a decreased CPU cache hit rate. This invention employs a shadow page table mechanism, using a base address pointer combined with a topological sequence index offset for data location.

[0110] Test data shows that regardless of the size of the graph vertices, the addressing time of the system of this invention remains within a low latency range of 0.8μs to 1.5μs. As the number of vertices increases, the time consumption only fluctuates slightly due to the physical influence of the CPU's multi-level cache (L1 / L2 / L3Cache) hit rate, without the exponential growth seen in traditional hash tables. The data verifies that the fixed-length partitioning and offset algorithm of this invention transforms structural queries into basic algebraic addressing operations with a time complexity approaching O(1), effectively ensuring addressing stability under massive subject loads.

[0111] like Figure 8 As shown, the efficiency of lock control in handling thread access conflicts is tested. The experiment injects 10,000 business instructions with concentrated concurrency conflict attributes and compares the average thread waiting time under three locking strategies. Figure 8 Data shows that, under the same test case, the average waiting time using the mutex lock strategy is 86.4ms (due to the overhead of a large number of thread suspensions and kernel mode switching); the average waiting time using the spinlock strategy is 112.5ms (due to long-cycle conflicts causing CPU idling and waste).

[0112] The concurrency control module of this invention employs an adaptive lock degradation strategy, reducing the average waiting time to 41.2ms. The results show that, combined with the time threshold judgment condition, the scheme of this invention maintains a spin state to prevent thread suspension during short-cycle conflicts and actively degrades to release processor resources during long-cycle conflicts. This hybrid strategy achieves a reasonable balance in a multi-threaded concurrent environment, effectively reducing the overall waiting latency.

Claims

1. A dynamic financial accounting simulation and deduction system based on digital twins, characterized in that, include: The network construction module is used to obtain a read-only view from the underlying database and construct a directed acyclic graph representing subject dependencies based on the read-only view; The variation injection module is used to acquire simulation instructions and convert the parameters contained in the simulation instructions into a variation vector stream with time-series labels. The simulation and deduction module is used to receive the state data of the corresponding vertices in the directed acyclic graph updated by the changing vector flow, trigger the transmission function in the directed acyclic graph based on the topological sorting algorithm to generate derived vector flows, and sequentially pass the derived vector flows to the downstream target vertices to complete the cascade transmission; The concurrency control module is used to allocate shadow page tables in contiguous memory to isolate and store the derived vector streams under different concurrency scenarios, use an accounting constraint state machine to control the data read and write states of the derived vector streams, and perform adaptive lock degradation based on the thread waiting time. The alignment verification module is used to aggregate the read-only view with the derived vector stream in the shadow page table through pointer operations, verify the aggregated data according to the verification rules, and output a report.

2. The financial accounting dynamic deduction and simulation system based on digital twins according to claim 1, characterized in that, The network construction module includes a read-only view acquisition submodule, used for: Connect to the underlying database; Generate a global timestamp, package the global timestamp into a snapshot instruction, and send it to the underlying database; The data set whose transaction commit timestamp is less than or equal to the global timestamp is selected to form a read-only view, and the memory space of the read-only view is set to read-only access permission.

3. The financial accounting dynamic deduction and simulation system based on digital twins according to claim 1, characterized in that, The network construction module includes a directed acyclic graph construction submodule, used for: Instantiate the chart of accounts in the read-only view into multiple vertex objects; Based on the preset financial carry-over rule table and account summary configuration table, source vertex objects and target vertex objects with causal dependencies are extracted from the multiple vertex objects. The causal dependencies are instantiated as directed edges connecting the source vertex objects and the target vertex objects. Transmission functions are bound to the directed edges, and the vertex objects and the directed edges together constitute the directed acyclic graph.

4. The financial accounting dynamic deduction and simulation system based on digital twins according to claim 1, characterized in that, The change injection module is specifically used for: The simulation instructions are analyzed to extract the projection parameters, which include the loan change amount and the date of the transaction. Based on the lending attributes, the amount of the lending change is converted into a floating-point number representing the lending difference; The date of the business occurrence is converted into a standard epoch timestamp, and a time offset is accumulated on the standard epoch timestamp according to the array index order of the inference parameters to generate a time series label; The floating-point number representing the loan difference is encapsulated with the time-series label to generate the variable vector stream with the time-series label.

5. A dynamic financial accounting simulation and deduction system based on digital twins according to claim 1, characterized in that, The simulation module includes: The pre-traversal submodule is used to perform pre-traversal calculations on the directed acyclic graph based on the topological sorting algorithm, and to assign topological sequence indices to each vertex object; The queue initialization unit is used to push the original variable data records contained in the variable vector stream into the priority queue, and use the time sequence label as the first sorting basis and the topological sequence index of the target vertex as the second sorting basis to establish the dequeue priority of each data record in the priority queue.

6. A dynamic financial accounting simulation and deduction system based on digital twins according to claim 5, characterized in that, The simulation module also includes: The derivation execution unit is used to cyclically retrieve the current pending data record from the priority queue according to the dequeue priority, and address and update the balance of the corresponding target vertex in the directed acyclic graph; when the target vertex has an outward edge, the transmission function bound to the outward edge is triggered, a derived loan difference is generated according to the assigned weight coefficient, and a time increment is added to encapsulate it into a derived change data record; the set of the generated derived change data records constitutes the derived vector stream, and the derived change data records are pushed back into the priority queue, and the subsequent dequeue scheduling of the derived vector stream is controlled by the dequeue priority.

7. A dynamic financial accounting simulation and deduction system based on digital twins according to claim 5, characterized in that, The concurrency control module includes a shadow page table allocation submodule, used for: Obtain the total number of vertices in the directed acyclic graph and the size of the vertex state data structure, and multiply the two to calculate the fixed length of a single shadow page table; Based on the maximum concurrency threshold and the fixed length, allocate a corresponding number of fixed-length shadow page table slots in contiguous memory space; Extract the scene identifier field from the concurrently received inference transactions, and dynamically bind the scene identifier field to an idle shadow page table slot; Using the starting base address of the contiguous memory space as a reference, the offset between slots is determined according to the shadow page table index number corresponding to the scene identifier field, and the state offset within the slot is determined according to the topology sequence index of the vertex to be updated. Algebraic multiplication and addition addressing operations are performed to locate the physical read / write address of the derived vector stream.

8. A dynamic financial accounting simulation and deduction system based on digital twins according to claim 6, characterized in that, The concurrency control module includes a read / write status control submodule, used for: The data read / write state is managed by the accounting constraint state machine, and the data read / write state is divided into processing state, balance verification state and consistency completion state. Update the write counter and read counter according to the enqueue and dequeue operations of the priority queue; When the write counter equals the read counter and the priority queue is cleared, the data read / write state is switched from the processing state to the balanced check state.

9. A dynamic financial accounting simulation and deduction system based on digital twins according to claim 8, characterized in that, The read / write state control submodule is also used for: In the balance verification state, the difference between the ending balance and the beginning balance of each vertex in the shadow page table is accumulated. When the absolute value of the global accounting debit-credit imbalance deviation of the difference is less than the tolerance threshold, the data read / write state is switched to the consistency completion state.

10. A dynamic financial accounting simulation and deduction system based on digital twins according to claim 6, characterized in that, The concurrency control module includes an adaptive lock degradation control submodule, used for: Assign a synchronization lock object to the priority queue; When the underlying worker thread accesses the priority queue and fails to modify the occupied flag, the underlying worker thread is controlled to enter a spin-wait loop and the spin-wait time is calculated. When the spin wait time is greater than or equal to the wait time threshold, the adaptive lock downgrade is executed, the synchronization lock object is updated to the blocked state, and the mutex lock interface is called to switch the underlying worker thread to the blocked suspended state.

Citation Information

Patent Citations

  • Financial full-scenario forecasting data analysis and processing method

    CN117390056B

  • Business and financial sandbox deduction method and system based on virtual-real linkage

    CN121351606A

  • Business and financial aggregation analysis method and system based on digital twinning and storage medium

    CN121412273A