Dynamic Locking Protocol Using Object Counters for Database Concurrency
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing database systems face challenges in managing concurrent access and updates from multiple threads, leading to deadlocks and inefficient resource usage, particularly when object identifiers are customizable and determined at runtime, which complicates traditional locking mechanisms.
Innovation Solution
The method employs counters attached to object definitions to monitor status during reading and writing, treating all threads as readers initially, and converting them to writer threads only when all necessary objects are secured, with a global critical section to manage locks and ensure atomic conversion, thereby preventing deadlocks and optimizing resource usage.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If traditional locking mechanisms are used to manage concurrent access, then database integrity is maintained, but deadlocks occur and resource usage becomes inefficient
Solution Approach 1:
The patent segments the database into object-level units with individual locks instead of using a monolithic locking mechanism. Each object has its own counter and lock, allowing fine-grained concurrent access. This segmentation prevents deadlocks by enabling readers to access multiple objects simultaneously without requiring global lock ordering, while maintaining integrity through atomic conversion of reader locks to writer locks.
Solution Approach 2:
The patent implements dynamic locking where threads can transition from reader mode to writer mode atomically. The lock state is not fixed but dynamically changes based on operational needs. Writer threads convert all their reader locks to writer locks simultaneously, and the system dynamically adjusts lock states based on whether objects are being read or written, optimizing resource usage.
2Reliability
If the entire database is locked to prevent deadlocks, then data consistency is ensured, but resource usage efficiency decreases
Solution Approach 1:
Instead of locking the entire database, the patent applies segmentation at the object level. Each object has its own counter (m-read, m-writer) and lock mechanism. This allows multiple objects to be accessed concurrently by different threads without locking the whole database, significantly improving resource usage efficiency while maintaining data consistency through localized locking.
Solution Approach 2:
The patent applies local locking quality where each object receives tailored lock management appropriate to its access patterns. Objects being read have reader locks, objects being written have writer locks, and the locking behavior is localized to specific objects rather than applying uniformly across the entire database.
3Reliability
If objects are locked in numerical order to prevent deadlocks, then deadlock prevention is achieved, but the system becomes complex when object identifiers are customizable
Solution Approach 1:
The locking mechanism is self-managing through object-level counters that automatically track read and write operations. The counter (m-read, m-writer) self-updates during operations, and the system automatically determines when to convert reader locks to writer locks or release locks, eliminating the need for external deadlock prevention algorithms or complex ordering protocols.
Solution Approach 2:
The patent changes the locking parameters from fixed numerical ordering to dynamic state-based locking. Instead of locking objects in a predetermined order, the system uses counter values (m-read, m-writer) to dynamically determine lock acquisition and conversion, simplifying the mechanism for customizable object identifiers while maintaining deadlock prevention.
4Adaptability or versatility
If reader threads convert to writer threads individually, then flexibility is achieved, but wait times increase
Solution Approach 1:
The patent merges multiple individual lock conversions into a single atomic operation. When a thread converts all its reader locks to writer locks simultaneously in one atomic step, it eliminates the sequential wait time that would occur if conversions happened individually. This merging of conversions achieves both flexibility and reduced wait time.
Solution Approach 2:
The system performs preliminary action by having threads acquire all necessary reader locks before attempting conversion to writer locks. The atomic conversion happens only when all reader locks are secured, preparing the thread in advance for efficient writer mode operation without unnecessary waiting.
Data Source
AI summary
The present invention discloses a Locking Protocol using Dynamic Locks and Dynamic Shared Memory which provides a method whereby a designated critical section monitors object status through employment of counters attached to the object=s definition that will increment and decrement during reading and writing.


