Multiple processes sharing data space. --- HELP 
Author Message
 Multiple processes sharing data space. --- HELP

I am really getting frustrated.  Your help is greatly appreciated.

The code I am writing, sitting on a linux box, must spawn several different
processes which all share memory.

I need to be as efficient as possible, as I am handling quite large amounts
of data, therefore, I don't believe
using a pipe would be appropriate.

From what I can see, I have two options.

Option I.  I can't get to work.
The function clone, a modified version of fork, has several different flags,
this function should as I understand it, duplicate the parent process, and
share data space.  If I use fork, I am certain that my global variables are
copies of each other, and modifying one, will not affect the other.  Clone
is sharing memory, but the problem
I am having is my parent process appears to hang, and does not continue
until the cloned process exits.
What could I be doing wrong?  Has anyone had success with this.

I believe my other option is to use the shmemat() command.

Help.



Mon, 25 Mar 2002 03:00:00 GMT  
 Multiple processes sharing data space. --- HELP


Quote:

> The code I am writing, sitting on a linux box, ...

> The function clone, a modified version of fork, ...

> I believe my other option is to use the shmemat() command.

Standard C doesn't know anything about 'clone', 'fork' or
'shmemat'. You have cross-posted to appropriate groups -
it's a shame you included comp.lang.c for no obvious reason.

Sent via Deja.com http://www.deja.com/
Before you buy.



Mon, 25 Mar 2002 03:00:00 GMT  
 Multiple processes sharing data space. --- HELP

Quote:

> The code I am writing, sitting on a linux box, must spawn several different
> processes which all share memory.

> I need to be as efficient as possible, as I am handling quite large amounts
> of data, therefore, I don't believe
> using a pipe would be appropriate.

> From what I can see, I have two options.

> Option I.  I can't get to work.
> The function clone, a modified version of fork, has several different flags,
> this function should as I understand it, duplicate the parent process, and
> share data space.  If I use fork, I am certain that my global variables are
> copies of each other, and modifying one, will not affect the other.  Clone
> is sharing memory, but the problem
> I am having is my parent process appears to hang, and does not continue
> until the cloned process exits.
> What could I be doing wrong?  Has anyone had success with this.

> I believe my other option is to use the shmemat() command.

Brent...

This is outside the scope of comp.lang.c (which tries to limit itself to
ANSI/ISO standard-compliant C) and might be better pursued at

<off-topic>

Having said that, I think you'll find that fork() creates a new (child)
process that has its own data space. Since that's what you want, you
might consider taking a look at Pthreads (if available) - it might offer
some advantage over using very large shared memory areas.

</off-topic>

Morris Dovey
West Des Moines, Iowa USA



Mon, 25 Mar 2002 03:00:00 GMT  
 Multiple processes sharing data space. --- HELP
here is a site that covers IPC under Unix:
http://www.ecst.csuchico.edu/~beej/guide/ipc/

I have used many of the techniques. If you use shared memory interface
you are limited to SHMMAX bytes in each shared segment. SHMMAX is  in
/usr/include/asm/shmparam.h  .

If you want to increase the size of SHMMAX on a later version of linux
you can write to /proc/sys/kernel/shmmax  ( iknow it sounds odd but open
it with vi and give it a try).

FYI here is anoterh place I often start ( The Linux programmer's
BouncePoint):
http://www.ee.mu.oz.au/linux/programming/

Cheers,
Eric

Quote:

> I am really getting frustrated.  Your help is greatly appreciated.

> The code I am writing, sitting on a linux box, must spawn several different
> processes which all share memory.

> I need to be as efficient as possible, as I am handling quite large amounts
> of data, therefore, I don't believe
> using a pipe would be appropriate.

> From what I can see, I have two options.

> Option I.  I can't get to work.
> The function clone, a modified version of fork, has several different flags,
> this function should as I understand it, duplicate the parent process, and
> share data space.  If I use fork, I am certain that my global variables are
> copies of each other, and modifying one, will not affect the other.  Clone
> is sharing memory, but the problem
> I am having is my parent process appears to hang, and does not continue
> until the cloned process exits.
> What could I be doing wrong?  Has anyone had success with this.

> I believe my other option is to use the shmemat() command.

--
Eric Hegstrom                          .~.
Senior Software Engineer               /V\  
Sonoran Scanners, Inc.                // \\          L I N U X

520-617-0072 x402                     ^^-^^


Mon, 25 Mar 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. sharing process space

2. How to share COM OBJECT between multiple PROCESS?

3. How to share object between multiple process?

4. Sharing a C++ Object between multiple processes within a Dll

5. How to move data between windows in different process spaces

6. sharing data between processes

7. sharing data between processes

8. Sharing data between processes

9. Sharing data between processes

10. Can multiple CComboBox controls share data?

11. is static data shared between processes

12. Sharing data between processes

 

 
Powered by phpBB® Forum Software