linux-newbie.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kyle Nusbaum <kylejnusbaum@gmail.com>
To: Kun Huang <gareth@openstacker.org>
Cc: linux-newbie@vger.kernel.org
Subject: Re: use cases for mmap
Date: Mon, 09 Jun 2014 17:31:14 -0500	[thread overview]
Message-ID: <539635B2.5040800@gmail.com> (raw)
In-Reply-To: <CAMKaFC_OoDFjD-2a0GNYEPANVxXztCQL15U5u-zNFqR5Ud2J6g@mail.gmail.com>

You might take a look at the MAP_SHARED and MAP_ANONYMOUS flags in the 
mmap(2) man page.

--Kyle

On 05/15/2014 09:14 PM, Kun Huang wrote:
> Hi guys
>
> I'm reading&learning kernel codes and have a question for mmap. Many
> guys said mmap is good for sharing data between processes[0]. But how
> does mmap do that?
>
> In document, mmap is defined as:
>
> mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
>
> That addr is virtual address and different processes have different
> address space. So after put a file into memory via addr$offsett, how
> does another process read that data?
>
> Btw, are there some common use cases for mmap, in application layer?
>
> [0] http://stackoverflow.com/questions/258091/when-should-i-use-mmap-for-file-access
>
>
> Thanks :)
>
> Gareth
> --
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs

--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

      reply	other threads:[~2014-06-09 22:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16  2:14 use cases for mmap Kun Huang
2014-06-09 22:31 ` Kyle Nusbaum [this message]

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=539635B2.5040800@gmail.com \
    --to=kylejnusbaum@gmail.com \
    --cc=gareth@openstacker.org \
    --cc=linux-newbie@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;
as well as URLs for NNTP newsgroup(s).