From owner-freebsd-hackers Wed Oct 10 11: 4:12 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from earth.backplane.com (earth-nat-cw.backplane.com [208.161.114.67]) by hub.freebsd.org (Postfix) with ESMTP id 3DFCA37B401 for ; Wed, 10 Oct 2001 11:04:08 -0700 (PDT) Received: (from dillon@localhost) by earth.backplane.com (8.11.6/8.11.2) id f9AI3w320703; Wed, 10 Oct 2001 11:03:58 -0700 (PDT) (envelope-from dillon) Date: Wed, 10 Oct 2001 11:03:58 -0700 (PDT) From: Matt Dillon Message-Id: <200110101803.f9AI3w320703@earth.backplane.com> To: "Andrew L. Neporada" Cc: Maxime Henrion , Dwayne , freebsd-hackers@FreeBSD.ORG Subject: Re: Memory allocation question References: Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG : :On Tue, 2 Oct 2001, Matt Dillon wrote: : :> :> : :> :Dwayne wrote: :> :> I'm creating an app where I want to use memory to store data so I :> :> can get at it quickly. The problem is, I can't afford the delays that :> :> would occur if the memory gets swapped out. Is there any way in FreeBSD :> :> to allocate memory so that the VM system won't swap it out? :> :> :> :I think mlock(2) is what you want. :> : :> :Maxime Henrion :> :-- :> :Don't be fooled by cheap finnish imitations ; BSD is the One True Code :> :> Don't use mlock(). : :Could you please explain that. Thanks. mlock() can only be used by root, and it isn't really all that portable an interface. It cannot guarentee that the memory will actually be locked into core. :> :> Use SysV Shared memory segments. If you tell the kernel to use :> physical ram for SysV shared memory (kern.ipc.shm_use_phys=1) :> then any shm segments you allocate (see manual pages for :> shmctl, shmget, and shmat) will reside in unswappable shared memory. :> :> -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message