Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can't claim to be a kernel guru, but I always thought these were the same thing - just different names. All refer to data being moved from RAM to external (typically hard disk) until it is needed again.
Yes but that's not always how it works: some 8 bit machines have ways of disconnecting (often 16K banks of) RAM and then reconnecting other banks to the then empty space in the adressing space . . . This is PAGING and is largely deprecated these days because we have fancy new computers with larger adressing spaces than 64K.
But SWAPPING means that you take data in the RAM and write it to disk (or mag tape or flash or whatever) thereby freeing that memory for later use.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Perhaps will the following explanation make these terms clearer (or add to the confusion ...)
Virtual Memory is where all Unix/Linux userland processes live. That means for example that the byte at address 0x00012345 isn't the same one for one process and any other one. A broken program cannot corrupt but its own memory thus processes are protected from the other ones.
This virtual memory is managed by a hardware component, the MMU, in charge of mapping physical memory (RAM) to virtual memory.When there is no room to store in RAM all of the processes used virtual memory, the OS has to do something to recover free RAM.
One old solution is to displace a process memory completely toward a dedicated part of the disk. This is called swapping (out) and the disk area is called the swap space. Swapping is not used that much by modern OSes for being inefficient in most cases (but not all). It is unimplemented with Linux but is available with most other Unix and Unix like OSes.
An alternative and common solution is to identify the less active parts of processes virtual memory and store them on that same disk area. This is called demand paging. The memory is stored in usually fixed size contiguous blocks called pages. Paging is often confused with swapping due to the storage area being called swap in both cases. As Linux doesn't support swapping anyway, the term is used interchangeably with paging in this context.
Depending on the OS used and its configuration, the situation where the swap area is also full may happen while memory reservation (malloc) was previously accepted anyway. In that case, the OS pick some process and just kill it. This is the controversial OOM Killer.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.