A working set is the collection of memory pages or cache lines that a process actively references during a defined time interval. This concept is fundamental to virtual memory management and cache optimization, as it represents the minimal data required for the process to make efficient progress without excessive page faults or cache misses. The size and composition of the working set directly influence system performance by determining the pressure on the memory hierarchy.
Glossary
Working Set

What is a Working Set?
A core concept in computer architecture and operating systems for optimizing memory and cache performance.
In the context of NPU acceleration, managing the working set is critical for maximizing data reuse in on-chip scratchpad memory or caches. A compiler or runtime that effectively minimizes or fits the working set into fast local memory reduces costly accesses to High Bandwidth Memory (HBM) or main memory, directly improving throughput and energy efficiency. This optimization requires analyzing the program's memory access patterns and data locality.
Key Characteristics of a Working Set
The working set is a dynamic subset of a program's total memory footprint that is actively referenced within a specific time window. Its properties are fundamental to the design of efficient virtual memory, caching, and accelerator memory subsystems.
Temporal Locality
The working set is defined by the principle of temporal locality, which states that memory locations accessed recently are likely to be accessed again soon. This is the foundational assumption that makes caching and paging effective. A program's working set at time t is formally the set of pages (or cache lines) referenced in the time interval (t - Δ, t), where Δ is the working set window. The size and composition of this set change as the program's execution phase changes.
Dynamic and Phase-Based
A working set is not static; it evolves with program execution. It typically exhibits phase behavior, where periods of stable memory access patterns (a steady working set) are punctuated by phase transitions where the set changes rapidly. For example:
- An initialization phase loads a large dataset into memory.
- A computation phase repeatedly accesses a core subset of that data.
- A cleanup phase accesses new memory for writing results. Effective memory management, especially on NPUs with limited on-chip memory, requires algorithms to detect these phases and adapt data placement accordingly.
Critical Determinant of Performance
The relationship between the working set size (WSS) and the cache size or fast memory capacity is the primary determinant of cache/memory performance. This leads to three fundamental regimes:
- Ideal (WSS < Cache): The entire working set fits in fast memory, yielding hit rates near 100% and optimal performance.
- Thrashing (WSS >> Cache): The working set vastly exceeds cache capacity, causing constant eviction of needed data and catastrophic performance drops.
- Knee of the Curve (WSS ≈ Cache): Performance is highly sensitive to small changes in WSS or cache size; this is the critical design point for systems engineers optimizing NPU memory hierarchies.
Basis for Page Replacement
In virtual memory systems, the working set model directly informs page replacement policies. The Working Set Model for process scheduling, formalized by Peter Denning, states a process should only be allowed to run if its working set is resident in physical memory to prevent thrashing. Practical algorithms like the WSClock approximate the working set to decide which pages to keep in RAM and which to page out to disk. For NPU scratchpad memory, similar explicit management is performed by the compiler, which must analyze the program's expected working set to allocate data structures.
Measured via Profiling
The working set is not directly programmable but is observed through hardware performance counters and memory trace analysis. Key metrics include:
- Last-Level Cache (LLC) Misses: A sharp increase indicates the working set exceeds LLC size.
- Page Fault Rate: In virtual memory, a high rate indicates the working set exceeds allocated physical frames.
- Access Pattern Stride: Analyzed to distinguish between sequential, random, or strided working sets, which impacts prefetching effectiveness. Tools like
perf(Linux) or VTune profile these events to guide optimization, such as adjusting data layout or tile sizes for NPU kernels.
Optimization Target for Accelerators
On NPUs and GPUs, managing the working set is a core compiler and programmer responsibility due to explicit memory hierarchies (e.g., global, shared, local memory). Key optimization techniques include:
- Tiling/Loop Blocking: Restructuring computations to break large data sets into tiles that fit the accelerator's fast scratchpad memory or cache, ensuring the tile becomes the kernel's working set.
- Data Layout Transformation: Rearranging data structures (e.g., Array of Structs to Struct of Arrays) to improve spatial locality and create a more compact, cache-friendly working set.
- Kernel Fusion: Combining operations to keep intermediate data in registers or shared memory, preventing it from spilling to slower memory and bloating the working set.
Frequently Asked Questions
Essential questions about the working set, a core concept in memory hierarchy management that defines the active data footprint of a process, directly impacting cache performance, virtual memory efficiency, and overall system throughput.
A working set is the collection of memory pages or cache lines that a process actively references during a defined time window, representing its current locality of reference. This concept, formalized by Peter Denning in the 1960s, is fundamental to virtual memory and cache management policies. The principle states that to run efficiently, a process's working set must be resident in fast memory (like RAM or cache). If the working set exceeds the available fast memory capacity, the system experiences thrashing—a severe performance penalty from continuously swapping data between memory levels. For Neural Processing Units (NPUs), managing the working set of a model's weights, activations, and intermediate tensors is critical for keeping data in on-chip scratchpad memory or caches to avoid stalls from high-latency off-chip DRAM accesses.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
The working set is a core concept for optimizing data movement. These related terms define the mechanisms and principles that govern how data is accessed, moved, and synchronized across a system's memory hierarchy.
Spatial Locality
A principle of program behavior where if a particular memory location is accessed, nearby memory locations are also likely to be accessed in the near future. This principle directly influences the design of cache lines and prefetching algorithms, as it is efficient to move contiguous blocks of data. Optimizing for spatial locality is key to maximizing the utility of data transferred into a cache or scratchpad, thereby improving the effective bandwidth of the memory system.
Temporal Locality
A principle of program behavior where if a particular memory location is accessed, it is likely to be accessed again in the near future. This is the foundational concept that justifies the existence of caches. A program's working set is essentially the manifestation of its temporal locality over a given time window. High temporal locality means data can be retained in fast memory (like an L1 cache or NPU SRAM), minimizing costly accesses to slower, higher-level memory.
Cache Miss
An event that occurs when a processor requests data and that data is not present in the current level of cache. This forces a access to a slower, lower level of the memory hierarchy (e.g., L2 cache, HBM, or DRAM). Cache misses are a primary source of performance degradation. The frequency of cache misses is inversely related to how well a program's working set fits within the available cache capacity and aligns with locality principles.
Prefetching
A hardware or software technique that predicts future memory accesses and proactively loads data into a cache or buffer before it is explicitly requested by the processor. The goal is to hide memory latency by having data ready when needed. Effective prefetching relies on recognizing predictable memory access patterns (often stemming from spatial locality) and is critical for keeping computational units fed with data, especially when dealing with large working sets.
Scratchpad Memory
A small, high-speed, software-managed on-chip memory (SRAM) used in accelerators like NPUs and GPUs. Unlike a hardware-managed cache, the programmer or compiler must explicitly move data into and out of the scratchpad. Managing the scratchpad effectively requires a precise understanding of the kernel's working set—knowing exactly what data blocks are needed for a computation phase and scheduling their movement to minimize stalls.
Memory Access Pattern
Describes the sequence and stride with which a program reads from or writes to memory locations. Patterns can be:
- Sequential/Strided: Regular, predictable strides (optimal).
- Random: Irregular, hard-to-predict addresses (suboptimal). The pattern heavily influences cache performance, prefetcher effectiveness, and bandwidth utilization. Optimizing kernels to have coalesced and regular access patterns is essential for efficient working set management on parallel architectures.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us