From owner-freebsd-hackers Mon Oct 27 17:36:56 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id RAA13971 for hackers-outgoing; Mon, 27 Oct 1997 17:36:56 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from dyson.iquest.net (dyson.iquest.net [198.70.144.127]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id RAA13963 for ; Mon, 27 Oct 1997 17:36:53 -0800 (PST) (envelope-from toor@dyson.iquest.net) Received: (from root@localhost) by dyson.iquest.net (8.8.7/8.8.5) id UAA05574; Mon, 27 Oct 1997 20:36:18 -0500 (EST) From: "John S. Dyson" Message-Id: <199710280136.UAA05574@dyson.iquest.net> Subject: Re: help with fstat? In-Reply-To: <199710271815.LAA23283@usr04.primenet.com> from Terry Lambert at "Oct 27, 97 06:15:56 pm" To: tlambert@primenet.com (Terry Lambert) Date: Mon, 27 Oct 1997 20:36:17 -0500 (EST) Cc: angio@angio.net, perlsta@cs.sunyit.edu, hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Terry Lambert said: > > > unless mmap() maps in on demand... but i think i'll be eating up all my > > > address space... > > > > Pages that you mmap are only paged in on demand. The simple act of > > mmapping a file doesn't cause it to be read in to memory. > > > > You're not going to eat up your address space with a few mmapped > > files per process. Remember, you're dealing with a 32 bit address > > space - you could map in gigabytes per process and not have to worry. > > > > Remember also that each process has its own virtual address space. > > They can't "collide" with each other in some way. Each process could > > mmap huge chunks and you'd never have to worry. > > Except if you linearly traverse the mapped file, and it's a big file. > Then it will force almost all other clean pages out of core via LRU. > > So you can thrash the paging algorithm this way. > > But you can also thrash it (albiet less quickly) using reads. > > There used to be a MAP_SEQUENTIAL flag to get it to discard buffers > after they had been accesed, instead of forcing more pages off the > LRU, but BSD doesn't support this. 8-(. > > Try madvise(2). It has a MADV_SEQUENTIAL. -- John dyson@freebsd.org jdyson@nc.com