Runtime Function Versioning for Single-Threaded Overhead Reduction

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing operating system functions incur unnecessary overhead to ensure multi-thread safety, leading to performance degradation when executed in single-threaded mode, as they execute additional code meant for multi-threaded environments.

Innovation Solution

A runtime optimizer manages the referencing of two versions of a function, one for single-threaded and one for multi-threaded modes, dynamically switching between them based on the execution context to ensure multi-thread safety only when necessary.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If a function executes additional code to ensure multi-thread safety, then data integrity and consistency are maintained in multi-threaded mode, but execution overhead increases even in single-threaded mode

Engineering Contradiction:
Improvedata integrityVSAvoidexecution speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent applies dynamics by making the function version selection adaptive rather than static. The system dynamically determines whether to use the single-threaded or multi-threaded version of a function based on the actual execution context (single-threaded vs. multi-threaded mode). This allows the system to optimize performance in single-threaded scenarios while ensuring data integrity when multiple threads are present, resolving the contradiction between reliability and productivity.

Inventive Principle:
Principle #15Dynamics

2Adaptability or versatility

If a function is designed to be multi-thread safe with locking code, then it can safely handle multiple threads, but it incurs unnecessary overhead when invoked in single-threaded mode

Engineering Contradiction:
Improvemulti-thread safetyVSAvoidexecution time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The patent segments the function implementation into two distinct versions: a single-threaded version without locking code and a multi-threaded version with locking code. The runtime system selects the appropriate version based on the execution context. This segmentation eliminates the unnecessary overhead in single-threaded mode while preserving multi-thread safety when needed, addressing the contradiction between adaptability and time loss.

Inventive Principle:
Principle #1Segmentation

3Ease of manufacture

If the same function code is used for both single-threaded and multi-threaded modes, then implementation is simplified, but performance degrades in single-threaded mode due to unnecessary safety checks

Engineering Contradiction:
Improveimplementation simplicityVSAvoidprogram performance
Core Design Contradiction:
Ease of manufactureVSProductivity

Solution Approach 1:

The patent introduces an intermediary mechanism (the runtime optimizer that manages function version selection) to bridge between the two function versions. This intermediary automatically selects the appropriate function version based on thread execution mode, maintaining implementation simplicity from the user's perspective while achieving optimal performance by preventing execution of unnecessary locking code in single-threaded mode.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS8020155B2Mechanism for optimizing function execution
Publication Date: 2011.09.13 ORACLE AMERICAN INC
  • US8020155B2 patent drawing
  • US8020155B2 patent drawing
  • US8020155B2 patent drawing

AI summary

A mechanism is provided for managing the referencing of at least two versions of a function. A first version is a single threaded version that does not ensure multi-thread safety. A second version is a multi threaded version that does ensure multi-thread safety. The mechanism determines whether a set of executable code (e.g. a program) is currently executing in single-threaded mode or multi-threaded mode. If the executable code is executing in single-threaded mode, then the mechanism causes the executable code to reference the first version of the function. If the executable code is executing in multi-threaded mode, then the mechanism causes the executable code to reference the second version of the function. By doing so, the mechanism ensures that the additional overhead of ensuring multi-thread safety is incurred only when it is needed. In this manner, the mechanism makes execution of the function more optimal.