18484641. CODE INSPECTION METHOD UNDER WEAK MEMORY ORDERING ARCHITECTURE AND CORRESPONDING DEVICE simplified abstract (Huawei Technologies Co., Ltd.)
CODE INSPECTION METHOD UNDER WEAK MEMORY ORDERING ARCHITECTURE AND CORRESPONDING DEVICE
Organization Name
Inventor(s)
Jonas Oberhauser of Dresden (DE)
CODE INSPECTION METHOD UNDER WEAK MEMORY ORDERING ARCHITECTURE AND CORRESPONDING DEVICE - A simplified explanation of the abstract
This abstract first appeared for US patent application 18484641 titled 'CODE INSPECTION METHOD UNDER WEAK MEMORY ORDERING ARCHITECTURE AND CORRESPONDING DEVICE
Simplified Explanation
This patent application discloses a method for code inspection that involves analyzing source code and test code to identify potential issues related to shared memory access in a multi-threaded environment. The method includes the following steps:
- Obtaining the first source code and test code, where the first source code includes a blocking mark and corresponds to multiple threads that share at least one memory location.
- Generating multiple execution flows based on the first source code and the conditions specified by the test code. These execution flows represent the possible sequences of instructions executed by the threads under a weak memory ordering architecture.
- Identifying a target execution flow that includes the blocking mark and a busy-wait loop. A busy-wait loop is a loop that repeatedly checks a condition until it becomes true, causing the thread to spin and waste CPU cycles.
- Determining if the busy-wait loop in the target execution flow is an infinite loop. This is done by checking if a read operation executed by a thread in one iteration of the loop can reference a write operation that has not been referenced before.
Potential applications of this technology:
- Software development: This method can be used during the development process to identify potential issues related to shared memory access in multi-threaded applications. It can help developers ensure the correctness and efficiency of their code.
- Code optimization: By identifying and eliminating infinite busy-wait loops, this method can help optimize the performance of multi-threaded applications by reducing unnecessary CPU usage.
Problems solved by this technology:
- Data race conditions: The method helps identify potential data race conditions that can occur when multiple threads access shared memory locations concurrently without proper synchronization. Data races can lead to unpredictable and incorrect behavior of the program.
- Performance degradation: Infinite busy-wait loops can cause significant performance degradation by wasting CPU cycles. This method helps identify and eliminate such loops, improving the overall efficiency of multi-threaded applications.
Benefits of this technology:
- Improved software reliability: By identifying and addressing potential data race conditions, this method helps improve the reliability and correctness of multi-threaded applications.
- Enhanced performance: By eliminating infinite busy-wait loops, this method helps optimize the performance of multi-threaded applications by reducing unnecessary CPU usage and improving overall efficiency.
Original Abstract Submitted
This application discloses a code inspection method, including: obtaining first source code and test code, where the first source code includes a blocking mark, the first source code corresponds to a plurality of threads, the plurality of threads have at least one shared memory; generating, based on the first source code and the condition indicated by the test code, a plurality of execution flows under the weak memory ordering architecture for the plurality of threads that operate a same shared memory, where a busy-wait loop exists in a target execution flow that includes the blocking mark and that is in the plurality of execution flows; and determining the busy-wait loop in the target execution flow as an infinite loop if a read operation executed by a target thread in one iteration of the busy-wait loop cannot reference an unreferenced write operation.