Loop Control Flow Diversion via Indirection Cell for Thread Synchronization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for synchronizing long-running threads in computational systems, such as during garbage collection, often complicate program code and degrade performance by requiring additional annotations or state checks, which are not universally applicable due to operating system limitations.

Innovation Solution

The implementation of loop control flow diversion using indirection cells, where a loop's execution flow is diverted through an indirection cell that can be altered by another thread, allowing for synchronization without restricting register validity and without requiring specific operating system support.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If program state annotations or global state checks are inserted to synchronize long-running threads, then thread synchronization capability is improved, but program code complexity increases and execution performance degrades

Engineering Contradiction:
Improvethread synchronization capabilityVSAvoidprogram code complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent introduces an indirection cell as an intermediary between the loop jump instruction and the loop top address. This indirection cell acts as a mediator that can be atomically altered by the kernel to divert execution flow to a synchronization routine, enabling thread synchronization without requiring program state annotations or global state checks in the application code.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The synchronization mechanism is extracted from the application code and placed in the kernel layer. The kernel gains the ability to forcibly modify a thread's execution context by altering the indirection cell, removing the need for synchronization logic to be embedded in the application code, thus reducing code complexity while maintaining synchronization capability.

Inventive Principle:
Principle #2Taking out (Extraction)

2Reliability

If program state annotations or global state checks are inserted to synchronize long-running threads, then thread synchronization capability is improved, but execution performance deteriorates

Engineering Contradiction:
Improvethread synchronization capabilityVSAvoidexecution performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The indirection cell serves as a mediator that enables efficient context diversion. By modifying the indirection cell atomically, the kernel can redirect execution flow to a synchronization routine without requiring frequent state checks or annotations in the application code, minimizing performance overhead while maintaining synchronization capability.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The loop jump instruction is pre-configured to reference the indirection cell instead of directly jumping to the loop top. This preliminary setup allows the kernel to efficiently divert execution flow by simply altering the indirection cell content, avoiding the need for complex synchronization checks during loop execution and thus preserving performance.

Inventive Principle:
Principle #10Preliminary action

3Reliability

If traditional synchronization approaches are used, then thread synchronization is achieved, but portability across operating systems is reduced due to OS support limitations

Engineering Contradiction:
Improvethread synchronizationVSAvoidoperating system portability
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The indirection cell mechanism provides a universal synchronization approach that works across different operating systems. By using a memory-based indirection cell that can be atomically modified, the solution achieves portability without relying on OS-specific thread control APIs, making the synchronization mechanism adaptable to various operating system environments.

Inventive Principle:
Principle #6Universality (Multi-functionality)

4Adaptability or versatility

If loop control flow diversion is implemented using indirection cells, then code portability and performance are improved, but control flow mechanism complexity increases

Engineering Contradiction:
Improvecode portabilityVSAvoidcontrol flow mechanism complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The indirection cell acts as a simple intermediary that bridges the gap between the loop jump instruction and the loop top address. This intermediary enables portability and performance improvements while keeping the control flow mechanism relatively simple, as it only requires a memory cell and an atomic store operation rather than complex OS-specific mechanisms.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS8887142B2Loop control flow diversion
Publication Date: 2014.11.11 MICROSOFT TECHNOLOGY LICENSING LLC
  • US8887142B2 patent drawing
  • US8887142B2 patent drawing
  • US8887142B2 patent drawing

AI summary

Loop control flow diversion supports thread synchronization, garbage collection, and other situations involving suspension of long-running loops. Divertible loops have a loop body, a loop top, an indirection cell containing a loop top address, and a loop jump instruction sequence which references the indirection cell. In normal execution, control flows through the indirection cell to the loop top. After the indirection cell is altered, however, execution flow is diverted to a point away from the loop top. Operations such as garbage collection are performed while the loop (and hence the thread(s) using the loop) is thus diverted. The kernel or another thread then restores the loop top address into the indirection cell, and execution flow again continues through the restored indirection cell to the loop top.