A parallel analysis method and system for software analysis
Through the parallel analysis system, the sliding window and load balancing mechanism are used to solve the problems of software analysis performance bottleneck and insufficient robustness in the existing technology, realize efficient and reliable software analysis, and ensure the stability and resource utilization of the system. Rate.
Patent Information
- Application Number
- CN202410841959.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-06-27
AI Technical Summary
Existing software analysis frameworks have serious performance bottlenecks when facing large-scale code bases, lack robustness, cannot meet fast and accurate analysis requirements, and cannot effectively resume processing when threads or processes crash.
A parallel analysis system is designed, including an analysis master module, multiple analysis slave modules, an intermediate message suite module and a monitoring module. It implements message sending rate control and error recovery through sliding window units, and introduces a load balancing mechanism to distribute tasks evenly. The monitoring module monitors the slave module status in real time and recovers when errors occur.
It improves the efficiency and reliability of software analysis, avoids message processing congestion, ensures the fluency and reliability of the system, and can handle and recover in time when errors occur in the analysis slave module, maximizing the use of system resources.
Smart Images

Figure CN118377638B
Abstract
Description
Technical Field
[0001] The invention relates to the field of software analysis and is a parallel analysis method and system for software analysis. Background Art
[0002] With the continuous development of informatization, digitization and intelligence, software has penetrated into all aspects of people's lives, and its influence is becoming increasingly greater. It also plays an increasingly important role in the national economy and national defense construction. In this context, how to improve the quality of software and ensure the credibility of its behavior is an issue that needs attention. Software analysis technology can go deep into the software system, carefully examine its structure and various components, and then discover its various characteristics, such as performance, correctness and security. Software analysis has gradually developed into an important research direction in the field of programming languages and software engineering, and has affected related fields such as information security.
[0003] The development of technology has also brought many challenges and opportunities to software design and development. How to design high-reliability and high-performance software under multi-core processors and distribution has become a hot topic of research in academia and industry. Software analysis is a computationally intensive task because it requires the use of complex algorithms to process large amounts of code and data. Traditional software analysis frameworks usually use multi-threading or multi-process parallel processing to improve the efficiency of analysis. However, when faced with large-scale code bases, they often encounter performance bottlenecks and cannot meet the needs of fast and accurate analysis. At the same time, their frameworks also lack a certain degree of robustness. For example, when a thread or process crashes, they cannot recover and handle it well. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a parallel analysis method and system for software analysis, which solves the deficiencies of the prior art.
[0005] The object of the present invention is achieved by the following technical solutions: a parallel analysis system for software analysis, the system comprising an analysis master module, a plurality of analysis slave modules, an intermediate message suite module and a monitoring module;
[0006] The analysis master module is used for assembling WU and sending it to the analysis slave module through the intermediate message suite module, receiving WUR sent by the intermediate message suite module and processing it to obtain the analysis result, and for WU sending rate control and error and timeout processing. WU is the smallest independent unit containing all the information required for analysis, and WUR is the result of software analyzing WU;
[0007] The analysis slave module is used to process the WU sent by the intermediate message suite module and send the WUR to the analysis master module through the intermediate message suite module;
[0008] The intermediate message suite module: connects the analysis master module and the analysis slave module, and is used for sending and receiving WU and WUR;
[0009] The monitoring module is used to monitor the status of all analysis slave modules and perform error recovery.
[0010] The analysis main module includes a WU generation and sending unit, a WUR receiving and processing unit, and a sliding window unit;
[0011] The WU generation and sending unit is used to load a fragment of the program to be analyzed from the outside, assemble it into a complete WU according to the WU format, and then send it to the analysis slave module through the intermediate message suite module, and at the same time add the WU to the sliding window unit for rate control, error recovery and timeout retransmission;
[0012] The WUR receiving and processing unit is used to receive the WUR from the intermediate message suite module, process the WUR according to different states, and generate a defect report or error record;
[0013] The sliding window unit is used to control the rate of WU transmission and perform error recovery when an error occurs or WU processing times out.
[0014] The intermediate message suite module includes a load balancing unit and a connection unit;
[0015] The load balancing unit is used to distribute WU to different analysis slave modules in a balanced manner according to the load conditions of each analysis slave module, so as to ensure that each analysis module maintains an efficient working state;
[0016] The connection unit serves as a bridge interface between the analysis master module and the analysis slave module, and is used to open a network connection port to achieve connection between the analysis master module and the analysis slave module.
[0017] The monitoring module includes a timing unit and a task processing unit;
[0018] The timing unit is used to start the timing according to the timeout setting of each WU, and monitor whether the WU completes the processing within the set time;
[0019] The task processing unit is used to process each independent WU according to the analysis settings or analysis command options and return the processing result WUR.
[0020] A parallel analysis method for software analysis, the analysis method comprising:
[0021] Step 1: After initializing the analysis master module, the intermediate message suite module and each analysis slave module, start the monitoring module and monitor the status of each analysis slave module in real time through the monitoring module;
[0022] Step 2: The main analysis module assembles the WU and sends it out through the intermediate message suite module, and at the same time caches the sent WU into the sliding window unit;
[0023] Step 3, the sliding window unit monitors the WU that has been sent from two aspects. On the one hand, it monitors the rate at which the WU is sent. When the number of WUs sent is greater than the set threshold, the main analysis module is blocked to send the WU. On the other hand, it times out and resends the WU. When the sent WU does not receive the WUR within the set time, the WU is resent and the number of resend attempts of the WU is increased. When the number of resend attempts of the WU exceeds the set threshold, the timeout WUR is sent to the WUR receiving and processing unit in the analysis main module.
[0024] Step 4: The intermediate message suite module adopts a certain load balancing strategy to send WU to different software analysis slave modules. The analysis slave module receives and unpacks WU, then starts the timer and independent thread to process WU. Finally, the intermediate message suite module sends WUR to the analysis main module for result analysis and storage.
[0025] The step 1 specifically includes the following contents:
[0026] Analyze the startup of the main module, apply for resources, initialize the WU generation and sending unit, WUR receiving and processing unit and sliding window unit;
[0027] Initialize the intermediate message suite module and open the connection port for the analysis master module and each analysis slave module to connect;
[0028] Enable the monitoring module, enable each analysis slave module according to machine resources or user configuration, and enable real-time monitoring of the status of the analysis slave modules. If a crash occurs, close the corresponding analysis slave module to release resources, and finally restart a new analysis slave module.
[0029] Start the analysis slave module, apply for resources, connect to the intermediate message suite module, and start the message receiving loop.
[0030] The specific process steps of the main analysis module include:
[0031] Start the WU assembly sending unit, WUR receiving and processing unit, sliding window unit and monitoring module;
[0032] Start multiple analysis slave modules based on configuration or system resources;
[0033] Start the cycle of assembling WU, sending WU, receiving WUR and processing WUR;
[0034] After all WUs are analyzed and WURs are processed, resources are released and the operation ends.
[0035] The specific process steps of analyzing the slave module include:
[0036] Receive WU and unpack it, and enable the timing module to monitor the time taken to process WU;
[0037] Start the thread to process WU. After WU processing is completed, WUR is sent. If it times out, a timeout WUR is sent.
[0038] The process of receiving WU, processing WU and sending WUR continues in a loop until all WU analysis is completed.
[0039] The specific process steps of the monitoring module include:
[0040] B1. Check the status of all analysis slave modules. If a slave module crashes or fails, release the resources of the analysis slave module and restart the analysis slave module. If all analysis slave modules are in normal status, enter sleep mode.
[0041] B2. When the sleep time is up, re-execute step B1 until all tasks are completed and all analyses exit from the module.
[0042] The specific process steps of the sliding window module include:
[0043] A1. Check whether the cache queue is full. If it is full, block new WUs from joining to control the sending rate.
[0044] A2. Check whether all WUs in the cache queue have timed out. If so, determine whether the retransmission count threshold has been reached.
[0045] A3. If the retransmission threshold is not reached, increase the retransmission count and retransmit the WU. If the retransmission threshold is reached, delete the WU and send a timeout WUR.
[0046] A4. Re-execute steps A2-A3 until all tasks are completed and all WUs are processed.
[0047] The present invention has the following advantages:
[0048] 1. The number of analysis slave modules is flexibly configurable, and on this basis, a monitoring module is added to monitor the status of the analysis slave modules in real time, and can promptly process and restore the analysis slave modules when errors occur in the analysis slave modules.
[0049] 2. The sliding processing window unit is introduced to control the message sending rate, avoiding message processing congestion caused by the mismatch between the sending rate and the processing rate, which affects the overall efficiency. At the same time, the feedback and retransmission mechanism is introduced to ensure the reliability of message processing. When the message is lost or the message processing times out, it can be quickly retransmitted and restored, ensuring the smoothness and reliability of the entire system.
[0050] 3. An intermediate message suite module with load balancing is introduced to ensure that messages are evenly distributed to different analysis slave modules for processing, maximizing the use of system resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a system schematic diagram of the present invention;
[0052] Figure 2 Schematic diagram of the process of analyzing the main module;
[0053] Figure 3 Schematic diagram of the process for analyzing the slave module;
[0054] Figure 4 It is a flow chart of the monitoring module;
[0055] Figure 5 Schematic diagram of the process of the sliding window unit. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of the present application provided below in conjunction with the drawings is not intended to limit the scope of protection of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application. The present invention is further described below in conjunction with the drawings.
[0057] One embodiment of the present invention relates to a parallel analysis system for software analysis, which can efficiently utilize the resources of multi-core processors or distributed systems to achieve the goal of parallel analysis of programs. The design and implementation of the framework adopts a modular and scalable design concept and can support a variety of software analysis tasks.
[0058] Through efficient task scheduling and load balancing mechanisms, it ensures that each processing unit can fully utilize computing resources and realize parallel processing. At the same time, the framework also provides flexible task division and combination methods, and can flexibly adjust task granularity and parallelism according to different software analysis requirements to achieve optimal performance. A variety of fault tolerance and recovery mechanisms are adopted to ensure that problems can be discovered and repaired in time when abnormal situations occur, ensuring the correctness and stability of the program. At the same time, the framework also provides monitoring and management functions to facilitate the monitoring and management of parallel programs, improving the maintainability and scalability of the system.
[0059] like Figure 1 As shown, it includes an analysis master module, multiple analysis slave modules, an intermediate message suite module and a monitoring module;
[0060] Analysis master module: used for assembling WU and sending it to the analysis slave module through the intermediate message suite module, receiving WUR sent by the intermediate message suite module and processing it to obtain the analysis result, as well as for WU sending rate control and error and timeout processing. WU is the smallest independent unit containing all the information required for analysis, and WUR is the result of software analyzing WU;
[0061] Analysis slave module: used for processing the WU sent by the intermediate message suite module and sending the WUR to the analysis master module through the intermediate message suite module;
[0062] Intermediate message suite module: connects the analysis master module and the analysis slave module, and is used for sending and receiving WU and WUR;
[0063] Monitoring module: used to monitor the status of all analysis slave modules and perform error recovery.
[0064] Further, the main analysis module includes a WU generation and sending unit, a WUR receiving and processing unit, and a sliding window unit;
[0065] WU generation and sending unit: used to load a fragment of the program to be analyzed from the outside, assemble it into a complete WU according to the WU format, and then send it to the analysis slave module through the intermediate message suite module. At the same time, the WU is added to the sliding window unit for rate control, error recovery, and timeout retransmission;
[0066] WUR receiving and processing unit: used to receive WUR from the intermediate message suite module, process WUR according to different states, and generate defect reports or error records;
[0067] Sliding window unit: used to control the rate of WU sending and perform error recovery when an error occurs or WU processing times out.
[0068] Further, the intermediate message suite module includes a load balancing unit and a connection unit;
[0069] Load balancing unit: used to distribute WU to different analysis slave modules in a balanced manner according to the load conditions of each analysis slave module, ensuring that each analysis module maintains an efficient working state;
[0070] Connection unit: as a bridge interface between the analysis master module and the analysis slave module, used to open a network connection port to realize the connection between the analysis master module and the analysis slave module.
[0071] Further, the monitoring module includes a timing unit and a task processing unit;
[0072] Timing unit: used to start the timing according to the timeout setting of each WU, and monitor whether the WU completes the processing within the set time;
[0073] Task processing unit: used to process each independent WU according to the analysis settings or analysis command options and return the processing result WUR.
[0074] Another embodiment of the present invention relates to a parallel analysis method for software analysis.
[0075] Step 1: After initializing the analysis master module, the intermediate message suite module and each analysis slave module, start the monitoring module and monitor the status of each analysis slave module in real time through the monitoring module;
[0076] Step 2: The main analysis module assembles the WU and sends it out through the intermediate message suite module, and at the same time caches the sent WU into the sliding window unit;
[0077] Step 3, the sliding window unit monitors the WU that has been sent from two aspects. On the one hand, it monitors the rate at which the WU is sent. When the number of WUs sent is greater than the set threshold, the main analysis module is blocked to send the WU. On the other hand, it times out and resends the WU. When the sent WU does not receive the WUR within the set time, the WU is resent and the number of resend attempts of the WU is increased. When the number of resend attempts of the WU exceeds the set threshold, the timeout WUR is sent to the WUR receiving and processing unit in the analysis main module.
[0078] Step 4: The analysis slave module receives and unpacks the WU, then starts the timer and an independent thread to process the WU, and finally sends the WUR to the analysis master module through the intermediate message suite module for result analysis and storage.
[0079] Furthermore, step one specifically includes the following contents:
[0080] Analyze the startup of the main module, apply for resources, initialize the WU generation and sending unit, WUR receiving and processing unit and sliding window unit;
[0081] Initialize the intermediate message suite module and open the connection port for the analysis master module and each analysis slave module to connect;
[0082] Enable the monitoring module, enable each analysis slave module according to machine resources or user configuration, and enable real-time monitoring of the status of the analysis slave modules. If a crash occurs, close the corresponding analysis slave module to release resources, and finally restart a new analysis slave module.
[0083] Start the analysis slave module, apply for resources, connect to the intermediate message suite module, and start the message receiving loop.
[0084] like Figure 2 As shown in the figure, the specific process steps of the main analysis module include:
[0085] Start the WU assembly sending unit, WUR receiving and processing unit, sliding window unit and monitoring module;
[0086] Start multiple analysis slave modules based on configuration or system resources;
[0087] Start the cycle of assembling WU, sending WU, receiving WUR and processing WUR;
[0088] After all WUs are analyzed and WURs are processed, resources are released and the operation ends.
[0089] like Figure 3 As shown, the specific process steps of analyzing the slave module include:
[0090] Receive WU and unpack it, and enable the timing module to monitor the time taken to process WU;
[0091] Start the thread to process WU. After WU processing is completed, WUR is sent. If it times out, a timeout WUR is sent.
[0092] The process of receiving WU, processing WU and sending WUR continues in a loop until all WU analysis is completed.
[0093] like Figure 4 As shown, the specific process steps of the monitoring module include:
[0094] Check the status of all analysis slave modules. If a certain analysis slave module crashes or fails, release the resources of the analysis slave module and restart the analysis slave module. If all analysis slave modules are in normal status, enter sleep mode.
[0095] When the sleep time is up, the previous step is re-executed until all tasks are completed and all analyses exit from the module.
[0096] like Figure 5 As shown, the specific process steps of the sliding window module include:
[0097] A1. Check whether the cache queue is full. If it is full, block new WUs from joining to control the sending rate.
[0098] A2. Check whether all WUs in the cache queue have timed out. If so, determine whether the retransmission count threshold has been reached.
[0099] A3. If the retransmission threshold is not reached, increase the retransmission count and retransmit the WU. If the retransmission threshold is reached, delete the WU and send a timeout WUR.
[0100] A4. Re-execute steps A2-A3 until all tasks are completed and all WUs are processed.
[0101] The above is only a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used for various other combinations, modifications and improvements, and can be modified within the scope of the concept described herein through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art do not deviate from the spirit and scope of the present invention, and should be within the scope of protection of the claims attached to the present invention.
Claims
1. A parallel analysis system for software analysis, characterized in that: The system includes an analysis master module, a plurality of analysis slave modules, an intermediate message suite module, and a monitoring module; The analysis master module is used for assembling WU and sending it to the analysis slave module through the intermediate message suite module, receiving WUR sent by the intermediate message suite module and processing it to obtain the analysis result, and for WU sending rate control and error and timeout processing. WU is the smallest independent unit containing all the information required for analysis, and WUR is the result of software analyzing WU; The analysis slave module is used to process the WU sent by the intermediate message suite module and send the WUR to the analysis master module through the intermediate message suite module; The intermediate message suite module: connects the analysis master module and the analysis slave module, and is used for sending and receiving WU and WUR; The monitoring module is used to monitor the status of all analysis slave modules and perform error recovery; The analysis main module includes a WU generation and sending unit, a WUR receiving and processing unit, and a sliding window unit; The WU generation and sending unit is used to load a fragment of the program to be analyzed from the outside, assemble it into a complete WU according to the WU format, and then send it to the analysis slave module through the intermediate message suite module, and at the same time add the WU to the sliding window unit for rate control, error recovery and timeout retransmission; The WUR receiving and processing unit is used to receive the WUR from the intermediate message suite module, process the WUR according to different states, and generate a defect report or error record; The sliding window unit is used to control the rate of WU transmission and perform error recovery when an error occurs or WU processing times out.
2. The parallel analysis system for software analysis according to claim 1, characterized in that: The intermediate message suite module includes a load balancing unit and a connection unit; The load balancing unit is used to distribute WU to different analysis slave modules in a balanced manner according to the load conditions of each analysis slave module, so as to ensure that each analysis module maintains an efficient working state; The connection unit serves as a bridge interface between the analysis master module and the analysis slave module, and is used to open a network connection port to achieve connection between the analysis master module and the analysis slave module.
3. The parallel analysis system for software analysis according to claim 1, characterized in that: The monitoring module includes a timing unit and a task processing unit; The timing unit is used to start the timing according to the timeout setting of each WU, and monitor whether the WU completes the processing within the set time; The task processing unit is used to process each independent WU according to the analysis settings or analysis command options and return the processing result WUR.
4. An analysis method based on the parallel analysis system for software analysis according to any one of claims 1 to 3, characterized in that: The analysis method comprises: Step 1: After initializing the analysis master module, the intermediate message suite module and each analysis slave module, start the monitoring module and monitor the status of each analysis slave module in real time through the monitoring module; Step 2: The main analysis module assembles the WU and sends it out through the intermediate message suite module, and at the same time caches the sent WU into the sliding window unit; Step 3, the sliding window unit monitors the WU that has been sent from two aspects. On the one hand, it monitors the rate at which the WU is sent. When the number of WUs sent is greater than the set threshold, the main analysis module is blocked to send the WU. On the other hand, it times out and resends the WU. When the sent WU does not receive the WUR within the set time, the WU is resent and the number of resend attempts of the WU is increased. When the number of resend attempts of the WU exceeds the set threshold, the timeout WUR is sent to the WUR receiving and processing unit in the analysis main module. Step 4: The analysis slave module receives and unpacks the WU, then starts the timer and an independent thread to process the WU, and finally sends the WUR to the analysis master module through the intermediate message suite module for result analysis and storage.
5. The analysis method according to claim 4, characterized in that: The step 1 specifically includes the following contents: Analyze the startup of the main module, apply for resources, initialize the WU generation and sending unit, WUR receiving and processing unit and sliding window unit; Initialize the intermediate message suite module and open the connection port for the analysis master module and each analysis slave module to connect; Enable the monitoring module, enable each analysis slave module according to machine resources or user configuration, and enable real-time monitoring of the status of the analysis slave modules. If a crash occurs, close the corresponding analysis slave module to release resources, and finally restart a new analysis slave module. Start the analysis slave module, apply for resources, connect to the intermediate message suite module, and start the message receiving loop.
6. The analysis method according to claim 4, characterized in that: The specific process steps of the main analysis module include: Start the WU assembly sending unit, WUR receiving and processing unit, sliding window unit and monitoring module; Start multiple analysis slave modules based on configuration or system resources; Start the cycle of assembling WU, sending WU, receiving WUR and processing WUR; After all WUs are analyzed and WURs are processed, resources are released and the operation ends.
7. The analysis method according to claim 4, characterized in that: The specific process steps of analyzing the slave module include: Receive WU and unpack it, and enable the timing module to monitor the time taken to process WU; Start the thread to process WU. After the WU is processed, a WUR is sent. If it times out, a timeout WUR is sent. The process of receiving WU, processing WU and sending WUR continues in a loop until all WU analysis is completed.
8. The analysis method according to claim 4, characterized in that: The specific process steps of the monitoring module include: B1. Check the status of all analysis slave modules. If a certain analysis slave module crashes or fails, release the resources of the analysis slave module and restart the analysis slave module. If all analysis slave modules are in normal status, enter sleep mode. B2. When the sleep time is up, re-execute step B1 until all tasks are completed and all analyses exit from the module.
9. The analysis method according to claim 4, characterized in that: The specific process steps of the sliding window module include: A1. Check whether the cache queue is full. If it is full, block new WUs from joining to control the sending rate. A2. Check whether all WUs in the cache queue have timed out. If so, determine whether the retransmission count threshold has been reached. A3. If the retransmission threshold is not reached, increase the retransmission count and retransmit the WU. If the retransmission threshold is reached, delete the WU and send a timeout WUR. A4. Re-execute steps A2-A3 until all tasks are completed and all WUs are processed.
