Replacing one segment of a program in memory (RAM) with another part of the program and restoring it back to the original if required. Exchanging program segments is the primary function of virtual memory, which is a feature in almost every operating system. See
paging and
virtual memory.