Tech Support > Operating Systems > Linux / Variants > Are swapped out processes really swapped out?
Are swapped out processes really swapped out?
Posted by Mark on February 29th, 2004


When I run ps, it shows apache httpd processes in square brackets.
According to the man page that means they're swapped out to disk. But
what's wierd is I see this immediatelly on launching apache, and even
when I induce heavy load on the server. I can't believe these processes
are all swapped out to disk permanently. Any ideas? I'd like to force
them to stay in RAM if possible to reduce latency when a user hits the
site after long periods of inactivity.

Thanks for any help,

Mark.
Here's the output from ps axu | grep "httpd\|mysql":

607 ? S 0:00 /bin/sh /usr/bin/mysqld_safe
--datadir=/var/lib/mysql
635 ? S 0:00 [mysqld]
637 ? S 0:02 [mysqld]
638 ? S 0:00 [mysqld]
639 ? S 0:00 [mysqld]
640 ? S 0:00 [mysqld]
641 ? S 0:00 [mysqld]
642 ? S 0:00 [mysqld]
643 ? S 0:05 [mysqld]
644 ? S 0:00 [mysqld]
645 ? S 0:02 [mysqld]
18769 pts/1 S 0:00 mysql -u root -pxxxxxx
29085 ? S 0:01 [mysqld]
29307 ? S 0:01 /usr/local/apache/bin/httpd
29309 ? S 0:00 [httpd]
29310 ? S 0:00 [httpd]
29311 ? S 0:00 [httpd]
29312 ? S 0:00 [httpd]
29313 ? S 0:00 [mysqld]
29314 ? S 0:00 [httpd]
29315 ? S 0:00 [httpd]
29316 ? S 0:00 [httpd]
29317 ? S 0:00 [httpd]
29318 ? S 0:00 [httpd]
29319 ? S 0:00 [mysqld]
29320 ? S 0:00 [mysqld]
29321 ? S 0:00 [mysqld]
29322 ? S 0:00 [mysqld]
29323 ? S 0:00 [mysqld]
29324 ? S 0:00 [httpd]
29327 ? S 0:00 [mysqld]
29328 ? S 0:00 [mysqld]
29329 ? S 0:00 [mysqld]
29330 ? S 0:00 [mysqld]
29333 pts/3 S 0:00 grep httpd\|mysql

Posted by Molchun on February 29th, 2004


Mark wrote:

Linux doesn't do "swapping" it does paging which is a different thing.
AFAIK, if Linux runs out of memory, this is it, it just halts to a crawl.
It doesn't swap entire process to disk.

No, they aren't. What are these? I'd love to know too!
I'd think these are kernel threads. As you can see all the processes in your
output (the ones in brakets) marked with "S" and not"SW".

Demand paging is a normal way of operating for Linux vm. I don't think you
can alter it, but you can check the /proc/sys/vm/swappiness and other bits
in vm directory for all the information and memory status. I doubt you can
change it by writing to it. But still have a play with it on a spare
machine.

You can definitely prevent certain memory pages from being swapped to disk
by locking them, only root can do it though. mlock() will do it for you
with pleasure .

Sticky bit was used to prevent a process from being swapped to disk but
since it doesn't happen in Linux the sticky bit is ignored and it has
different meaning for directories now a days.

--
Jabber: molchun@jabber.org
PGP ID: 0x304563A8


Similar Posts