User-Level Thread Context Inheritance for Kernel Compatibility

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

User-level threads implemented by coroutines lack compatibility with kernel-level threads due to missing functions such as thread-local variables, preemptive scheduling, and signal communication, limiting their ability to interact effectively with kernel-level threads.

Innovation Solution

A method and apparatus that create a user-level thread inheriting the context of a kernel-level thread, allowing the user-level thread to utilize the kernel-level thread's functions, including thread-local variables and signal handling, to enhance compatibility and functionality.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If user-level threads are implemented by coroutines, then thread switching costs are reduced and customizable scheduling policies are achieved, but compatibility with kernel-level threads deteriorates due to missing functions

Engineering Contradiction:
Improvethread switching efficiencyVSAvoidcompatibility with kernel-level threads
Core Design Contradiction:
ProductivityVSAdaptability or versatility

Solution Approach 1:

The patent merges the advantages of user-level threads (customizable scheduling, low switching costs) with the functionality of kernel-level threads by allowing user-level threads to inherit kernel-level thread contexts. This combination enables user-level threads to access thread-local variables and signal handling capabilities while maintaining efficient user-space scheduling.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The patent introduces a hybrid thread model that acts as an intermediary between pure user-level coroutines and kernel-level threads. This hybrid model allows user-level threads to utilize kernel-level thread contexts for functionality while being managed by user-space schedulers, bridging the gap between the two approaches.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If user-level threads use coroutines, then scheduling flexibility is improved, but functional completeness deteriorates due to lack of thread-local variables and signal communication

Engineering Contradiction:
Improvescheduling flexibilityVSAvoidfunctional completeness
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent makes user-level threads multi-functional by enabling them to inherit kernel-level thread contexts. This allows user-level threads to perform multiple functions including accessing thread-local variables, handling signals, and maintaining customizable scheduling, thereby achieving both scheduling flexibility and functional completeness.

Inventive Principle:
Principle #6Universality (Multi-functionality)

3Adaptability or versatility

If user-level threads inherit kernel-level thread context, then compatibility is improved, but system complexity increases due to additional thread management mechanisms

Engineering Contradiction:
Improvethread compatibilityVSAvoidthread management complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent segments thread management into two distinct layers: user-space scheduling for flexibility and kernel-space context management for functionality. This segmentation allows each layer to handle specific aspects of thread management independently, reducing overall system complexity while maintaining compatibility.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS20250013494A1Thread management methods and apparatuses
Publication Date: 2025.01.09 BEIJING OCEANBASE TECHNOLOGY CO LTD
  • US20250013494A1 patent drawing
  • US20250013494A1 patent drawing
  • US20250013494A1 patent drawing

AI summary

A computer-implemented method for thread management includes creating a first thread, where the first thread is a kernel-level thread and the first thread has a first thread context. A second thread is created through the first thread, where the second thread is a user-level thread and the second thread inherits the first thread context. After the second thread is stored in a run queue, the first thread is controller to enter an idle loop state. The second thread is selected from the run queue through a scheduling thread. The second thread is executed.