Read-Write Lock Reentry Mechanism for Autopilot Concurrency

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In high-concurrency autopilot systems, the exclusive nature of write locks leads to excessive lock waits and performance degradation due to deadlocks caused by the need to protect data consistency across reading and writing operations.

Innovation Solution

Implementing read-write lock reentry by acquiring a historical write-lock thread when a target resource is in a write-lock-exclusive state and adding a new lock if the requesting thread is identical to the historical write-lock thread, thereby allowing reentry and avoiding deadlocks.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If write locks are used to protect data consistency in critical zones, then data consistency is ensured, but lock wait time increases and system performance decreases

Engineering Contradiction:
Improvedata consistencyVSAvoidlock wait time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The lock mechanism is segmented into read locks and write locks with different permissions. Read locks allow multiple concurrent readers while write locks provide exclusive access, segmenting the access control to reduce waiting time while maintaining data consistency when needed.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The lock mechanism dynamically adjusts its behavior based on the operation type. When a thread already holds a write lock and requests another lock on the same resource, the system dynamically allows reentry without requiring the thread to wait, adapting the lock behavior to the specific context.

Inventive Principle:
Principle #15Dynamics

2Reliability

If multiple lock operations are performed within the same thread to ensure data consistency, then data consistency is maintained, but deadlock occurs due to the exclusive characteristic of write locks

Engineering Contradiction:
Improvedata consistencyVSAvoidsystem operation continuity
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The system performs preliminary checking to determine if a thread already holds a write lock before allowing it to acquire another lock on the same resource. This preliminary identification of the thread's lock state enables the system to allow reentry proactively, preventing deadlock before it occurs.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The lock management mechanism acts as an intermediary that mediates between the thread's lock requests and the resource's lock state. It introduces a reentry check as an intermediate step that determines whether to grant or deny the lock request, preventing deadlock while allowing necessary operations.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS11119832B2Method and device for implementing read-write lock reentry, terminal and storage medium
Publication Date: 2021.09.14 APOLLO INTELLIGENT DRIVING (BEIJING) TECHNOLOGY CO LTD
  • US11119832B2 patent drawing
  • US11119832B2 patent drawing
  • US11119832B2 patent drawing

AI summary

The embodiments of the present disclosure provide a method and a device for implementing read-write lock reentry, a terminal and a storage medium. The method includes: receiving a write lock request of a thread to a target resource; in response to determining that the target resource is in a write-lock-exclusive state, acquiring a historical write-lock thread to the target resource that is in the write-lock-exclusive state; in response to determining that the thread is identical to the historical write-lock thread, adding a new lock of the thread to the target resource.