Dynamic Function Placement via Call Graph Clustering
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Computing systems experience latency issues due to the slow process of retrieving functions from storage, leading to sluggish performance, especially in large distributed applications like social networking sites, as existing code organization methods do not account for dynamic factors such as user input and network latency.
Innovation Solution
A method is introduced to determine function placement within executable code based on a log of previous function calls, building a call graph, defining node clusters, and generating an ordered list of functions to optimize their placement, thereby reducing page faults and improving execution efficiency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Speed
If functions are retrieved from storage when not in active memory, then the system can execute stored functions, but the retrieval process is comparatively slow and causes latency
Solution Approach 1:
The system performs preliminary actions by pre-loading functions into active memory based on static analysis of call graphs and dynamic feedback from runtime call patterns. The linker analyzes the call graph during compilation to identify frequently called functions and pre-loads them into active memory before they are actually needed, avoiding slow retrieval from storage when functions are executed.
Solution Approach 2:
The system transitions from static code placement to dynamic code placement by using runtime call graph feedback. The linker initially performs static analysis to create a call graph, executes the program, monitors actual function call patterns, updates the call graph with dynamic information, and uses this updated data to optimize function placement in subsequent executions. This dynamic adaptation allows the system to respond to changing runtime conditions and improve retrieval efficiency over time.
2Productivity
If more functions are loaded into active memory to reduce page faults, then execution efficiency improves, but memory usage increases
Solution Approach 1:
The system applies local quality by differentiating function placement strategies based on their characteristics and call patterns. Instead of uniformly loading all functions or using a single placement strategy, the linker analyzes individual functions and their call frequencies from the call graph, placing frequently called functions in active memory while less frequently called functions remain in storage. This selective, localized approach optimizes memory usage by loading only the necessary functions into active memory.
Solution Approach 2:
The system changes the parameter of function placement from static to dynamic based on call graph analysis. The linker uses static analysis to initially determine function placement, then modifies this placement dynamically by incorporating runtime call pattern data. Functions are repositioned in memory based on their actual call frequencies and patterns observed during execution, allowing the system to adapt memory allocation to actual usage patterns and improve execution efficiency without excessive memory consumption.
3Ease of manufacture
If static code placement methods are used, then the linking process is simpler, but the system cannot account for dynamic factors such as user input and network latency
Solution Approach 1:
The system performs preliminary static analysis to build an initial call graph during the linking process, identifying potential function call patterns before runtime. This preliminary structure provides a foundation for optimization while maintaining relative simplicity in the initial linking phase. The static analysis phase prepares the call graph with expected call relationships, which then guides dynamic adjustments during runtime without requiring complete redesign of the linking process.
Solution Approach 2:
The system transitions from purely static code placement to a dynamic approach by incorporating runtime call graph feedback. The linker performs static analysis to create an initial call graph, executes the program to gather actual call pattern data, updates the call graph with dynamic information, and uses this updated data to optimize function placement in subsequent executions. This two-phase approach maintains the simplicity of static analysis while adding dynamic adaptability to respond to user input, network latency, and other runtime conditions.
Data Source
AI summary
When a program function is called, if the instructions for that function are not in active memory, a page fault occurs. Resolving a page fault includes a costly process of loading a page of object code instructions, into active memory, including the instructions for the called function. Technology is disclosed to reduce page faults by placing interrelated functions near each other within executable code based on a log of previous function calls. A log of function calls may be from observing the execution of applications over time. Computing devices can compute where to place functions within executable code by: obtaining the function call log; building a call graph based on the function call log; defining multiple node clusters within the call graph; and generating an ordered list of functions by sorting the node clusters. The ordered list of functions can then be provided during linking to determine function placements.


