Runtime Virtualization via Co-Routine Thread Simulation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing co-routine libraries do not fully simulate underlying C runtime library interfaces, leading to performance issues, scheduling deadlocks, and insecure access to thread local storage, thereby limiting their effectiveness in providing a complete runtime virtualization solution.

Innovation Solution

A dynamic runtime library is constructed based on a native runtime library, simulating threads as co-routines, and includes a co-routine scheduling thread to manage tasks, with mechanisms for thread local storage synchronization and lock management, ensuring transparent operation without modifying the application program.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Loss of energy

If existing co-routine libraries are used to simulate threads, then resource consumption is reduced, but performance and reliability deteriorate due to incomplete simulation of C runtime library interfaces

Engineering Contradiction:
Improveresource consumptionVSAvoidperformance and reliability
Core Design Contradiction:
Loss of energyVSReliability

Solution Approach 1:

The patent introduces a dynamic runtime library as an intermediary layer between the application program and the co-routine implementation. This library provides a complete simulation of C runtime library interfaces (pthread, malloc, etc.), acting as a mediator that translates standard thread operations into co-routine operations while maintaining full compatibility and reliability. The intermediary layer ensures that applications can use standard threading interfaces while benefiting from co-routine efficiency.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent changes the fundamental parameter of thread simulation completeness by implementing a full C runtime library interface simulation rather than partial simulation. This includes implementing pthread functions, memory allocation functions, and synchronization mechanisms, transforming the co-routine system from an incomplete prototype into a production-ready solution that maintains both efficiency and reliability.

Inventive Principle:
Principle #35Parameter changes

2Productivity

If co-routines are used to replace threads, then concurrency performance improves, but security and stability worsen due to insecure access to thread local storage

Engineering Contradiction:
Improveconcurrency performanceVSAvoidsecurity and stability
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent implements thread local storage (TLS) simulation by copying the TLS mechanism from traditional thread implementations. Each co-routine is allocated its own TLS context, and the dynamic runtime library provides functions to create, switch, and destroy TLS contexts. This copying approach ensures that each co-routine has isolated storage space, maintaining security and stability while enabling high-concurrency performance.

Inventive Principle:
Principle #26Copying

3Reliability

If a dynamic runtime library is constructed to fully simulate C runtime library interfaces, then reliability improves, but device complexity increases

Engineering Contradiction:
ImprovereliabilityVSAvoidsystem complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The dynamic runtime library is designed with universality, providing multiple functions within a single integrated system. It simultaneously implements C runtime library interface simulation, co-routine scheduling, thread local storage management, and synchronization mechanisms. This multi-functional design reduces overall system complexity compared to having separate components for each function, while maintaining high reliability through comprehensive interface simulation.

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

4Loss of energy

If thread switching is implemented using co-routine scheduling, then resource consumption reduces, but scheduling complexity increases due to context synchronization requirements

Engineering Contradiction:
Improveresource consumptionVSAvoidscheduling complexity
Core Design Contradiction:
Loss of energyVSDevice complexity

Solution Approach 1:

The co-routine scheduling system implements self-service through automatic context switching and synchronization. The scheduler automatically manages co-routine contexts, handles yield operations, and synchronizes state without requiring manual intervention. This self-service mechanism reduces resource consumption by eliminating manual context management overhead while managing scheduling complexity through automated algorithms.

Inventive Principle:
Principle #25Self-service

Data Source

PatentEP4657252A1Runtime virtualization method and apparatus, and runtime virtual machine system
Publication Date: 2025.12.03 JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
  • EP4657252A1 patent drawingFigure 1~2
  • EP4657252A1 patent drawingFigure 3
  • EP4657252A1 patent drawingFigure 4~5

AI summary

The disclosure provides a runtime virtualization method and apparatus. A specific implementation of the method comprises: constructing a dynamic runtime library based on a native runtime library of an application program, the dynamic runtime library simulating a thread implemented in the native runtime library in a co-routine manner; loading the dynamic runtime library when starting the application program, and generating a runtime virtualization environment and a co-routine scheduling thread running in the runtime virtualization environment, the co-routine scheduling thread being used to schedule a co-routine, and the runtime virtualization environment being an environment after a runtime environment generated by the native runtime library is replaced; receiving a task request of the application program in the runtime virtualization environment; and scheduling the co-routine using the co-routine scheduling thread based on the task request and the dynamic runtime library, so that the co-routine completes a task corresponding to the task request.