Thursday, July 30, 2015

Why does Linux use a swap partition when the kernel supports paging/virtual memory anyway?




As far as I understand paging and swapping, they're completely different concepts. While swapping means, that a process is either completely in physical memory or on the hard drive, with paging parts of a process can be in physical memory and other parts can be on the hard drive.



But why does linux need a swap partition then? If the physical memory is full, some processes will be outsourced to the hard drive and a new process will be mapped from virtual memory to physical memory.



I just don't get why one needs a swap partition (or swapping in general) then?



Or is this just a matter of terminology and swap partition == virtual memory?


Answer



Yes it is just a matter of terminology, in many cases a swap partition is used as virtual memory.




The reason UNIX and UNIX-like systems prefer swap partitions to page-files is that they can be contiguous which results in lower seek times compared to a page-file which may be fragmented.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...