Link-Time Thread Conflict Detection in Multi-Threaded Compilation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing compiler and linker technologies fail to detect conflicts between parallel threads in multi-threaded programs effectively, leading to potential race conditions and resource allocation issues, as they lack visibility of conflicts arising from procedures in different source code modules during compilation.
Innovation Solution
A method and tool-chain that independently compiles and links source code modules, inserting symbols indicative of thread properties to detect conflicts at link-time, allowing for assessment and resolution of thread conflicts and resource allocation errors, thereby ensuring safe parallel execution.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If source code modules are independently compiled to generate object modules with parallel threads, then compilation efficiency and modularity are improved, but conflict detection capability deteriorates because the compiler has no visibility of conflicts from different modules
Solution Approach 1:
The compilation process is segmented into independent module compilation followed by a separate linking phase. Each module is compiled independently to maintain efficiency, while the linking phase segments the conflict detection task by analyzing symbols across module boundaries to identify parallel execution conflicts that span multiple modules.
Solution Approach 2:
Symbols indicative of thread properties are inserted into object modules during compilation as preliminary preparation. These symbols are placed in advance so that the linking phase can efficiently detect conflicts without re-analyzing the entire code, resolving the contradiction between independent compilation and conflict detection.
2Loss of time
If conflict detection is performed at compile-time within individual modules, then early error detection is improved, but detection completeness deteriorates due to lack of visibility across module boundaries
Solution Approach 1:
Symbols serve as intermediaries between the compilation phase and conflict detection. These symbols are inserted during compilation and carry thread property information through to the linking phase, enabling the linker to act as a mediator that detects conflicts across module boundaries without requiring full visibility during individual module compilation.
Solution Approach 2:
The conflict detection problem is shifted from the compilation dimension (individual module scope) to the linking dimension (program-wide scope). By moving conflict detection to the linking phase, the system gains visibility across all modules while maintaining the benefits of independent compilation, effectively adding a new dimension to the detection process.
3Measurement precision
If a linker is designed to assess symbols for thread conflicts, then conflict detection accuracy is improved, but linker complexity increases
Solution Approach 1:
The conflict detection functionality is extracted as a distinct phase within the linking process. Rather than embedding complex conflict analysis throughout the entire toolchain, the invention isolates symbol assessment and conflict detection to the linking phase, where symbols from all modules are already available, thereby improving detection accuracy while containing complexity in a specific, manageable location.
4Device complexity
If thread conflict checks are deferred to link-time, then compiler simplicity is maintained, but runtime reliability may be compromised by undetected conflicts
Solution Approach 1:
Symbols act as intermediaries that bridge the simple compilation phase and the reliable conflict detection phase. By inserting these symbols during compilation and having the linker assess them, the system maintains compiler simplicity while ensuring that conflicts are detected before runtime execution, thereby preserving runtime reliability without complicating the compiler.
Data Source
AI summary
A method of generating a computer program, the method comprising: independently compiling a plurality of source code modules to generate a plurality of respective object modules comprising a plurality of respective threads explicitly designated by a user to be executed in parallel; in each of the object modules, inserting at least one symbol indicative of a property of the object module's thread potentially conflicting with a corresponding property of a thread of another of said object module as a result of parallel execution of those threads; executing a linker to perform a linking process on said object modules, the linking process comprising: assessing the symbols in conjunction with one another to determine whether a conflict exists between the threads of two or more of the respective object modules; and linking the object modules to generate a computer program in which said threads are executable in parallel, wherein the linking is performed in dependence on said assessment.


