Swapping is the process of exchanging memory pages between main memory and secondary storage, such as a hard disk. There are three types of swapping that occur. When memory becomes full, inactive processes are swapped out to disk to free up space, and are swapped back in when needed. The first UNIX systems constantly monitored free memory and swapped out processes to disk when levels fell below a threshold. Swap space is used on Linux when RAM is full, with inactive memory pages moved to the swap file to free up space. The swap cache helps avoid race conditions when processes access pages being swapped by collecting shared pages that have been copied to swap space.