why ubuntu LTS installs all in a single partition?
Christofer C. Bell
christofer.c.bell at gmail.com
Sun Aug 4 21:29:53 UTC 2013
On Sun, Aug 4, 2013 at 11:33 AM, Colin Law <clanlaw at googlemail.com> wrote:
> On 4 August 2013 00:14, Christofer C. Bell <christofer.c.bell at gmail.com>
> wrote:
> > [snip]
> > I'm not sure under what circumstances one would consider 2GB to be a lot
> of
> > swap. I would encourage you to look into how Linux manages memory.
> > Specifically vm.overcommit_memory and vm.overcommit_ratio. The purpose
> of
> > having 2GB of swap is to give your system some buffer virtual memory so
> real
> > processes that end up requesting more physical RAM than you have
> available,
> > yet will not use it, will still be able to start.
> >
> > For example, let's say you have 8GB of RAM in your system. Currently,
> 6GB
> > of RAM are in use (leaving 2GB free). You want to start a process that
> will
> > use no more than 1GB of physical RAM when running, but will request 3GB
> of
> > memory for itself, exceeding the availability of physical RAM by 1GB.
> > Without swap, this program will not start, and the kernel will give you
> an
> > insufficient memory error (ENOMEM). With a 2GB buffer provided by swap
> (so
> > the system's total virtual memory size is 10GB), this program will be
> able
> > to request 3GB of RAM (as 4GB are available), be started, and happily use
> > the 1GB of RAM it really needs.
>
> I am not entirely convinced by this argument. The argument explains
> how, if I had 8GB of RAM with 6GB in use, then I should allocate 2GB
> swap so that I can start a process that initially asks for 3GB, even
> though it will not in practice use it all. If, however, I typically
> only have 2GB in use then the argument falls down as there is plenty
> of room for the process to start without swap.
>
> In my experience, provided the machine has enough RAM, the most common
> case where swap starts being used is when a process runs out of
> control and starts consuming more and more memory. Then swapping
> starts and the result is that the whole machine effectively grinds to
> a halt thrashing the disc until eventually it runs out of swap also.
> All that the swap space does is make the machine effectively unusable
> for the period until it runs out of swap. It would often be better
> for it just to fail immediately it runs out of real RAM.
If you have an 8GB machine and only use 2GB of RAM routinely, your use of
the machine is very inefficient. :-) That said, your swap *is* being used
all the time for memory allocation calculations by the kernel. The swap
*itself* isn't visibly touched, but the presence of the virtual memory it
provides is used every time the malloc() system call is made by a process.
The goal in having 2GB of swap in the system is not to use it for actual
swapping (a system that is swapping doesn't have enough physical RAM).
The 2GB of swap is so you can actually use all of your physical ram
efficiently. I can understand this being unconvincing to you, it is
difficult concept to grasp. "How does having unused swap make the physical
RAM I *do* have more efficient?" But there it is.
Remember, the most efficiently used computer has 100% of the RAM consumed
with no swapping and 100% of the processor used with nothing waiting on the
run queue. Running your system with 1/3 of the RAM used and pointing to
that as the reason you don't need swap, well, that works, sure, but you've
wasted money on the RAM.
--
Chris
"If you wish to make an apple pie from scratch, you must first invent the
Universe." -- Carl Sagan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20130804/1553d350/attachment.html>
More information about the ubuntu-users
mailing list