| Author |
Shared memory between process
|
|
|
| Hello,
Exists any way of creating a shared memory (or any other similary
functionality) that can be accessed by more than one process? if yes
what are the required functions in c/c++. I only required that one
process writes and all the others read the information writed by the
first one.
Nuno
| |
| Ian Collins 2007-04-10, 10:03 pm |
| Nuno wrote:
> Hello,
>
> Exists any way of creating a shared memory (or any other similary
> functionality) that can be accessed by more than one process? if yes
> what are the required functions in c/c++. I only required that one
> process writes and all the others read the information writed by the
> first one.
>
Use shared memory, see shmget and friends.
--
Ian Collins.
| |
| Bill Pursell 2007-04-11, 4:06 am |
| On Apr 11, 2:01 am, "Nuno" <nuno.escul...@gmail.com> wrote:
> Exists any way of creating a shared memory (or any other similary
> functionality) that can be accessed by more than one process? if yes
> what are the required functions in c/c++. I only required that one
> process writes and all the others read the information writed by the
> first one.
man shm_open
| |
| Barry Margolin 2007-04-11, 4:06 am |
| In article <1176253289.256687.213950@y5g2000hsa.googlegroups.com>,
"Nuno" <nuno.esculcas@gmail.com> wrote:
> Hello,
>
> Exists any way of creating a shared memory (or any other similary
> functionality) that can be accessed by more than one process?
Of course. If it couldn't be accessed by more than one process, it
wouldn't make sense to call it "shared memory", would it?
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
| |
| Gianni Mariani 2007-04-11, 8:04 am |
| Nuno wrote:
> Hello,
>
> Exists any way of creating a shared memory (or any other similary
> functionality) that can be accessed by more than one process? if yes
> what are the required functions in c/c++. I only required that one
> process writes and all the others read the information writed by the
> first one.
man mmap
I find this is better than shmget.
| |
|
| Thanks for the replys, help a lot.
For someone that are trying to do the same and need an example here is
a good simple example on how to do it:
http://www.codemaestro.com/reviews/review00000107.html
Nuno
Gianni Mariani escreveu:
> Nuno wrote:
>
> man mmap
>
> I find this is better than shmget.
| |
| Alex Colvin 2007-04-11, 10:03 pm |
| >> Exists any way of creating a shared memory (or any other similary
>Use shared memory, see shmget and friends.
no, see mmap with MAP_SHARED and friends. Also flock and friends.
--
mac the naïf
| |
| Ian Collins 2007-04-12, 4:05 am |
| Alex Colvin wrote:
>
>
> no, see mmap with MAP_SHARED and friends. Also flock and friends.
>
Why the no?
--
Ian Collins.
| |
| Gianni Mariani 2007-04-12, 4:05 am |
| Ian Collins wrote:
> Alex Colvin wrote:
>
>
> Why the no?
>
because shmget sucks ? maybe ?
| |
| Ian Collins 2007-04-12, 4:05 am |
| Gianni Mariani wrote:
> Ian Collins wrote:
>
>
> because shmget sucks ? maybe ?
>
I the interface is on the clunky side and the potential for stale pages
is real, but I always used to to use it. These days I prefer doors, but
I guess they aren't portable.
--
Ian Collins.
| |
| Gianni Mariani 2007-04-12, 8:05 am |
| Ian Collins wrote:
....
> I the interface is on the clunky side and the potential for stale pages
> is real, but I always used to to use it. These days I prefer doors, but
> I guess they aren't portable.
>
woz doors ?
| |
|
|
| Alex Colvin 2007-04-12, 10:03 pm |
| >>>Use shared memory, see shmget and friends.
[color=darkred]
because mmap and flock use the file system to name shared objects and
control access.
shmget and friends live in their own world, with their own names.
shmget is from the days before virtual memory and mmap.
you can do more with mmap.
--
mac the naïf
|
|
|
|