Date: Sat, 10 Feb 2001 12:23:22 -0800 (PST) From: Matt Dillon <dillon@earth.backplane.com> To: Richard Hodges <rh@matriplex.com> Cc: Nik Clayton <nik@FreeBSD.ORG>, hackers@FreeBSD.ORG Subject: Re: Updating mmap(2) [nik@freebsd.org: Re: pipe] Message-ID: <200102102023.f1AKNMO27394@earth.backplane.com> References: <Pine.BSF.4.10.10102101115450.79449-100000@mail.matriplex.com>
next in thread | previous in thread | raw e-mail | index | archive | help
:> mmap - allocate memory, or map files or devices into memory
:>
:> would be better?
:
:You have my vote. That information would have saved me quite a few
:hours of angst a few years ago when I was looking for a way to share
:memory between processes. In fact, it will probably be an important
:tool for me for some time to come. In one case, using threads (instead
:of processes) with a decent amount of I/O increases load by about 20%.
:
:While you're at it :-) maybe you could add a few lines suggesting that
:with the MAP_SHARED flag, this is a useful method of sharing memory
:between processes.
:
:> In addition, mmap isn't listed in the SEE ALSO for malloc(3), nor is it
:> listed in memory(3). mmap() is listed in malloc(3), but only in an
:> error message.
:
:Sounds good to me.
:
:-Richard
:
:-------------------------------------------
: Richard Hodges | Matriplex, inc.
Not only that, but you can mmap() anonymous memory MAP_SHARED as well,
which means the memory is shared across fork(). Theoretically it is
possible to share a memory region across an exec*() as well, but I've
never been able to get that to work.
The MAP_NOSYNC section of the manual page has a very good description
of how to use mmap() for IPC, but the MAP_SHARED section could use
some more meat.
-Matt
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102102023.f1AKNMO27394>
