public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Interprocess shared memory .... but file backed?
@ 2002-03-08 15:08 Christopher Quinn
  2002-03-08 15:32 ` Alan Cox
  2002-03-08 15:51 ` Richard B. Johnson
  0 siblings, 2 replies; 6+ messages in thread
From: Christopher Quinn @ 2002-03-08 15:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: Christopher Quinn

Hello,

I know that a combination of mmap/shmem can be used to 
achieve interprocess shared memory (notably Ralf 
Engelschall's MM library).
However as far as I can tell this is anonymous memory only.
Are there any options if one initially maps a disk file via 
mmap (in particular MAP_PRIVATE) for sharing that vm, such 
that any access by a member of the sharing process group 
will fault in the relevant file data page after which writes 
to it are seen by all?

Of course clone(2) will give the necessary sharing of page 
tables but my ideal is for sharing only of specified areas 
of vm, not everything.

Anyone know of a way of doing this?

Thanks,
Chris Quinn

PS. I'm not subscribed! please ensure you CC. me!!


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

* Re: Interprocess shared memory .... but file backed?
  2002-03-08 15:32 ` Alan Cox
@ 2002-03-08 15:30   ` Christopher Quinn
  2002-03-08 19:20     ` H. Peter Anvin
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Quinn @ 2002-03-08 15:30 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Alan Cox wrote:

>>However as far as I can tell this is anonymous memory only.
>>Are there any options if one initially maps a disk file via 
>>mmap (in particular MAP_PRIVATE) for sharing that vm, such 
>>
> 
> well MAP_PRIVATE is "dont share" so not with that 8)
> Use MAP_SHARED and you'll get what you want
> 
> 

Certainly true! But MAP_SHARED gives uncontrolled flush of 
dirty data - so that's out for me. I only want 'privacy' to 
extend to the right to make changes permanent at my own 
discretion.

Chris Q.


-- 
rgrds,
Chris Quinn


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

* Re: Interprocess shared memory .... but file backed?
  2002-03-08 15:08 Christopher Quinn
@ 2002-03-08 15:32 ` Alan Cox
  2002-03-08 15:30   ` Christopher Quinn
  2002-03-08 15:51 ` Richard B. Johnson
  1 sibling, 1 reply; 6+ messages in thread
From: Alan Cox @ 2002-03-08 15:32 UTC (permalink / raw)
  To: Christopher Quinn; +Cc: linux-kernel, Christopher Quinn

> However as far as I can tell this is anonymous memory only.
> Are there any options if one initially maps a disk file via 
> mmap (in particular MAP_PRIVATE) for sharing that vm, such 

well MAP_PRIVATE is "dont share" so not with that 8)
Use MAP_SHARED and you'll get what you want

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

* Re: Interprocess shared memory .... but file backed?
  2002-03-08 15:08 Christopher Quinn
  2002-03-08 15:32 ` Alan Cox
@ 2002-03-08 15:51 ` Richard B. Johnson
  1 sibling, 0 replies; 6+ messages in thread
From: Richard B. Johnson @ 2002-03-08 15:51 UTC (permalink / raw)
  To: Christopher Quinn; +Cc: linux-kernel

On Fri, 8 Mar 2002, Christopher Quinn wrote:

> Hello,
> 
> I know that a combination of mmap/shmem can be used to 
> achieve interprocess shared memory (notably Ralf 
> Engelschall's MM library).
> However as far as I can tell this is anonymous memory only.
> Are there any options if one initially maps a disk file via 
> mmap (in particular MAP_PRIVATE) for sharing that vm, such 
> that any access by a member of the sharing process group 
> will fault in the relevant file data page after which writes 
> to it are seen by all?

Hmmm. You want MAP_SHARED, but you insist upon using MAP_PRIVATE?
MAP_SHARED makes your mmapped pages visible to all, complete
with any updates by any or all tasks accessing it.


Cheers,
Dick Johnson

Penguin : Linux version 2.4.18 on an i686 machine (799.53 BogoMips).

	Bill Gates? Who?


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

* Re: Interprocess shared memory .... but file backed?
       [not found] <Pine.LNX.4.33.0203081049360.15002-100000@coffee.psychology.mcmaster.ca>
@ 2002-03-08 16:05 ` Christopher Quinn
  0 siblings, 0 replies; 6+ messages in thread
From: Christopher Quinn @ 2002-03-08 16:05 UTC (permalink / raw)
  To: Mark Hahn; +Cc: linux-kernel

Mark Hahn wrote:

>>>well MAP_PRIVATE is "dont share" so not with that 8)
>>>Use MAP_SHARED and you'll get what you want
>>>
>>Certainly true! But MAP_SHARED gives uncontrolled flush of 
>>dirty data - so that's out for me. I only want 'privacy' to 
>>extend to the right to make changes permanent at my own 
>>discretion.
>>
> 
> right, and that's not what Unix provides.  in particular, mmap
> is a means for apps to be polite, not for them to strongarm
> the kernel.  in particular, if you mmap a file, much of the point
> is that the kernel chooses how much of the state is in ram or 
> on disk.  you can, of course, msync, or even munmap.
> 
> 
> 

Seems a bit restrictive to me. After all Unix is not an 
ossified standard! :)
Assuming clone() actually page table shares the vm covered 
by a mmap(MAP_PRIVATE) in the way I want, it isn't much to 
ask to be more *restrictive* on sharing?

So far, it's looking as if my ideal is unattainable with the 
current kernel.
Anyone disagree?


-- 
rgrds,
Chris Quinn


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

* Re: Interprocess shared memory .... but file backed?
  2002-03-08 15:30   ` Christopher Quinn
@ 2002-03-08 19:20     ` H. Peter Anvin
  0 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2002-03-08 19:20 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <3C88D930.2080308@htec.demon.co.uk>
By author:    Christopher Quinn <cq@htec.demon.co.uk>
In newsgroup: linux.dev.kernel
>
> > well MAP_PRIVATE is "dont share" so not with that 8)
> > Use MAP_SHARED and you'll get what you want
> > 
> Certainly true! But MAP_SHARED gives uncontrolled flush of 
> dirty data - so that's out for me. I only want 'privacy' to 
> extend to the right to make changes permanent at my own 
> discretion.
> 

I actually have this issue as well, in order to make LPSM sharable it
would be greatly beneficial to have something that would allow
multiple processes to see the same mmap, but for writes not to hit the
backing store file.

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

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

end of thread, other threads:[~2002-03-08 19:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.33.0203081049360.15002-100000@coffee.psychology.mcmaster.ca>
2002-03-08 16:05 ` Interprocess shared memory .... but file backed? Christopher Quinn
2002-03-08 15:08 Christopher Quinn
2002-03-08 15:32 ` Alan Cox
2002-03-08 15:30   ` Christopher Quinn
2002-03-08 19:20     ` H. Peter Anvin
2002-03-08 15:51 ` Richard B. Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox