Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.apps > #586 > unrolled thread

mmap for IPC

Started byJay Braun <lyngwyst@gmail.com>
First post2013-05-01 11:27 -0700
Last post2013-05-04 09:27 +0000
Articles 5 — 4 participants

Back to article view | Back to comp.os.linux.development.apps


Contents

  mmap for IPC Jay Braun <lyngwyst@gmail.com> - 2013-05-01 11:27 -0700
    Re: mmap for IPC Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-05-01 20:08 +0100
    Re: mmap for IPC Lusotec <nomail@nomail.not> - 2013-05-01 21:12 +0100
      Re: mmap for IPC Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-05-02 14:42 +0100
    Re: mmap for IPC Jasen Betts <jasen@xnet.co.nz> - 2013-05-04 09:27 +0000

#586 — mmap for IPC

FromJay Braun <lyngwyst@gmail.com>
Date2013-05-01 11:27 -0700
Subjectmmap for IPC
Message-ID<5b2c726f-7805-401e-8c42-9407adf6ce9f@googlegroups.com>
Just want to make sure:  If I use mmap for inter-process communication, the processes that share the memory need not be forked from some parent process.  They can be invoked independently, correct?  

Thank you,
Jay

[toc] | [next] | [standalone]


#587

FromRainer Weikusat <rweikusat@mssgmbh.com>
Date2013-05-01 20:08 +0100
Message-ID<87bo8u8qm1.fsf@sapphire.mobileactivedefense.com>
In reply to#586
Jay Braun <lyngwyst@gmail.com> writes:
> Just want to make sure:  If I use mmap for inter-process
> communication, the processes that share the memory need not be
> forked from some parent process.  They can be invoked independently,
> correct?

If you're mmapping a 'publically accessible object', yes.

[toc] | [prev] | [next] | [standalone]


#588

FromLusotec <nomail@nomail.not>
Date2013-05-01 21:12 +0100
Message-ID<klrsop$k80$1@dont-email.me>
In reply to#586
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jay Braun wrote:
> Just want to make sure:  If I use mmap for inter-process communication,
> the processes that share the memory need not be forked from some parent
> process.  They can be invoked independently, correct?

Yes, if the mapping is not anonymous. If the mapping is anonymous only the 
process and its children can access the anonymous mapping (see MAP_ANONYMOUS 
in man mmap).

On a side note, you may want to use shm_open instead of mmap directly if you 
want to use shared memory for IPC between unrelated processes.

Regards.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iF4EAREIAAYFAlGBdyMACgkQGQjO2ccW76p39wD9ECaScfQ85/kN19WSTwOwFsnO
6L9Ipo+r/+NLuPGjebgA/3VyVttDfIYjVBikQ4x1oalXjMiLTva7kEXZfPy93Rrv
=0YXP
-----END PGP SIGNATURE-----

[toc] | [prev] | [next] | [standalone]


#589

FromRainer Weikusat <rweikusat@mssgmbh.com>
Date2013-05-02 14:42 +0100
Message-ID<87ppx933cb.fsf@sapphire.mobileactivedefense.com>
In reply to#588
Lusotec <nomail@nomail.not> writes:
> Jay Braun wrote:
>> Just want to make sure:  If I use mmap for inter-process communication,
>> the processes that share the memory need not be forked from some parent
>> process.  They can be invoked independently, correct?
>
> Yes, if the mapping is not anonymous. If the mapping is anonymous only the 
> process and its children can access the anonymous mapping (see MAP_ANONYMOUS 
> in man mmap).
>
> On a side note, you may want to use shm_open instead of mmap directly if you 
> want to use shared memory for IPC between unrelated processes.

Quoting shm_open(3):

	A POSIX shared memory object is in effect a handle which can
	be used by unrelated processes to mmap(2) the same region of
	shared memory.
      

[toc] | [prev] | [next] | [standalone]


#590

FromJasen Betts <jasen@xnet.co.nz>
Date2013-05-04 09:27 +0000
Message-ID<km2kaq$mkb$1@gonzo.reversiblemaps.ath.cx>
In reply to#586
On 2013-05-01, Jay Braun <lyngwyst@gmail.com> wrote:
> Just want to make sure:  If I use mmap for inter-process
> communication, the processes that share the memory need not be forked
> from some parent process.  They can be invoked independently, correct?
>

the venerable linux prgogrammer's guide has a good chapter on shared
memory with code examples http://www.tldp.org/LDP/lpg/  

-- 
⚂⚃ 100% natural

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [standalone]


Back to top | Article view | comp.os.linux.development.apps


csiph-web