Lock Leasing Mechanism Resolving Deadlock in Multi-Threaded Systems
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Deadlocks occur in multi-threaded computing systems when two threads wait for each other to release locks, leading to a situation where progress is halted indefinitely, and re-engineering software to use separate locks for resources can be costly and impractical, especially in complex systems.
Innovation Solution
Implementing a novel lock leasing mechanism where a first thread transfers control of a lock to a second thread while retaining ownership, allowing the second thread to access resources and ensuring data consistency, with options for selecting the second thread based on priority, round robin, or first-in-first-out queues, and enabling subleasing to further threads.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a single lock is used to synchronize access to multiple resources in a multi-threaded system, then data consistency is maintained, but deadlock occurs when threads wait for each other to release the lock
Solution Approach 1:
The patent segments the lock ownership by introducing a lease mechanism that separates ownership (retained by the first thread) from control (transferred to the second thread). This segmentation allows the first thread to maintain ownership for consistency while the second thread gains control to prevent deadlock, resolving the contradiction between data consistency and deadlock prevention.
Solution Approach 2:
The patent introduces a lock lease as an intermediary mechanism between threads. The lease acts as a mediator that transfers control of the lock to the second thread while the first thread retains ownership. This intermediary structure enables safe control transfer without creating deadlock conditions, while maintaining the ownership structure that ensures data consistency.
2Loss of time
If separate locks are created to prevent deadlock, then thread coordination is improved, but software complexity and re-engineering effort increase significantly
Solution Approach 1:
The patent makes the existing single lock multi-functional by adding the lease mechanism. The lock now serves dual purposes: maintaining ownership for consistency and enabling controlled transfer of access rights. This eliminates the need for multiple separate locks while still preventing deadlock, thereby improving thread coordination without increasing software complexity.
Solution Approach 2:
The patent introduces dynamic lease management that allows flexible control transfer between threads. The lease mechanism dynamically adjusts lock control based on thread needs without requiring static re-engineering of the software architecture. This dynamic approach prevents deadlock while maintaining simplicity, as the same lock structure adapts its behavior rather than requiring multiple fixed locks.
3Productivity
If lock control is transferred to another thread to prevent deadlock, then thread progress is enabled, but data consistency may be compromised
Solution Approach 1:
The patent segments lock functionality into ownership and control, allowing the second thread to gain control for progress while the first thread retains ownership that ensures data consistency. This segmentation enables both thread progress and consistency maintenance simultaneously, resolving the contradiction between productivity and reliability.
Solution Approach 2:
The lock lease acts as an intermediary that enables controlled transfer of access rights. The lease mechanism ensures that control transfer occurs in a managed way that maintains consistency guarantees. The first thread's retained ownership serves as a consistency anchor even while control is temporarily transferred, enabling both progress and consistency.
Data Source
AI summary
A method for resolving deadlock in a multi-threaded computing system using a novel lock lease is disclosed. A first thread leases a lock held by the first thread to a second thread different from the first thread. The leasing transfers control of the lock to the second thread while the first thread retains ownership of the lock. To lease the lock: (1) the second thread applies for the lease from the first thread; (2) the first thread grants the lease; (3) the first thread waits for the second thread to complete a task; (4) the second thread terminates the lease; (5) the first thread confirms termination of the lease. The first thread receives control of the lock back from the second thread after the second thread has finished using resources controlled by the lock. The second thread also can sublease the lock to a third thread.


