A computer uses its memory to work. It needs a certain amount of space. This space helps it do its jobs fast. If it has too little space, it slows down. We want it to work well. Do you like fast computers?
A computer needs space to work. It uses memory to do jobs. This space is like a desk for tools.
Some jobs need many tools at once. The computer picks the tools it uses most. It keeps these tools in its main memory.
If the computer has too little space, it slows down. It spends too much time moving things. This makes the computer work very slowly.
To fix this, the computer moves some jobs away. This makes room for other jobs to run. It helps everything finish much sooner.
This keeps the computer running well and fast.
Computers use memory to do many jobs at once. Each job is called a process. A process needs certain bits of information to work. We call these bits pages. The working set is the group of pages a process needs right now. It is like a set of tools you use every minute.
Computers keep these pages in the main memory, or RAM. RAM is the fast part of a computer's memory. If a process has all its pages in RAM, it can work well. But if it has too few pages, it will struggle. It will spend too much time looking for pages. This can cause thrashing. Thrashing is when a computer slows down because it moves too many pages back and forth.
To stop thrashing, the computer can swap a process out. This means it moves the whole job to storage. This makes room in the RAM for other jobs. This way, all the jobs can finish much faster. The computer also looks at code and data. These are two different kinds of parts in a working set. If either part is too big for the memory, the computer may thrash again.
A computer does many jobs at once. Each job is called a process. Every process needs memory to do its work. This memory is divided into small pieces called pages. The working set is the group of pages a process uses during a specific time. Knowing the working set helps the computer manage its resources. It helps the computer decide which pages should stay in the fast main memory, also called RAM. If the computer keeps the right pages in RAM, the process can make good progress. This makes the whole computer run much more smoothly.
Working with memory is a delicate balance. If a computer keeps too many pages for one process, it leaves no room for others. This means fewer jobs can be ready to run. However, if a process has too few pages in RAM, it will have many page faults. A page fault happens when the computer must look for a page in slow storage. If too many page faults happen, the computer might start to "thrash." Thrashing is when a computer spends more time moving pages than doing actual work. To prevent this, the computer uses an all or nothing model. If a process needs more pages than the RAM can hold, the computer swaps that process out to storage. This frees up space so other processes can finish their tasks quickly.
This idea was first defined by Peter Denning in 1968. He described the working set as the collection of information a process uses during a certain time interval. His model helps the computer optimize how much work the CPU can do. By managing the working set, the computer can keep many processes running at once. This is called multiprogramming. Even if a process is temporarily removed from memory, it often finishes much sooner this way. This is better than running only one job at a time or trying to run too many at once.
Computers use a moving window to track these pages. This is called the working set window. As new pages are used, they enter one end of the window. The oldest pages drop off the other end. To save time, computers often just track the time of the last use. This helps them know which pages were used within a certain period. There are also different types of working sets. A process has a code working set for its instructions. It also has a data working set for its information. If these do not fit in the right memory levels, thrashing can happen again.
You can think of a working set like a set of tools. Imagine you are building a model. You keep the tools you use every minute on your desk. These are your working set. If your desk is too small, you must put some tools away in a box. If you try to keep every tool you own on the desk, you will have no room to work. The working set idea works for other things too. For example, copying a file needs two file handles. One is for reading and one is for writing. If a computer only has one handle, it must work much harder to finish the job.
In computer science, the working set is a vital concept for managing memory. It defines the amount of memory a process requires during a specific time interval. A process is a task or program currently running on a computer. The working set is the collection of information, usually measured in memory pages, that a process references during that time. This concept serves as an approximation of the pages a process will need in the immediate future. By keeping these specific pages in the main memory, known as RAM, a computer can ensure a process makes steady progress.
Managing these pages is a delicate balancing act for an operating system. If the system keeps too many pages for a single process in RAM, it leaves less room for other tasks. This reduces the number of processes that can be ready to run at once. However, if the system keeps too few pages in RAM, the process will experience a high page fault frequency. A page fault occurs when the computer must retrieve a required page from slower auxiliary storage. If too many processes experience this at once, the number of active processes drops toward zero. This state is known as thrashing, where the computer spends more time moving pages than performing actual work.
The working set model follows an "all or nothing" approach to prevent this inefficiency. A process is allowed to stay in RAM only if all the pages it is currently using can fit there. These pages are often identified as the most recently used ones. If a process needs more pages and there is no room in the RAM, the system will swap the entire process out to auxiliary storage. This frees up memory for other processes to use. While it might seem slow to remove a process, this strategy actually helps everything finish sooner. It allows other processes to make progress while one process waits on a hard drive or other resource. This optimizes both CPU utilization and the total throughput of the system.
Peter Denning first defined this concept in 1968. His model helps maintain a high degree of multiprogramming, which is the ability to run many processes at once. To implement this, computers use a moving window called the working set window. As a new memory reference appears at one end of the window, the oldest reference drops off the other. A page is considered part of the working set if it falls within this window. Because tracking every single reference can be difficult, computers often track the time of the last reference instead. They then consider the working set to be all pages referenced within a specific period of time.
Working sets can be further divided into specific types. There is a code working set, which contains the instructions the process needs to run. There is also a data working set, which contains the information the process is manipulating. This distinction is important when code and data are stored in different levels of the memory hierarchy. Additionally, systems using virtual memory must manage a translation lookaside buffer, or TLB. The TLB caches the memory map entries that link virtual memory to physical memory. Even if the code and data fit into the cache, the process might suffer from TLB thrashing if the working set is split across too many different pages.
The logic of the working set applies to other limited computer resources as well. For example, some tasks require multiple processes to be coscheduled to make progress. If two processes need to interact but there is only one CPU core, they can only advance at the rate of one interaction per time slice. Another example involves file handles, which are used to manage files. Copying a file is simplest when you have two handles: one for input and one for output. If only one handle is available, the system must repeatedly acquire and release the handle to move data. This makes the process much slower and more complex.
Ultimately, the working set strategy is about efficiency and stability. By preventing thrashing, the computer avoids a total slowdown of all tasks. It ensures that the CPU is always doing useful work rather than just managing memory transfers. Whether managing RAM, file handles, or network sockets, the goal remains the same. The system must provide enough resources for a task to function, but not so many that it starves the rest of the computer. This careful management allows modern computers to handle hundreds of different tasks simultaneously without crashing.
More to explore
✨ What else?
Related topics you might enjoy
🔬 Go deeper
More advanced topics to explore
🪜 Step back
Simpler topics to build understanding
What is Nepedia?
A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.