All of lore.kernel.org
 help / color / mirror / Atom feed
* use cases for mmap
@ 2014-05-16  2:14 Kun Huang
  2014-06-09 22:31 ` Kyle Nusbaum
  0 siblings, 1 reply; 2+ messages in thread
From: Kun Huang @ 2014-05-16  2:14 UTC (permalink / raw)
  To: linux-newbie

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: use cases for mmap
  2014-05-16  2:14 use cases for mmap Kun Huang
@ 2014-06-09 22:31 ` Kyle Nusbaum
  0 siblings, 0 replies; 2+ messages in thread
From: Kyle Nusbaum @ 2014-06-09 22:31 UTC (permalink / raw)
  To: Kun Huang; +Cc: linux-newbie

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-09 22:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-16  2:14 use cases for mmap Kun Huang
2014-06-09 22:31 ` Kyle Nusbaum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.