Thread Switching via Instruction Rewrite to Reduce Overhead

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In multi-threading environments, particularly with Light Weight Threads (LWT), the high frequency of thread switching leads to significant overhead due to the time-consuming process of interrupt-based thread switching, which burdens the overall execution time of programs.

Innovation Solution

A system that includes circuitry to measure execution time, identify instructions likely to be executed in the future by a thread occupying a core for a long time, and rewrite those instructions as scheduler calls, thereby reducing the procedural sequences and time required for thread switching.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If interrupt-based thread switching is used to switch between multiple threads, then thread switching functionality is achieved, but the thread switching time increases significantly due to the time-consuming interrupt processing sequences

Engineering Contradiction:
Improvethread switching functionalityVSAvoidthread switching time
Core Design Contradiction:
Ease of operationVSLoss of time

Solution Approach 1:

The patent applies preliminary action by proactively inserting thread switch instructions into the execution flow before the thread would naturally occupy the core for too long. Instead of waiting for an interrupt to occur, the system predicts future thread switching needs and prepares the switch instructions in advance, thereby reducing the actual switching time when the interrupt does occur.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent implements skipping by allowing the thread to execute continuously without interrupt processing for a predetermined period, effectively skipping over the interrupt handling sequences that would otherwise be executed. This rushing through of the critical section minimizes the time spent in interrupt processing and reduces overall thread switching overhead.

Inventive Principle:
Principle #21Skipping (Rushing through)

2Productivity

If frequent thread switching is implemented to improve program execution efficiency, then resource utilization improves, but the overhead from interrupt-based switching increases and burdens overall execution time

Engineering Contradiction:
Improveprogram execution efficiencyVSAvoidinterrupt processing overhead
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

By inserting thread switch instructions in advance into the thread's execution path, the system prepares for future context switches before they are actually needed. This preliminary preparation allows the scheduler to manage thread transitions more efficiently, improving resource utilization while minimizing the actual interrupt processing overhead when switches occur.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent maintains continuity of useful action by allowing the active thread to execute its instructions continuously for a predetermined period without being interrupted. This continuous execution maximizes productive work done by each thread before switching occurs, thereby improving overall program execution efficiency while reducing the frequency and impact of interrupt-based switching.

Inventive Principle:
Principle #20Continuity of useful action

Data Source

PatentUS10387190B2System and method of executing a plurality of threads using thread switching on execution time-out using instruction re-write
Publication Date: 2019.08.20 FUJITSU LTD
  • US10387190B2 patent drawing
  • US10387190B2 patent drawing
  • US10387190B2 patent drawing

AI summary

A system includes circuitry configured to execute a first thread of a plurality of threads, measure an execution time period during which the circuitry executes the first thread without executing other threads of the plurality of threads, determine whether the measured execution time period exceeds a threshold value, specify first address information of a first instruction which is included in the first thread when it is determined that the measured execution time period exceeds the threshold value, the first instruction being an instruction that is scheduled to be executed, exchange the first instruction stored in an address region specified by the first address information with a second instruction instructing the circuitry to switch from executing the first thread to executing a second thread of the plurality of threads, and switch from executing the first thread to the executing the second thread by executing the second instruction.