mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Butler <stevenb1@bigpond.net.au>
To: linux-kernel@vger.kernel.org
Subject: Memory Paging and fork copy-on-write semantics
Date: Thu, 25 Oct 2001 15:59:22 +1000	[thread overview]
Message-ID: <3BD7AA3A.8040104@bigpond.net.au> (raw)


Hi,

I have been making use of copy-on-write semantics of linux fork to 
duplicate a process around 100+ times to generate client load against a 
server.  The copy-on-write allows me to run many more processes without 
swap thrashing than I'd otherwise be able to.  The client code is in 
perl, so the process sizes are in the MBs.  Using this technique I only 
need about 2 MB per user, with around 5.5 MB shared.

What I've found is that everything works fine, so long as I don't run so 
many clients that the kernel pages out part of a process.  When this 
happens, it seems (from looking at top output) that the shared memory is 
copied when it is paged-out.  What's worse is it seems that it is copied 
for each process that is sharing it.  The net effect is that one page is 
gained, but many more pages are created in the other processes that were 
sharing the memory.  I typically see shared memory in each perl process 
drop down to less than 2 MB when this occurs, so each process now 
consumes about 6 MB of unshared memory (or so top tells me).

The upshot is the VM system thrashes really badly, because now it has to 
swap more data out to disk.  The sytem becomes unresponsive and I have 
to wait minutes for keystrokes to be recognised (think CTRL-C ;) ).  The 
good news is that when the scripts complete, the system seems completely 
normal.

My sytem is a PIII-550 intel BX chipset 7200 RPM IDE drive with 384 MB 
RAM if anyone's interested.

Is this expected and reasonable behaviour?  Is it possible for pages to 
remain shared, even when they are swapped to disk?  Does that already 
happen anyway, meaning my analysis of the situation is off base?

I am currently running a vanilla 2.4.12, but have observed the same kind 
of behaviour in all linux 2.4.x series kernel with the client test 
application.  I haven't tried it with 2.2.x or Alan Cox's latest kernel 
series.

Thanks for listening and thanks to all the kernel hackers for all their 
hard work.

Cheers,
Steve Butler


             reply	other threads:[~2001-10-25  5:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-25  5:59 Steven Butler [this message]
2001-10-25 13:10 ` Rik van Riel
2001-10-25 14:30 ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BD7AA3A.8040104@bigpond.net.au \
    --to=stevenb1@bigpond.net.au \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®