Four-level data automatic identification and adaptation method based on C # architecture

By monitoring threads in real time to access war loss data and using machine learning models to identify competitive risks, dynamically adjust the priority of read and write locks, the war loss state abnormalities caused by access competition in the combat deduction system are solved, and the system's stability and decision-making support capabilities are improved.

CN120335960AActive Publication Date: 2025-07-18ANHUI GUOWEI COMM ENG CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510400792.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-01
Publication Date
2025-07-18
Estimated Expiration
2045-04-01

AI Technical Summary

Technical Problem

The existing technology's automatic identification and adaptation mechanism for combat loss status cannot be adaptively adjusted based on access competition conditions, resulting in the combat unit still maintaining an "invincible" state after being attacked, seriously distorting the combat logic and misleading decisions.

Method used

By monitoring threads to access war loss data in real time, building thread access competition data analysis sets, and using machine learning models to intelligently identify competitive risks, dynamically adjust read and write lock priorities to optimize resource allocation in a high concurrency environment and prevent "invincible units" or "war loss superposition" exceptions.

Benefits of technology

It improves the authenticity and decision-making support capabilities of combat deduction, ensures that the commander makes reasonable deployment based on accurate data, and improves the stability and reliability of the combat simulation system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335960A_ABST
    Figure CN120335960A_ABST
Patent Text Reader

Abstract

The invention discloses a C # architecture-based four-level data automatic identification and adaptation method, and relates to the technical field of wargame combat deduction, and the method comprises the following steps: during combat deduction, monitoring and recording the combat damage data access condition of each thread to a combat unit in real time, and constructing a thread access competition data analysis set; for the established analysis set, key indexes related to access competition loads are extracted, and the extracted thread access competition key indexes are deeply analyzed; according to the method, the thread competition risk is intelligently recognized through the machine learning model, competition hotspots can be accurately detected in a high-concurrency environment, and resource allocation is dynamically optimized. Particularly, self-adaptive adjustment is performed on the priority of the read-write lock based on a competition load prediction result, so that the query efficiency is improved in a low-competition environment, the update of war damage data is preferentially guaranteed in a high-competition environment, the problem of data lag is reduced, and the occurrence of unenemy unit or war damage superposition abnormity is prevented.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of wargame operation deduction, and specifically relates to a method for automatic recognition and adaptation of four-level data based on a C# architecture. Background Art

[0002] The automatic recognition and adaptation of four-level data based on a C# architecture refers to, in a computer wargame system, automatically parsing and matching the data structures of four levels through a framework built with the C# language to achieve real-time detection and response to the states of equipment components on various combat platforms. Specifically, as the smallest unit for performing independent actions, the functions of operators not only depend on the diverse components carried by the platforms they belong to (such as individual soldiers, tanks, airplanes, ships, etc.), but are also jointly affected by the current states of these components (such as whether they are ready or damaged) and the states of the basic accessories they depend on (such as existence and resource consumption). The system realizes accurate data adaptation and dynamic response by automatically identifying the four data levels of platforms, components, states, and accessories, thereby ensuring the true reflection and efficient operation of the functions of each unit during the deduction process.

[0003] The prior art has the following deficiencies:

[0004] In a combat deduction system based on a four-level data structure, the automatic recognition and adaptation mechanism for battle damage status in the prior art cannot be adaptively adjusted according to access competition situations. When this automatic recognition and adaptation mechanism fails due to access competition conditions, it may lead to anomalies where battle damage does not take effect, causing some combat units (such as tanks, ships, and fighter jets) to remain "invincible" even after being severely attacked. This will seriously distort the combat logic, turn the deduction into a one-sided crushing, and at the same time cause the simulation results to deviate severely from the actual situation, damaging battlefield analysis and decision support based on deduction data. More seriously, this kind of error may mislead the commander's assessment of tactical effectiveness and equipment performance, thus resulting in serious mistakes in decision-making and deployment, and ultimately having disastrous consequences for combat operations.

[0005] The above information disclosed in the background art section is only used to enhance the understanding of the background of the present disclosure, and thus it may include information that does not constitute the prior art known to those of ordinary skill in the art. Summary of the Invention

[0006] The object of the present invention is to provide a four - level data automatic recognition and adaptation method based on the C# architecture. By real - time monitoring the thread access to battle damage data, constructing a complete data analysis set of thread access competition, and combining with a machine learning model for intelligent recognition of competition risks, it can accurately detect competition hotspots in a high - concurrency environment and dynamically optimize resource allocation. In particular, based on the prediction results of competition load, the priority of read - write locks is adaptively adjusted to ensure improved query efficiency in a low - competition environment, while giving priority to the update of battle damage data in a high - competition environment, reducing data lag problems, and preventing the occurrence of anomalies such as "invincible units" or "battle damage stacking". Finally, while ensuring high throughput of the system, the battle damage status synchronization mechanism is optimized, the authenticity of combat deduction and decision - making support capabilities are improved, ensuring that commanders can make reasonable tactics and deployments based on accurate simulation data, effectively enhancing the stability, reliability and decision - making science of the combat simulation system to solve the problems in the above - mentioned background technology.

[0007] To achieve the above object, the present invention provides the following technical solutions: A four - level data automatic recognition and adaptation method based on the C# architecture, comprising the following steps:

[0008] During combat deduction, real - time monitor and record the access of each thread to the battle damage data of combat units, and construct a data analysis set of thread access competition;

[0009] For the established analysis set, extract the key indicators related to access competition load. After in - depth analysis of the extracted key indicators of thread access competition, construct a feature vector through the analyzed features to represent the specific performance of thread access competition;

[0010] Input the constructed thread competition feature vector into a machine learning model that has been trained and put into actual use, and quickly identify the thread access competition risk in the current environment by analyzing the currently input feature vector;

[0011] After confirming the existence of potential competition risks, clearly distinguish the specific operation types executed by the thread when accessing the battle damage data of combat units, that is, clearly identify whether the current access is a "read" operation or a "write" operation. According to the real - time obtained prediction results of thread competition load, dynamically adjust the priority policy of read - write locks to adapt to the requirements of different access competition loads.

[0012] Preferably, key metrics related to access competition load are extracted. The extracted key metrics include the number of conflicts that occur between multiple threads for the same resource and the ratio of the number of times the shared lock is forced to back off due to contention. After in-depth analysis of the extracted key metrics for thread access competition within a fixed detection period, a thread conflict reference value and a shared lock backoff reference value are generated respectively. A feature vector is constructed through the analyzed thread conflict reference value and shared lock backoff reference value to characterize the specific performance of thread access competition.

[0013] Preferably, the constructed thread conflict reference value and shared lock backoff reference value are input into a machine learning model that has been trained and is already in actual use. By analyzing the currently input feature vector, a competition evaluation coefficient is generated, and based on the competition evaluation coefficient, the thread access competition risk in the current environment is quickly identified.

[0014] Preferably, the competition evaluation coefficient generated when predicting the thread access competition risk in the current environment through the machine learning model within a fixed detection period is compared and analyzed with a pre-set competition evaluation coefficient reference threshold to identify the thread access competition risk in the current environment. The specific identification process is as follows:

[0015] If the competition evaluation coefficient is greater than the competition evaluation coefficient reference threshold, the thread is identified as a thread with access competition risk; if the competition evaluation coefficient is less than or equal to the competition evaluation coefficient reference threshold, the thread is identified as a normal thread.

[0016] Preferably, after confirming the existence of potential competition risk, according to the real-time obtained prediction result of thread competition load, the priority strategy of the read-write lock is dynamically adjusted. The specific steps are as follows:

[0017] After discovering the thread competition risk, first distinguish the access type of the current thread to the combat unit battle damage data, that is, determine whether the thread is performing a read operation or a write operation. At the same time, combined with the competition evaluation coefficient conten evalua and the competition evaluation coefficient reference threshold conten thresh , calculate the dynamic read-write competition factor to characterize the competition intensity ratio between read operations and write operations in the current environment. The calculation expression of the dynamic read-write competition factor is:

[0018]

[0019] where: d rci is the dynamic read-write competition factor, R cnt is the total number of read operations within a fixed detection period, representing the frequency at which the thread queries the combat unit battle damage data, W cnt is the total number of write operations within a fixed detection period, representing the frequency at which the thread updates the combat unit battle damage data, α r and αw They are the read priority coefficient and the write priority coefficient respectively, which are used to control the basic weight of the read-write lock. It is the exponential adjustment factor, which is used to amplify the impact in the case of severe competition.

[0020] Preferably, according to the calculated dynamic read-write competition factor d rci , the priority policy of the read-write lock is adjusted in real time, so that the system can adaptively schedule read-write operations under different access competition loads. The specific adjustment policy is as follows:

[0021]

[0022] Among them: P r is the read lock priority weight, which determines the scheduling weight of read operations in a competitive environment. The value range is (0, 1). P w is the write lock priority weight, which determines the scheduling weight of write operations in a competitive environment. The value range is (0, 1). β is the adjustment factor, which is used to control the sensitivity of the priority change of the read-write lock in a competitive environment. θ r and θ w represent the read lock priority threshold and the write lock priority threshold respectively, which are used to control the starting point of the priority adjustment of the read-write lock in different competitive environments.

[0023] Preferably, within a fixed detection period, after deeply analyzing the number of conflicts that occur between multiple threads for the same resource, the specific steps to generate the thread conflict reference value are as follows:

[0024] Within a fixed detection period, whenever a thread conflict occurs, record the number of threads that are contending for the resource at that time, and calculate the weighted conflict factor for the concurrent thread numbers of all conflicts. The calculation expression is:

[0025]

[0026] Among them, C n is the total number of conflicts in this period, concurrency k is the number of threads participating in the contention at the kth conflict, and W cf is the weighted conflict factor;

[0027] After obtaining the weighted conflict factor, use the logarithmic function to enhance it and calculate the thread conflict reference value. The calculation expression is:

[0028] T ci = ln(1 + W cf )

[0029] Among them: T ci is the thread conflict reference value.

[0030] Preferably, within a fixed detection period, the specific steps for generating a shared lock backoff reference value after in-depth analysis of the proportion of the number of times the shared lock is forced to back off due to contention are as follows:

[0031] Within a fixed detection period, among the total number of times each thread attempts to acquire the shared lock, record the number of times forced to back off due to competition failure, and calculate the lock backoff rate. The calculation expression is:

[0032]

[0033] Where: L br is the lock backoff rate, A is the number of times the lock is successfully acquired, that is, the number of times the thread directly obtains the lock without encountering any competition when attempting to acquire the shared lock, B is the number of lock backoffs, that is, the number of times the thread is forced to back off because the shared lock is occupied by other threads, and C is the number of lock wait timeouts, that is, the number of times the thread still fails to acquire the lock after multiple attempts and is terminated by the operating system or scheduling policy due to timeout;

[0034] Using the lock backoff rate, further introduce a non-linear adjustment factor to capture the exponentially growing trend when competition intensifies, and generate a shared lock backoff reference value. The generation expression is:

[0035]

[0036] Where: S lbi is the shared lock backoff reference value, and D is the thread adaptive deweighting factor, which represents the degree of reduction in the thread's priority within the current detection period.

[0037] In the above technical solution, the technical effects and advantages provided by the present invention are:

[0038] The present invention can accurately detect competition hotspots in a high-concurrency environment and dynamically optimize resource allocation by real-time monitoring of thread access battle damage data, constructing a complete thread access competition data analysis set, and combining a machine learning model for intelligent identification of competition risks. In particular, based on the competition load prediction results, the priorities of read-write locks are adaptively adjusted to ensure improved query efficiency in a low-competition environment, while giving priority to the update of battle damage data in a high-competition environment, reducing data lag problems, and preventing the occurrence of anomalies such as "invincible units" or "battle damage stacking". Finally, while ensuring high system throughput, the battle damage status synchronization mechanism is optimized, the authenticity and decision-making support ability of combat simulations are improved, ensuring that commanders can make reasonable tactics and deployments based on accurate simulation data, and effectively enhancing the stability, reliability, and scientific nature of combat simulation systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required in the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments recorded in the present invention. For those of ordinary skill in the art, other accompanying drawings can also be obtained based on these drawings.

[0040] Figure 1 This is the method flow chart of the four-level data automatic recognition and adaptation method based on the C# architecture of the present invention. Specific embodiments

[0041] Now, the exemplary embodiments will be described more comprehensively with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these exemplary embodiments are provided so that the present disclosure will be more thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art.

[0042] The present invention provides a Figure 1 four-level data automatic recognition and adaptation method based on the C# architecture as shown below, including the following steps:

[0043] During the combat simulation, monitor and record in real time the battle damage data access situation of each thread to the combat unit, and construct a complete and accurate data analysis set for thread access competition analysis;

[0044] The battle damage data access situation includes clearly recording the thread identifier, combat unit identifier, timestamp of accessing the data, operation type (read or write), and the duration and frequency of accessing the data, etc. By capturing these detailed real-time access log data, the system constructs a complete and accurate data analysis set for thread access competition analysis. The function of this step is to provide basic data guarantee for subsequent identification and analysis of thread competition characteristics.

[0045] For the established analysis set, extract the key indicators related to the access competition load. After in-depth analysis of the extracted key indicators of thread access competition, construct a feature vector through the analyzed features to represent the specific performance of thread access competition;

[0046] Extract the key indicators related to the access competition load. Among them, the extracted key indicators include the number of conflicts of the same resource among multiple threads and the proportion of the number of times the shared lock is forced to back off due to contention. Within a fixed detection period, after in-depth analysis of the extracted key indicators of thread access competition, generate a thread conflict reference value and a shared lock backoff reference value respectively. Construct a feature vector through the analyzed thread conflict reference value and shared lock backoff reference value to represent the specific performance of thread access competition.

[0047] During the combat simulation process, when multiple threads simultaneously attempt to access and modify the battle damage data of the same combat unit, if the monitoring records show a significant increase in the number of access conflicts between threads, it indicates that each thread frequently fails to obtain effective data access permissions in a timely manner due to resource competition, resulting in an obvious competition phenomenon. The more competition occurs, the more it indicates that the access competition for this resource is in a serious state. This situation often leads to data update delays, inconsistent states, and even serious data overwriting or omission problems, ultimately seriously affecting the data consistency of the combat simulation system and the accuracy of combat simulation.

[0048] After in-depth analysis of the number of conflicts that occur for the same resource among multiple threads within a fixed detection period, the specific steps to generate the thread conflict reference value are as follows:

[0049] Within a fixed detection period, whenever a thread conflict occurs, record the number of threads that are competing for the resource at that time. Calculate the weighted conflict factor for the concurrent thread numbers of all conflicts. The calculation expression is:

[0050]

[0051] where C n is the total number of conflicts in this period, concurrency k is the number of threads participating in the competition at the k-th conflict, and W cf is the weighted conflict factor;

[0052] By performing a quadratic accumulation on the concurrent thread numbers, the severity of conflicts in high-concurrency situations can be highlighted: the larger the number of concurrent threads, the more significant the performance impact brought by the corresponding conflicts. The role of this step is to "amplify" the concurrent scale of each conflict, thus providing a more sensitive basic measure for subsequent calculations.

[0053] After obtaining the weighted conflict factor, use the logarithmic function to enhance it and calculate the thread conflict reference value. The calculation expression is:

[0054] T ci = ln(1 + W cf )

[0055] where: T ci is the thread conflict reference value. By adding 1 to the weighted conflict factor T ci and taking the logarithm, sufficient resolution can be maintained when the value is low, and infinite expansion can be avoided when the value is high, ensuring that the result can effectively distinguish the size of the conflict scale and will not be "exploded" by extreme conflict situations;

[0056] The purpose of this step is to further compress and stretch the conflict degree through logarithmic transformation, so that moderate conflicts and extreme conflicts can be effectively distinguished, thus realizing the clear quantification of thread access competition.

[0057] From the thread conflict reference value, it can be seen that within a fixed detection period, the larger the performance value of the thread conflict reference value generated after in-depth analysis of the number of conflicts that occur between multiple threads for the same resource, the more times of thread conflicts occur on the same resource within the fixed detection period, and the higher the concurrency degree of the competing threads, indicating that the access competition encountered by the thread when accessing the resource is more serious. The thread conflict reference value is calculated based on the weighted conflict factor. It not only considers the frequency of conflicts, but also amplifies the number of concurrent threads by a factor of two, making the impact of conflicts under higher concurrency more significant. After logarithmic transformation, the thread conflict reference value can effectively distinguish different levels of competition, so that even if the competition degree changes drastically, the thread conflict reference value can still maintain a stable quantification effect. Therefore, a higher thread conflict reference value means that the resource contention of the thread is serious, which may lead to performance degradation or long-term thread blocking, while a lower thread conflict reference value indicates that the resource access of the thread is smoother, with less competition and higher execution efficiency.

[0058] During the combat simulation process, if the proportion of the number of times the shared lock is forced to roll back due to contention is relatively high, it usually indicates that the thread encounters serious access competition when accessing critical resources (such as battlefield status data, combat unit status, etc.). The original design of the shared lock is to allow multiple threads to read data simultaneously while performing mutual exclusion control when writing data to ensure data consistency. However, when multiple threads simultaneously attempt to acquire the same shared lock, if the lock is already held by other threads, the system may trigger the lock rollback mechanism, causing the current thread to postpone the retry or enter the waiting state. If the proportion of rollback times continues to increase, it means that multiple threads in the system frequently compete for the same resource, and the speed of resource release cannot keep up with the growth of requests, resulting in the thread constantly entering the rollback and retry states. This will not only reduce the overall computing efficiency, but may also cause key tasks during the simulation process (such as combat decision calculation, unit status update, etc.) to be delayed, affecting the accuracy and real-time nature of the simulation results. In extreme cases, a high lock rollback rate may lead to a decrease in system throughput, long-term thread blocking, and even trigger deadlocks, ultimately affecting the smooth operation of the entire combat simulation.

[0059] The specific steps for generating the shared lock backoff reference value through in-depth analysis of the proportion of the number of times the shared lock is forced to roll back due to contention within a fixed detection period are as follows:

[0060] Within a fixed detection period, among the total number of times each thread attempts to acquire the shared lock, record the number of times forced to roll back due to competition failure, and calculate the lock rollback rate. The calculation formula is:

[0061]

[0062] Where: L br is the lock back-off rate, A is the number of successful lock acquisitions, that is, the number of times a thread directly obtains the lock without encountering any competition when attempting to acquire a shared lock, B is the number of lock back-offs, that is, the number of times a thread is forced to back off because the shared lock is occupied by other threads, and C is the number of lock wait timeouts, that is, the number of times a thread fails to successfully acquire the lock after multiple attempts and is terminated by the operating system or scheduling policy due to timeout;

[0063] By considering the situation of successful lock acquisition (A), lock back-off situation (B), and lock timeout situation (C), this formula can measure the degree of competition faced by a thread when accessing resources. Different from traditional methods, this calculation not only focuses on the number of lock back-offs (B), but also combines the situations of successful lock acquisition and timeout, making it more comprehensively reflect the pressure of lock contention.

[0064] Using the lock back-off rate, a non-linear adjustment factor is further introduced to capture the exponentially growing trend when competition intensifies, and a shared lock back-off reference value is generated. The generated expression is:

[0065]

[0066] Where: S lbi is the shared lock back-off reference value, D is the thread adaptive deweighting factor, which represents the degree of reduction in the priority of a thread during the current detection period. The calculation method of the thread adaptive deweighting factor can be comprehensively determined by combining the thread management strategy of the operating system and the custom logic of the application layer. Usually, existing methods include: dynamically reducing the thread priority according to the CPU occupancy rate or waiting time of the thread in the previous cycle; measuring its impact on the system load and making corresponding adjustments according to the residence time of the thread in operations such as lock contention and I / O blocking; or combining a "penalty mechanism" to deweight threads with more contention by statistically counting the lock conflict frequency caused by the thread to balance the execution efficiency of other tasks. By integrating the above indicators and performing calculations or integral accumulations under a certain weight, a factor that can reflect the degree of reduction in thread priority is finally obtained to achieve adaptive priority management.

[0067] From the thread conflict reference value, it can be seen that within a fixed detection period, the larger the performance value of the shared lock backoff reference value generated after in-depth analysis of the proportion of the number of times the shared lock is forced to back off due to contention, the more serious the access competition encountered by the thread when accessing resources. On the contrary, the smaller the value, the lighter the competition or almost no competition. By comprehensively calculating the lock backoff rate and the adaptive demotion factor, the shared lock backoff reference value can accurately describe the difficulty of a thread obtaining a shared lock. When the shared lock backoff reference value is high, it means that the thread has been forced to back off multiple times due to lock contention during the detection period, indicating that multiple threads are competing for the same resources at a high frequency, resulting in the obstruction of computing tasks and affecting the system throughput and deduction efficiency. On the contrary, if the shared lock backoff reference value is low, it means that the thread can obtain the lock smoothly in most cases and the number of lock backoffs is small, indicating that the resource access competition is light and the system runs smoothly. Therefore, the shared lock backoff reference value can be used as an important indicator to measure the intensity of thread resource contention.

[0068] Input the constructed thread competition feature vector into a machine learning model (such as Random Forest, XGBoost, neural network model) that has been trained and is already in actual use, and quickly identify the thread access competition risk in the current environment by analyzing the currently input feature vector;

[0069] Input the constructed thread conflict reference value and shared lock backoff reference value into a machine learning model (such as Random Forest, XGBoost, neural network model) that has been trained and is already in actual use, generate a competition evaluation coefficient by analyzing the currently input feature vector, and quickly identify the thread access competition risk in the current environment based on the competition evaluation coefficient.

[0070] The "machine learning model that has been trained and is already in actual use" mentioned here refers to a stable and effective model that has gone through the entire process of data collection, feature extraction, data annotation, model selection, model training, verification and optimization, and has been deployed to the actual operating environment after passing a comprehensive performance evaluation. This model has usually been trained and verified with long-term historical data, through a large number of clearly marked, accurate and reliable historical feature data, including but not limited to key features such as thread conflict reference values and shared lock backoff reference values, and uses the corresponding actual access competition risks as labels for learning, so that it can accurately establish the mapping relationship between the input features and the risk assessment results. Taking Random Forest, XGBoost or neural network as an example, these models adjust the model parameters and improve the fitting effect through repeated iterative optimization during the training stage, and finally achieve accurate classification or regression prediction of the thread access competition risk. When the model meets the performance index requirements such as the specified accuracy, recall rate or F1 score, the training stage is completed and the model enters the production deployment stage.

[0071] The actual use of the model means that the model has completed offline training and testing in a laboratory environment or on a simulation dataset, and is officially applied to a real wargame environment or a real system operation environment, receiving real-time data input, making real-time competitive assessment predictions, and guiding the scheduling decisions and performance optimization of subsequent systems. Specifically, after the characteristic indicators such as the thread conflict reference value and the shared lock backoff reference value are calculated and generated in real time in the actual operation environment, they will be input into this deployed machine learning model in the form of a feature vector. The model then quickly performs reasoning using the internal patterns and decision rules learned during the previous training process and outputs the corresponding competitive assessment coefficient. The competitive assessment coefficient can clearly reflect the degree of competition faced by the current system threads during resource access. If the competitive assessment coefficient is high, it indicates that the access competition between the system threads at this moment is very serious, which may have already or will soon lead to serious performance degradation, throughput decline, and even cause downtime risks. If the competitive assessment coefficient is low, it means that the resource competition state of the current system threads is relatively healthy and the system runs stably and smoothly. Therefore, this machine learning model that has completed training and is put into actual use can help the system achieve real-time monitoring and dynamic early warning during operation, detect, locate, and solve performance bottlenecks or abnormal conditions related to thread access competition early, and ensure the stability and reliability of the wargame system and related actual systems.

[0072] The machine learning model is not specifically limited here. Any deep learning model that can implement the comprehensive analysis of the thread conflict reference value T ci and the shared lock backoff reference value S lbi to generate the competitive assessment coefficient conten evalua is acceptable. To implement the technical solution of the present invention, the present invention provides a specific implementation method; the expression for generating the competitive assessment coefficient conten evalua is: conten evalua = o p *T ci + o q *S lbi , where o p , o q are respectively the preset proportionality coefficients of the thread conflict reference value T ci and the shared lock backoff reference value S lbi , and both o p , o q are greater than 0. The preset proportionality coefficients (o p and o q ) refer to the coefficients used to weight different competition indicators (the thread conflict reference value T ci and the shared lock backoff reference value S lbi)'s weight factor. The role of these preset proportional coefficients is to adjust the contribution degree of each index to the competition evaluation coefficient, ensuring that the calculated competition evaluation coefficient conten evalua can accurately reflect the severity of access competition in different environments. Since T ci and S lbi may have different importance in different systems, different thread architectures, or different application scenarios, the preset proportional coefficients allow the system to be adjusted according to actual needs. For example, in some high-concurrency environments, thread conflicts may be the main performance bottleneck, so a higher o p can be set to increase the influence weight of T ci , while in some environments that require frequent access to shared resources, shared lock contention may be more serious, then o q can be increased to make S lbi have a greater impact on competition evaluation. Therefore, the existence of preset proportional coefficients makes the competition evaluation system more flexible and adjustable, and can adapt to different types of computing tasks and system architectures.

[0073] It can be seen from the competition evaluation coefficient that within a fixed detection period, the larger the performance value of the thread conflict reference value generated by in-depth analysis of the number of conflicts that occur between multiple threads for the same resource, and the larger the performance value of the shared lock backoff reference value generated by in-depth analysis of the proportion of the number of times the shared lock is forced to back off due to contention, that is, the larger the performance value of the competition evaluation coefficient generated when the machine learning model that has been trained and put into actual use predicts the thread access competition risk in the current environment, it indicates that the thread encounters more serious access competition when accessing resources, and vice versa, it indicates that the thread encounters less serious access competition when accessing resources.

[0074] Compare and analyze the competition evaluation coefficient generated when the machine learning model predicts the thread access competition risk in the current environment within a fixed detection period with the preset competition evaluation coefficient reference threshold to identify the thread access competition risk in the current environment. The specific identification process is as follows:

[0075] If the competition evaluation coefficient is greater than the competition evaluation coefficient reference threshold, then identify the thread as a thread with access competition risk; if the competition evaluation coefficient is less than or equal to the competition evaluation coefficient reference threshold, then identify the thread as a normal thread.

[0076] After confirming the existence of potential competition risk, clearly distinguish the specific operation types executed by the thread when accessing the combat unit battle damage data, that is, clearly identify whether the current access is a "read" operation (query status) or a "write" operation (update status), and dynamically adjust the priority strategy of the read-write lock according to the real-time obtained thread competition load prediction result to adapt to the needs of different access competition loads;

[0077] After confirming the existence of potential competition risks, according to the predicted results of thread competition load obtained in real time, dynamically adjust the priority strategy of the read-write lock. The specific steps are as follows:

[0078] After discovering the thread competition risk, first distinguish the access type of the current thread to the combat unit's battle damage data, that is, determine whether the thread is performing a read operation (query status) or a write operation (update status). At the same time, combine the competition evaluation coefficient conten evalua and the reference threshold conten thresh of the competition evaluation coefficient to calculate the dynamic read-write competition factor, which is used to characterize the competition intensity ratio between read operations and write operations in the current environment. The calculation expression of the dynamic read-write competition factor is:

[0079]

[0080] where: d rci is the dynamic read-write competition factor, R cnt is the total number of read operations within a fixed detection period, indicating the frequency at which the thread queries the combat unit's battle damage data, W cnt is the total number of write operations within a fixed detection period, indicating the frequency at which the thread updates the combat unit's battle damage data, α r and α w are the read priority coefficient and the write priority coefficient respectively, which are used to control the basic weights of the read-write lock and can be dynamically adjusted according to system requirements. is the exponential adjustment factor, which is used to amplify the impact in the case of severe competition. When conten evalua >conten thresh , this term grows rapidly, making the dynamic read-write competition factor d rci more inclined to weighted adjustment of high-frequency access types in a high-competition environment;

[0081] After discovering the thread competition risk, the access type of the current thread to the combat unit's battle damage data can be distinguished by detecting the type of thread operation. The specific method can be implemented through the thread operation identifier. When each thread executes a task, it can identify the operation type through the embedded marking mechanism or context management in the program. When the thread starts to access the battle damage data, it can mark the operation as a read operation (query status) or a write operation (update status) in its execution path. For example, in C#, the operation type currently being executed by the thread can be recorded through method parameters or thread-local storage. For a read operation, the system checks whether it is a data query request; for a write operation, the system checks whether the thread is updating the battle damage status. In this way, the system can dynamically distinguish and capture the operation type of each thread during execution, so as to make more accurate competition risk management and lock scheduling strategy adjustments.

[0082] By calculating the dynamic read-write competition factor, this step can not only distinguish the access types of current threads, but also dynamically measure the current read-write competition pressure, providing data support for subsequent adjustment of lock priority strategies. The introduction of the exponential adjustment factor makes the impact on high-frequency access operations greater in a high-competition environment, enabling adaptive adjustment of lock strategies under different load conditions.

[0083] According to the calculated dynamic read-write competition factor d rci , the priority strategy of the read-write lock is adjusted in real time, enabling the system to adaptively schedule read-write operations under different access competition loads. The specific adjustment strategy is as follows:

[0084]

[0085] Where: P r is the priority weight of the read lock, which determines the scheduling weight of read operations in a competitive environment, and its value range is (0, 1). P w is the priority weight of the write lock, which determines the scheduling weight of write operations in a competitive environment, and its value range is (0, 1). β is the adjustment factor used to control the sensitivity of the priority change of the read-write lock in a competitive environment. θ r and θ w respectively represent the read lock priority threshold and the write lock priority threshold, which are used to control the starting point of the priority adjustment of the read-write lock in different competitive environments;

[0086] When the dynamic read-write competition factor is higher than the write priority threshold, the priority weight P w of the write operation rises rapidly, and the write thread is preferentially scheduled to reduce the risk of data inconsistency. Read-write dynamic balance: When the dynamic read-write competition factor is in a moderate range, the priorities of the read-write lock automatically tend to balance to prevent a certain type of operation from not being scheduled for a long time. High-competition environment optimization: If the competition evaluation coefficient far exceeds the reference threshold of the competition evaluation coefficient, then P w rises further to ensure that critical battle damage data is updated as soon as possible, improving the consistency and response ability of the system. This strategy dynamically adjusts the priorities of the read-write lock by introducing exponential transformation, ensuring that the system can adaptively optimize the thread scheduling strategy under different access competition load conditions, improving the concurrent execution efficiency, and reducing the performance bottleneck caused by competition.

[0087] The role of this mechanism is to improve the efficiency of resource access in a concurrent environment and optimize the stability and data consistency of the combat simulation system. By clearly distinguishing the specific operation type (read or write) of the thread accessing the combat unit's damage data, the system can adaptively adjust the priority strategy of the read-write lock based on the real-time competition load prediction results, thereby dynamically optimizing the lock scheduling under different competition environments. When the system detects that the competition risk is low, it will prioritize the scheduling priority of the read operation to ensure the high throughput of the query task; when the competition load is high, especially when the write operation conflict intensifies, the system will prioritize the scheduling of the write operation to ensure the timeliness of the update of the damage data and avoid distortion of the simulation due to data delay or lock contention. This mechanism can effectively reduce thread hunger, improve resource utilization, and optimize the real-time update capability of the damage data, ensuring that the war game simulation system can still operate efficiently and stably in a high-concurrency and high-access competition environment, and avoiding performance bottlenecks or decision-making misleading caused by improper lock management.

[0088] Through the above-mentioned four-level data automatic identification and adaptation method based on C# architecture, the abnormal damage status caused by access competition in the combat simulation system can be effectively solved, and the real-time and accuracy of combat data can be improved. By real-time monitoring of thread access to damage data, building a complete thread access competition data analysis set, and combining machine learning models for intelligent identification of competition risks, the system can accurately detect competition hotspots in a high-concurrency environment and dynamically optimize resource allocation. In particular, the read-write lock priority is adaptively adjusted based on the competition load prediction results to ensure that query efficiency is improved in a low-competition environment, and priority is given to guaranteeing the update of damage data in a high-competition environment, reducing data lag problems, and preventing the occurrence of "invincible units" or "damage superposition" anomalies. Finally, while ensuring the high throughput of the system, the solution optimizes the damage status synchronization mechanism, improves the authenticity and decision-making support capabilities of combat simulation, ensures that commanders can make reasonable tactics and deployments based on accurate simulation data, and effectively improves the stability, reliability and scientificity of decision-making of the combat simulation system.

[0089] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.

[0090] The above description is only by way of illustration of certain exemplary embodiments of the present invention. It is undoubted that those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present invention. Therefore, the above drawings and descriptions are illustrative in nature and should not be construed as limiting the scope of protection of the claims of the present invention.

[0091] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0092] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0093] In several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be electrical, mechanical, or other forms.

[0094] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0095] In addition, the functional units in each embodiment of this application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.

[0096] When the above-mentioned functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.

[0097] As described above, the above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should all be covered within the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims

1. A method for automatic recognition and adaptation of four - level data based on the C# architecture, characterized in that, It includes the following steps: During the combat simulation, monitor and record in real time the access situation of each thread to the combat loss data of the combat unit, and construct a data analysis set for thread access competition analysis; For the established analysis set, extract the key indicators related to the access competition load. After in-depth analysis of the extracted key indicators of thread access competition, construct a feature vector through the analyzed features to represent the specific performance of thread access competition; Input the constructed thread competition feature vector into a machine learning model that has been trained and put into actual use, and quickly identify the thread access competition risk in the current environment by analyzing the currently input feature vector; After confirming the existence of potential competition risks, clearly distinguish the specific operation types executed by the thread when accessing the combat loss data of the combat unit, that is, clearly identify whether the current access is a "read" operation or a "write" operation. According to the real-time obtained prediction result of the thread competition load, dynamically adjust the priority policy of the read-write lock to adapt to the needs of different access competition loads.

2. The four - level data automatic recognition and adaptation method based on the C# architecture according to claim 1, wherein Extract the key indicators related to the access competition load. Among them, the extracted key indicators include the number of conflicts of the same resource among multiple threads and the proportion of the number of times the shared lock is forced to back off due to contention. During a fixed detection period, after in-depth analysis of the extracted key indicators of thread access competition, generate a thread conflict reference value and a shared lock back-off reference value respectively, and construct a feature vector through the analyzed thread conflict reference value and shared lock back-off reference value to represent the specific performance of thread access competition.

3. The method for automatic recognition and adaptation of four-level data based on the C# architecture according to claim 2, characterized in that, Input the constructed thread conflict reference value and shared lock back-off reference value into a machine learning model that has been trained and put into actual use, generate a competition evaluation coefficient by analyzing the currently input feature vector, and quickly identify the thread access competition risk in the current environment based on the competition evaluation coefficient.

4. The four - level data automatic recognition and adaptation method based on the C# architecture according to claim 3, characterized in that, Compare and analyze the competition evaluation coefficient generated when predicting the thread access competition risk in the current environment through the machine learning model during a fixed detection period with the pre-set competition evaluation coefficient reference threshold to identify the thread access competition risk in the current environment. The specific identification process is as follows: If the competition evaluation coefficient is greater than the competition evaluation coefficient reference threshold, identify the thread as a thread with access competition risk; if the competition evaluation coefficient is less than or equal to the competition evaluation coefficient reference threshold, identify the thread as a normal thread.

5. The method for automatic four - level data recognition and adaptation based on the C# architecture according to claim 4, characterized in that, After confirming the existence of potential competition risks, dynamically adjust the priority policy of the read-write lock according to the real-time obtained prediction result of the thread competition load. The specific steps are as follows: After detecting the thread competition risk, first distinguish the access type of the current thread to the combat unit's battle damage data, that is, determine whether the thread is performing a read operation or a write operation. At the same time, combine the competition evaluation coefficient conten evalua and the reference threshold conten thresh of the competition evaluation coefficient to calculate the dynamic read-write competition factor, which is used to characterize the competition intensity ratio between read operations and write operations in the current environment. The calculation expression of the dynamic read-write competition factor is: Where: d rci is the dynamic read-write competition factor, R cnt is the total number of read operations within a fixed detection period, representing the frequency at which the thread queries the battle damage data of the combat unit, W cnt is the total number of write operations within a fixed detection period, representing the frequency at which the thread updates the battle damage data of the combat unit, α r and α w are the read priority coefficient and the write priority coefficient respectively, used to control the basic weight of the read-write lock, is the exponential adjustment factor, used to amplify the impact in the case of severe competition.

6. The four - level data automatic recognition and adaptation method based on the C# architecture according to claim 5, characterized in that, According to the calculated dynamic read-write contention factor d rci , the priority policy of the read-write lock is adjusted in real time, enabling the system to adaptively schedule read-write operations under different access contention loads. The specific adjustment policy is as follows: Where: P r is the read lock priority weight, which determines the scheduling weight of read operations in a competitive environment, and its value range is (0, 1). P w is the write lock priority weight, which determines the scheduling weight of write operations in a competitive environment, and its value range is (0, 1). β is the adjustment factor used to control the sensitivity of the priority change of read-write locks in a competitive environment. θ r and θ w respectively represent the read lock priority threshold and the write lock priority threshold, which are used to control the starting point of the priority adjustment of read-write locks in different competitive environments.

7. The method for automatic four-level data recognition and adaptation based on the C# architecture according to claim 2, characterized in that During a fixed detection period, the specific steps for generating a thread conflict reference value after in-depth analysis of the number of conflicts of the same resource among multiple threads are as follows: During a fixed detection period, whenever a thread conflict occurs, record the number of threads that are contending for the resource at that time, and calculate the weighted conflict factor for all concurrent thread numbers of the conflicts. The calculation formula is: Among them, C n is the total number of conflicts in this period, concurrency k is the number of threads participating in contention during the k-th conflict, W cf is the weighted conflict factor; After obtaining the weighted conflict factor, use the logarithmic function to enhance it and calculate the thread conflict reference value. The calculation formula is: T ci = ln(1 + W cf ) Where: T ci is the thread conflict reference value.

8. The method for automatic four-level data recognition and adaptation based on the C# architecture according to claim 2, characterized in that The specific steps for generating the shared lock backoff reference value after in-depth analysis of the proportion of the number of times the shared lock is forced to back off due to contention within a fixed detection period are as follows: Within a fixed detection period, among the total number of times each thread attempts to acquire the shared lock, record the number of times it is forced to back off due to competition failure, and calculate the lock backoff rate. The calculation expression is: Where: L br is the lock backoff rate, A is the number of successful lock acquisitions, that is, the number of times the thread directly obtains the lock without encountering any competition when attempting to acquire the shared lock, B is the number of lock backoffs, that is, the number of times the thread is forced to back off because the shared lock is occupied by other threads, and C is the number of lock wait timeouts, that is, the number of times the thread fails to acquire the lock after multiple attempts and is terminated by the operating system or scheduling policy due to timeout; Using the lock backoff rate, further introduce a non-linear adjustment factor to capture the exponentially growing trend when competition intensifies, and generate the shared lock backoff reference value. The generated expression is: Where: S lbi is the shared lock backoff reference value, and D is the thread adaptive deweighting factor, indicating the degree to which the thread's priority is reduced during the current detection period.

Citation Information

Patent Citations

  • Data read-write priority balancing method, system and device and storage medium

    CN112416556A

  • Lock scheduling optimization method and terminal

    CN118519792A

  • Method, apparatus, and computer program product for dynamically tuning a data processing system by identifying and boosting holders of contentious locks

    US20060031658A1