From owner-freebsd-hackers Thu Jul 15 15:44:46 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from sumatra.americantv.com (sumatra.americantv.com [208.139.222.227]) by hub.freebsd.org (Postfix) with ESMTP id 235F5155E8 for ; Thu, 15 Jul 1999 15:44:43 -0700 (PDT) (envelope-from jlemon@americantv.com) Received: from right.PCS (right.PCS [148.105.10.31]) by sumatra.americantv.com (8.8.5/8.8.5) with ESMTP id RAA17105 for ; Thu, 15 Jul 1999 17:44:28 -0500 (CDT) Received: from free.pcs (free.PCS [148.105.10.51]) by right.PCS (8.6.13/8.6.4) with ESMTP id RAA07054 for ; Thu, 15 Jul 1999 17:44:26 -0500 Received: (from jlemon@localhost) by free.pcs (8.8.6/8.8.5) id RAA12439; Thu, 15 Jul 1999 17:44:25 -0500 (CDT) Date: Thu, 15 Jul 1999 17:44:25 -0500 (CDT) From: Jonathan Lemon Message-Id: <199907152244.RAA12439@free.pcs> To: hackers@freebsd.org Subject: Re: Swap overcommit (was Re: Replacement for grep(1) (part 2)) X-Newsgroups: local.mail.freebsd-hackers In-Reply-To: References: Organization: Architecture and Operating System Fanatics Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article you write: >:: -s Print summary information about total swap >:: space usage and availability: >:: >:: allocated The total amount of swap space >:: (in 1024-byte blocks) >:: currently allocated for use as >:: backing store. >:: >:: reserved The total amount of swap space >:: (in 1024-bytes blocks) not >:: currently allocated, but >:: claimed by memory mappings for >:: possible future use. >:: >:: used The total amount of swap space >:: (in 1024-byte blocks) that is >:: either allocated or reserved. >:-- >:soda > > It would be really easy to test this. > > Write a program that malloc's 32MB of space and touches it, > then sleeps 10 seconds and forks, with both child and parent > sleeping afterwords. ( the parent and the forked child should > not touch the memory after the fork occurs ). > > Do a pstat -s before, after the initial touch, and after > the fork. If you do not see the reserved swap space jump > by 32MB after the fork, it isn't what you thought it was. aladdin[5:32pm]> prtconf System Configuration: Sun Microsystems i86pc Memory size: 128 Megabytes aladdin[5:41pm]> uname -a SunOS aladdin 5.6 Generic_105182-14 i86pc i386 total: 67280k bytes allocated + 28668k reserved = 95948k used, 196460k avail malloced 32MB... total: 67320k bytes allocated + 61460k reserved = 128780k used, 163592k avail touched... total: 100084k bytes allocated + 28696k reserved = 128780k used, 163732k avail forking... total: 100092k bytes allocated + 61520k reserved = 161612k used, 130864k avail touching again (parent)... touching again (child)... total: 132864k bytes allocated + 28748k reserved = 161612k used, 130760k avail exiting... exiting... total: 67248k bytes allocated + 28700k reserved = 95948k used, 196448k avail -- Jonathan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message