Shared Memory Lock Acquisition Reducing Kernel Context Switches

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional techniques for acquiring a lock in a computer system are inefficient, as they often require costly context switches between user-space and kernel, and lack information sharing to determine lock availability across multiple processes and processors, leading to unnecessary system calls and resource usage.

Innovation Solution

A system and method that utilize data indicative of operating system scheduling in a shared user-operating system memory space to allow user processes to detect lock availability and adjust their actions accordingly, reducing the need for system calls by providing information about scheduled activities, which helps in making informed decisions to acquire locks or conserve resources like battery power.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Speed

If user-space processes attempt to acquire locks without kernel involvement, then lock acquisition speed improves, but the process cannot determine lock availability across multiple processors and processes

Engineering Contradiction:
Improvelock acquisition speedVSAvoidlock availability information
Core Design Contradiction:
SpeedVSLoss of information

Solution Approach 1:

The patent introduces shared memory regions as an intermediary between user-space processes and kernel lock management. These shared memory regions contain data structures that track lock ownership and availability across multiple processors, allowing user-space processes to query lock status without immediate kernel involvement while still accessing accurate cross-processor lock information.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system pre-establishes shared memory regions with lock management data structures before lock operations begin. These regions are initialized with kernel-managed lock state information, enabling user-space processes to perform preliminary checks on lock availability before attempting acquisition, thus avoiding unnecessary context switches while maintaining accurate information.

Inventive Principle:
Principle #10Preliminary action

2Reliability

If system calls are made to kernel for lock acquisition, then accurate lock state information is obtained, but processing time increases significantly

Engineering Contradiction:
Improvelock state information accuracyVSAvoidprocessing time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The shared memory regions act as an intermediary cache that stores lock state information, reducing the need for direct system calls to the kernel. User-space processes can query this intermediate storage for lock status, obtaining accurate information without the overhead of frequent context switches, thus maintaining reliability while reducing processing time.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system creates copies of lock management data structures in user-accessible shared memory regions, mirroring the kernel's lock state information. This copying approach allows user-space processes to read lock status without requiring the process to be suspended and transferred to kernel space, thereby maintaining information accuracy while significantly reducing the time cost of lock queries.

Inventive Principle:
Principle #26Copying

3Loss of information

If kernel manages all lock operations, then comprehensive system state knowledge is available, but context switch overhead increases by 10 to 1000 times

Engineering Contradiction:
Improvesystem state knowledgeVSAvoidcontext switch time
Core Design Contradiction:
Loss of informationVSLoss of time

Solution Approach 1:

The patent segments lock management functionality into two parts: kernel-managed shared memory regions that maintain authoritative lock state information, and user-space processes that can query and operate on locks through these regions. This segmentation allows the kernel to maintain comprehensive system state knowledge while enabling user-space operations without full context switches, thus reducing the 10 to 1000 times overhead associated with traditional kernel-managed lock operations.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Shared memory regions serve as an intermediary layer between the kernel's comprehensive lock management and user-space lock operations. The kernel maintains the authoritative lock state in these shared regions, and user-space processes can access this information and perform lock operations without requiring complete context switches to kernel space, thereby preserving system state knowledge while dramatically reducing context switch overhead.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS7765548B2System, method and medium for using and/or providing operating system information to acquire a hybrid user/operating system lock
Publication Date: 2010.07.27 RED HAT INC
  • US7765548B2 patent drawing
  • US7765548B2 patent drawing
  • US7765548B2 patent drawing

AI summary

A system, method and medium for utilizing data indicative of operating system activity to determine if a process should continue to attempt to acquire a lock, or make a call to an operating system.