xlock too slow to wake up

Paul Smith paul at mad-scientist.net
Fri May 18 15:05:11 UTC 2012


On Fri, 2012-05-18 at 16:01 +0200, oxy wrote:
> >Because all your normally-running programs are idle, the kernel will
> >feel free to swap out your programs and use the resulting memory for
> >these bookkeeping processes/disk caching.  "Swapping out", FYI, means
> >that the in-memory content of your programs are written to disk (that's
> >what swap space is, disk space reserved to hold memory overflow).  Then
> >when you come in in the morning and press a key to wake up your programs
> >the kernel has to swap them back in again (read them out of disk swap
> >space and into memory).  This can take a long time (relatively speaking).
> 
> I guess thats it. I have 2x 4GB swap, running many progs+virtualbox
> continuously. In the morning i wait 1-5 minutes till i get a passwd prompt.
> Today i went to tty1 and called top, no strange process there.

You are not being clear here.  By "2x 4GB swap" did you mean you have 4G
of RAM and 8G of swap?  That's far too much swap, IMO.

However, how much swap you should have is a very subjective thing.

Having twice RAM for swap is OK for true desktop systems with smaller
amounts of RAM, where there are likely a number of applications that are
idle much of the time.  Even for desktop systems, twice RAM is far too
big once you start getting a decent amount of RAM (anything much over
1G, IMO).

Also you are using your system a bit more like a server, with VMs etc.
For servers you want LESS swap, paradoxically, for better performance
(of course you have to monitor the memory usage of the server and be
willing to add RAM if necessary).

I would recommend you use no more than 1x RAM (4G, if I understand you
correctly).  Some people would recommend that you would only use 2G RAM
for swap, for any system with >=2G RAM.  Here's a good article on this:

        http://www.cyberciti.biz/tips/linux-swap-space.html

You can also modify the "swappiness" setting on your system, which might
help.

You should look at the amount of RAM you're using during the day, when
your machine is busy but responsive (use cat /proc/meminfo or top).
Don't worry about how much RAM is used; Linux will always use all the
RAM it can.  The question is do you see much swap being used?  There's
always some but unless you see tons of swap being used then you don't
NEED much swap to run your normal operations, and you should have just a
basic amount (2G or so max) to handle overflow/exceptional conditions.

And of course, if you're using an older/slower hard disk drive then swap
is even worse.  Sometimes people put a lot of money into CPU and RAM,
but skimp out on the disk drive specs.

> The question is: cannt i get it faster by default setting xlock to higher
> priority?

No.  If there are two programs that are both trying to run at the same
time, changing the priority will let one of them run faster than the
other.

Priority has nothing to do with when programs are swapped out in this
case, because the program is idle.





More information about the ubuntu-users mailing list