Deferrable Code Task Execution in Idle Threads

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing asynchronous code execution methods are sub-optimal as they often require additional work like logging or housekeeping tasks to be executed before returning from a function, which can hinder performance due to inefficient use of processor resources.

Innovation Solution

A method and system for prioritizing code execution by identifying and deferring non-essential code tasks, executing them only when the thread is idle, thereby avoiding the need for context switching and reducing latency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If additional work (logging, housekeeping tasks) is executed before returning from a function, then these tasks are completed, but processor performance is hindered due to inefficient use of processor resources

Engineering Contradiction:
Improvecompletion of additional work tasksVSAvoidprocessor performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent applies preliminary action by identifying and separating deferrable code tasks from the main execution flow before the function returns. These tasks are marked for deferred execution and placed in a queue, allowing the main function to complete and return immediately while the additional work (logging, housekeeping) is executed later when the processor is idle, thus maintaining both task completion and processor performance

Inventive Principle:
Principle #10Preliminary action

2Productivity

If deferrable code tasks are executed when the thread is idle, then system overhead is reduced, but requires mechanism to identify and manage deferred tasks

Engineering Contradiction:
Improvesystem overheadVSAvoidtask identification and management mechanism
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent applies self-service by implementing a decorator pattern that automatically identifies deferrable code tasks through metadata annotations in the source code. The system self-manages the deferred task queue and execution scheduling without requiring complex external management mechanisms. The decorator intercepts function calls, identifies deferrable tasks based on annotations, and handles their deferred execution automatically

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent applies segmentation by dividing code tasks into essential and deferrable categories using metadata annotations. This segmentation allows the system to separate critical path execution from non-critical background tasks, enabling independent management and execution of each category without requiring complex overall management mechanisms

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS9552223B2Post-return asynchronous code execution
Publication Date: 2017.01.24 MAPLEBEAR INC
  • US9552223B2 patent drawing
  • US9552223B2 patent drawing
  • US9552223B2 patent drawing

AI summary

A method, system, and computer program product for the prioritization of code execution. The method includes accessing a thread in a context containing a set of code instances stored in memory; identifying sections of the set of code instances that correspond to deferrable code tasks; executing the thread in the context; determining that the thread is idle; and executing at least one of the deferrable code tasks. The deferrable code task is executed within the context and in response to determining that the thread is idle.