Virtual memory is a concept whereby operating system can provide more RAM to a process than a physical RAM which is actually available. In a way it does is actually a disk space to allow a computers main memory i.e. Random Access Memory or RAM to appear to be bigger than it is.
What actually happens is that the operating system of the computer moves data around between disk and between physical RAM in order to implement this virtual memory area.
The act of moving pages of data between RAM and Disk is called Swapping in Linux and historically we always use the outermost edge of the disk for this purpose.
Let's see How to maximize the performance? If you look at a chemical hard disk you have a rotating stack of platters and it is rotating at a constant angular velocity otherwise it has a constant speed of rotation. Actually, if you are standing in a middle of spinning wheel then you wouldn't be moving as fast and at absolute speed as somebody standing on the outer edge.
Same is true for data access. The data can be accessed more quickly at the outer edge of the hard disk than they can at the inner edge. Therefore more frequently accessed files such as virtual memory swap files will be placed at the outer edge of the disk. So we always put the swap partitions at the end of the partition table or at the outer edge of the disk. That way a dedicated partition we knew would be at the outer edge of the disk and could be used to store the swap memory pages. There was an alternative option and is still an alternative option which is called swap file but on older equipments that has lower performance because we could not guarantee the swap file would be at the outer edge of the disk and we also had an overhead of dealing with the file systems as the swap files was living inside.
On modern drives, this is less of a concern for a couple of reasons. First of all new hard drives are a bit of faster than old ones used to be and they are still much slower than the CPU. In fact, the relative gap between the CPU speed and mechanical hard drive speed at least has got larger in last 5 to 10 years that means real-time swapping is actually painfully slow and really slows the computer down and it doesn't really matter where it is at the outer edge of the disk or at the inner edge of the disk.
So a solid state drive provides a potential solution to this problem because they are faster but they suffer from wear problems. So if you read and write to and from solid-state drive too frequently you can actually wear out the flash memory more quickly.
A Linux desktop system for typical consumer workloads generally will not use or touch the swap space as long as 1 - 2 GB RAM is available under the normal type of consumer workload consider like internet surfing or email checking etc. When we are performing Linux installation for users and we are giving each of them at least 1 GB RAM, we normally don't really need swap.
If we have an automatic installer tool, automatically partitions a disk and gives us swap, then it's ok, as it is not going to hurt anything but we don't actually need to provide swap if the Virtual Memory has at least a 1GB of RAM.
Note: - It is important to note that if your physical RAM is around 1 to 2GB, and if your application requires 1.5 GB RAM then it would be always better to have a swap partition.
Swap partitions are themselves actually fairly obsolete because the relative performance difference from swap location on a modern mechanical HDD just not sufficient.
The fastest part of the Hard Drive is still so much slower than the CPU or the main memory that swap is slow and it does not matter which edge of the drive you are on. If you need swap for any reason, if you have some sort of thing for which you require a swap, you can add a swap file later to provide swap space and it isn't going to affect your performance that much.
If the system has 128MB or 256MB of RAM then a swap partition might be necessary at the time of Linux installation. Also, the systems that use swap files for either idle process management on these systems a swap file or swap logical volume is sufficient, no need of dedicated swap partition.
There are some exceptions to it. Let's see them: - Only a memory constrained systems which one under 512MB swap might still be needed. The swap partition is however only needed in a swap file if there isn't enough physical RAM available to install the system. If you can't get the system installed with the physical RAM available then you are going to need a swap partition.
Web hosting companies mostly use such technics on large scale. Hostdens and Hostripples which are the most affordable web hosting providers also use Virtual Memory technics to keep their RAMs strong n provide low price best Web Hosting services to their clients.
also checkout:
what is server? what are the types of servers?
What is Shared Hosting and how can one do Business into it.
Comparison of Godaddy and Hostripples in technical Aspects.
What is Cheap Web Hosting Company in Asia?
Top 10 Website Hosting Companies in 2019
Wordpress Vs Drupal Know which one is Better and Why?
also checkout:
what is server? what are the types of servers?
What is Shared Hosting and how can one do Business into it.
Comparison of Godaddy and Hostripples in technical Aspects.
What is Cheap Web Hosting Company in Asia?
Top 10 Website Hosting Companies in 2019
What Relational Database Management System is all About? What is RDBMS?
Comments
Post a Comment