Virtualizing Mutually Exclusive Locks for Immutable Shared Objects

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Transparent sharing of immutable objects across tasks in multi-threaded programming environments leads to potential inter-task interference due to monitor activity, which can result in performance issues and security vulnerabilities like denial-of-service attacks, making it difficult to allow sharing while preventing lock-related interferences.

Innovation Solution

The method dynamically virtualizes the monitor of an object into a set of monitors when multiple tasks execute monitor operations simultaneously, allowing threads from different tasks to fast lock and unlock immutable shared objects, and inflating or virtualizing locks as needed to prevent interference, with virtualization only occurring in the slow path of monitor acquisition, thus minimizing overhead in frequent cases.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Quantity of substance

If immutable objects are shared transparently across multiple tasks, then memory footprint is reduced, but inter-task interference occurs through monitor activity

Engineering Contradiction:
Improvememory footprintVSAvoidinter-task interference
Core Design Contradiction:
Quantity of substanceVSReliability

Solution Approach 1:

The patent segments the shared immutable object into task-specific copies when interference is detected. Each task receives its own copy of the object, eliminating monitor contention while maintaining the appearance of shared access. This resolves the contradiction by allowing memory sharing when safe and creating separate copies only when needed to prevent interference.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a monitor virtualization mechanism as an intermediary layer between tasks and shared objects. This virtualizer intercepts monitor operations and dynamically determines whether to grant access or create copies, mediating between the desire for shared memory and the need to prevent interference.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If monitor virtualization is applied to all lock acquisitions, then inter-task interference is prevented, but performance overhead increases

Engineering Contradiction:
Improveinter-task interference preventionVSAvoidlock acquisition performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent applies monitor virtualization selectively rather than universally. It performs partial virtualization by checking for task identity in the slow path of lock acquisition only when necessary, rather than applying full virtualization to all lock operations. This maintains high performance for uncontended locks while preventing interference when needed.

Inventive Principle:
Principle #16Partial or excessive action

Solution Approach 2:

The patent applies different levels of monitoring to different situations. Fast path lock acquisitions (same task) receive minimal oversight, while slow path acquisitions (potential cross-task) receive full virtualization checking. This local differentiation optimizes performance while maintaining reliability.

Inventive Principle:
Principle #3Local quality

3Reliability

If copy-on-first-lock-acquisition is used to prevent interference, then monitor contention is eliminated, but updating all references becomes extremely costly

Engineering Contradiction:
Improvemonitor contention eliminationVSAvoidreference update complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

Instead of copying the entire object graph, the patent segments the solution to only copy the specific immutable object that caused the interference. This limited segmentation avoids the exponential complexity of updating all references while still eliminating the specific monitor contention problem.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent uses selective copying of only the necessary immutable object rather than comprehensive copying of all references. This targeted copying approach achieves interference prevention with minimal overhead by copying only when and where needed.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS7761872B1Method for virtualizing mutually exclusive locks of immutable shared objects
Publication Date: 2010.07.20 ORACLE AMERICAN INC
  • US7761872B1 patent drawing
  • US7761872B1 patent drawing
  • US7761872B1 patent drawing

AI summary

A method is provided to virtualize a mutually exclusive lock of a shared immutable object. A determination is made whether any threads have locked the immutable shared object. If threads have not locked the immutable shared object, threads of different tasks are allowed to fast lock and unlock the immutable shared object. If a thread requests the lock of an immutable shared object and the object is fast locked by another thread when both threads are from an equivalent task, the lock of the immutable shared object is inflated and the requesting thread is blocked. If a thread requests the lock of an immutable shared object and the object is fast locked by another thread when both threads are from different tasks, the lock of the immutable shared object is virtualized and granted to the requesting thread.