Paging is a function of memory management where a computer will store and retrieve data from a device’s secondary storage to the primary storage. Memory management is a crucial aspect of any computing device, and paging specifically is important to the implementation of virtual memory.
There are two different types of computer memory; primary and secondary. Primary storage data is temporary and is frequently accessed by applications or other hardware systems. It is typically stored in random access memory (RAM) for fast retrieval. Secondary storage is where data in a computer is kept for longer periods of time. Secondary storage is typically slower than primary. A typical example of secondary memory could be a solid-state drive (SDD), for example.
Virtual memory, what paging is used for often, is a memory management technique where secondary memory can be used as if it were a part of the main memory. Paging acts as an important part of virtual memory, as it allows programs in secondary storage to exceed the available size of the physical storage.
How paging works
Paging works by writing data to, and reading it from, secondary storage for use in primary storage. Paging is a basic function in memory management for a computer's operating system (OS) as well -- this includes Windows, Unix, Linux and macOSs.
In a memory management system that takes advantage of paging, the OS reads data from secondary storage in blocks called pages, all of which have identical size. The physical region of memory containing a single page is called a frame. When paging is used, a frame does not have to comprise a single physically contiguous region in secondary storage. This approach offers an advantage over earlier memory management methods, because it facilitates more efficient and faster use of storage.