Link-Time Thread Conflict Detection in Multi-Threaded Compilation

Resolve Bottlenecks,
Find Innovative Solutions
Generate 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

VSEngineering 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

Engineering Contradiction:
Improvecompilation efficiencyVSAvoidconflict detection capability
Core Design Contradiction:
ProductivityVSReliability

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.

Inventive Principle:
Principle #1Segmentation

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.

Inventive Principle:
Principle #10Preliminary action

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

Engineering Contradiction:
Improveerror detection timingVSAvoidconflict detection completeness
Core Design Contradiction:
Loss of timeVSMeasurement precision

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.

Inventive Principle:
Principle #24Intermediary (Mediator)

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.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

3Measurement precision

If a linker is designed to assess symbols for thread conflicts, then conflict detection accuracy is improved, but linker complexity increases

Engineering Contradiction:
Improveconflict detection accuracyVSAvoidlinker complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

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.

Inventive Principle:
Principle #2Taking out (Extraction)

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

Engineering Contradiction:
Improvecompiler simplicityVSAvoidruntime execution safety
Core Design Contradiction:
Device complexityVSReliability

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.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS8826258B2Compiling and linking
Publication Date: 2014.09.02 XMOS
  • US8826258B2 patent drawing
  • US8826258B2 patent drawing
  • US8826258B2 patent drawing

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.