I have read this question, but it was asked in the context of servers not desktops or notebooks.
If a good amount of RAM is installed on a notebook, say 8 GB, do we still need a swap space?
|
I have read this question, but it was asked in the context of servers not desktops or notebooks. If a good amount of RAM is installed on a notebook, say 8 GB, do we still need a swap space? |
||||
|
|
|
There is a common misconception that having a swap space is negatively affecting system performance. This is incorrect. As long as you have enough RAM, having a swap area whatever its size doesn't hurt performance at all. What affects performance is being short in RAM and effectively using the swap space.
I always prefer case 2. as I feel uncomfortable loosing parts or all of my work because the kernel thinks my applications are worth killing. Moreover, with the current size of an average disk being in the TB range, reserving a few percent for swap is usually not an issue. |
|||||||||||||||||||||
|
|
If you have a RAM of 3GB or higher, Ubuntu will automatically NOT USE the Swap space since it's more than enough for the OS. Now do you really need a swap partition? The answer in my opinion is yes. Because you don't know what will you be installing or doing in the future that might require the need of swap space. Also if you're planning to use hibernation, you might want to have some swap space. You actually don't have to have swap partition, but it is recommended in case you do use up that much memory in normal operation. For more information on the need or not fro swap, see Ubuntu Swap Faq, or Swap Requirements |
|||||||||||||||||||||
|
|
For the last 6 years or so I have used desktop systems with at least 8GB RAM. I don't remember a case when the system swapped out memory under normal usage - and I monitor resource usage quite often with htop. Not even in cases when I ran 4 virtual machines (servers) simultaneously for development purposes did swapping occur. Having said that, if the applications you are running are memory intensive (eg video editing, image editing, large database table manipulation, etc) you may face a situation where your system might run out of memory. In that case it may be desirable to have a swap space. Think of it as a last resort safety net. And considering the multi-terrabyte capacity of today's systems, what's a couple of gigabytes in a swap partition worth? Better be safe than sorry :-) |
|||
|
|
|
Having swap space is always a good thing. Here I'm quoting Michael Jang's RHCSA/RHCE Certification Study Guide
|
|||||
|
|
It depends on what you are running on your system. If you are creating content, it is probably a good idea to still have swap space allocated, so if you do run out of RAM, your processes just get slow instead of being killed and potentially losing work. If your machine is just running programs, then you don't need or even want swap space. I design and build many kiosk-like display systems that fit this usage exactly. I'd rather a process die suddenly than be slow, because then I can detect that condition and correct it. |
|||
|
|
|
If you ever need swap or more swap space you can create swap files on your file system. Of course, they will not support hibernation but it is a reasonable approach for a laptop with SSD drive and a lot of RAM. |
||||
|
|