Per-Thread Trace Recording for Multi-Threaded Time Travel Debugging

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing time travel debugging methods face significant performance degradation and produce large trace files due to restrictive recording models that require sequential execution of threads and exhaustive memory state recording, making them impractical for multi-threaded programs running on modern parallel processors.

Innovation Solution

The method involves recording a separate replayable trace for each thread independently, allowing concurrent execution across multiple processing units, with a trace memory model that approximates orderable events using a monotonically increasing number, and records initial states, memory reads, and side effects of non-deterministic instructions, reducing the need for full instruction and memory state recording.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If sequential execution recording model is used to ensure accurate event ordering, then measurement precision is improved, but productivity deteriorates due to inability to record multi-threaded concurrent execution

Engineering Contradiction:
Improveevent ordering accuracyVSAvoidmulti-threaded program recording capability
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The patent divides the recording system into per-thread recording components, where each thread has its own independent recording instance that captures events locally without requiring global sequential coordination. This segmentation allows concurrent threads to be recorded simultaneously while maintaining accurate event ordering within each thread's context.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces thread identifiers and event ordering metadata as intermediary elements that associate events with their originating threads and establish local ordering. These intermediaries enable the reconstruction of accurate execution sequences during replay without requiring actual sequential execution during recording.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Loss of information

If exhaustive memory state recording is performed to ensure complete debugging information, then loss of information is reduced, but trace file size increases significantly

Engineering Contradiction:
Improvedebugging information completenessVSAvoidtrace file size
Core Design Contradiction:
Loss of informationVSQuantity of substance

Solution Approach 1:

The patent extracts and records only the essential debugging information needed for effective time-travel debugging, such as event types, thread identifiers, memory read values, and orderable event metadata. By selectively extracting only the necessary information rather than recording complete memory states, the trace file size is dramatically reduced while retaining sufficient debugging capability.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent applies partial recording by capturing specific memory reads and orderable events rather than exhaustive memory state documentation. This partial action approach records only the subset of information required to reconstruct and analyze program behavior, achieving effective debugging with minimal trace data.

Inventive Principle:
Principle #16Partial or excessive action

3Measurement precision

If full instruction execution recording is implemented to capture complete program behavior, then measurement precision is improved, but loss of time increases due to recording overhead

Engineering Contradiction:
Improveprogram behavior capture accuracyVSAvoidrecording overhead
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent segments the recording process into lightweight per-thread event capture operations that record only essential execution information (event types, thread IDs, memory reads, orderable events) rather than complete instruction states. This segmentation reduces the overhead of each recording operation while maintaining sufficient precision for debugging analysis.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent creates simplified copies of execution events that capture the essential behavior needed for debugging without replicating complete instruction execution details. These compact event representations preserve program behavior accuracy while minimizing recording overhead and performance impact.

Inventive Principle:
Principle #26Copying

Data Source

PatentEP4220410A1Program tracing for time travel debugging and analysis
Publication Date: 2023.08.02 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP4220410A1 patent drawingFigure 1
  • EP4220410A1 patent drawingFigure 2
  • EP4220410A1 patent drawingFigure 3~4

AI summary

Recording a replay-able trace of execution of a multi-threaded process includes identifying a trace memory model that defines one or more orderable events that are to be ordered across a plurality of threads of the multi-threaded process. The plurality of threads are executed concurrently across one or more processing units of one or more processors. During execution of the plurality of threads, a separate replay-able trace is recorded for each thread independently. Recording includes, for each thread, recording initial state for the thread, recording at least one memory read performed by at least one processor instruction executed by the thread that takes memory as input, and recording a least one orderable event performed by the thread with a monotonically increasing number that orders the event among other orderable events across the plurality of threads.