sharing data between processes 
Author Message
 sharing data between processes

i have the following situation: a process has data that is (for now)
stored in a linked list. this data changes and rearranges. the problem
is that i want a number of processes to access this data. i thought of
shared memory but i have trouble accessing a struct allocated by the
first process from other processes. does any one have an idea of how to
'publicize' a dynmic list between processes in any way?

    thank you
        shadi



Mon, 15 Oct 2001 03:00:00 GMT  
 sharing data between processes
Shadi schrieb:

Quote:

> i have the following situation: a process has data that is (for now)
> stored in a linked list. this data changes and rearranges. the problem
> is that i want a number of processes to access this data. i thought of
> shared memory but i have trouble accessing a struct allocated by the
> first process from other processes. does any one have an idea of how to
> 'publicize' a dynmic list between processes in any way?

Hi Shadi,

You should consider that ANSI-C has no support for multiprocessing (or
multithreading) and therefore does not support interprocess communication
or data sharing mechanisms. All these things are inherently system
specific and unportable. You should inquire in a newsgroup where your
specific system is on topic. Here's a list of some popular systems that
support multiprocessing:





Generally what you can do is either use shared memory and a semaphore
mechanism (some systems support this with special instructions) or use
communication connections to send the data from one process to another
(like pipes or sockets or links).

Stephan
(initiator of the campaign against grumpiness in c.l.c)
(-: A brandnew excellent FAQ version has been released !!! :-)
(-: Get it: http://www.eskimo.com/~scs/C-faq/versions.html :-)



Mon, 15 Oct 2001 03:00:00 GMT  
 sharing data between processes

Quote:

> Shadi schrieb:

> > i have the following situation: a process has data that is (for now)
> > stored in a linked list. this data changes and rearranges. the problem
> > is that i want a number of processes to access this data. i thought of
> > shared memory but i have trouble accessing a struct allocated by the
> > first process from other processes. does any one have an idea of how to
> > 'publicize' a dynmic list between processes in any way?

> Hi Shadi,

> You should consider that ANSI-C has no support for multiprocessing (or
> multithreading) and therefore does not support interprocess communication
> or data sharing mechanisms. All these things are inherently system
> specific and unportable. You should inquire in a newsgroup where your
> specific system is on topic. Here's a list of some popular systems that
> support multiprocessing:





> Generally what you can do is either use shared memory and a semaphore
> mechanism (some systems support this with special instructions) or use
> communication connections to send the data from one process to another
> (like pipes or sockets or links).

> Stephan
> (initiator of the campaign against grumpiness in c.l.c)
> (-: A brandnew excellent FAQ version has been released !!! :-)
> (-: Get it: http://www.eskimo.com/~scs/C-faq/versions.html :-)

It occurs to me that you may want to date this message in your sig, brand
new is defined as less than how many days old?


Mon, 15 Oct 2001 03:00:00 GMT  
 sharing data between processes

Quote:
> Shadi schrieb:

> > i have the following situation: a process has data that is (for now)
> > stored in a linked list. this data changes and rearranges. the problem
> > is that i want a number of processes to access this data. i thought of
> > shared memory but i have trouble accessing a struct allocated by the
> > first process from other processes. does any one have an idea of how to
> > 'publicize' a dynmic list between processes in any way?

> Generally what you can do is either use shared memory and a semaphore
> mechanism (some systems support this with special instructions) or use
> communication connections to send the data from one process to another
> (like pipes or sockets or links).

The main issue though is how to handle the dynamic nature of the data
structure in shared memory.


Tue, 23 Oct 2001 03:00:00 GMT  
 sharing data between processes

Quote:

> > Shadi schrieb:

> > > i have the following situation: a process has data that is (for now)
> > > stored in a linked list. this data changes and rearranges. the problem
> > > is that i want a number of processes to access this data. i thought of
> > > shared memory but i have trouble accessing a struct allocated by the
> > > first process from other processes. does any one have an idea of how
to
> > > 'publicize' a dynmic list between processes in any way?

> > Generally what you can do is either use shared memory and a semaphore
> > mechanism (some systems support this with special instructions) or use
> > communication connections to send the data from one process to another
> > (like pipes or sockets or links).

> The main issue though is how to handle the dynamic nature of the data
> structure in shared memory.

You will find that each operating system has very different ways to access
shared memory.  VMS, NT, OS/2 and UNIX will all have completely different
calls to do this (though VMS and NT (and OS/2?) have a [cough] POSIX layer
if you like).  If you want a consistent metaphor, I suggest ACE.  At any
rate, this entire query, thread and response are fully and in every way _off
topic_.


Wed, 24 Oct 2001 03:00:00 GMT  
 sharing data between processes

Quote:


>> Shadi schrieb:

>> > i have the following situation: a process has data that is (for now)
>> > stored in a linked list. this data changes and rearranges. the problem
>> > is that i want a number of processes to access this data. i thought of
>> > shared memory but i have trouble accessing a struct allocated by the
>> > first process from other processes. does any one have an idea of how to
>> > 'publicize' a dynmic list between processes in any way?

>> Generally what you can do is either use shared memory and a semaphore
>> mechanism (some systems support this with special instructions) or use
>> communication connections to send the data from one process to another
>> (like pipes or sockets or links).

>The main issue though is how to handle the dynamic nature of the data
>structure in shared memory.

In that case, it may be worthwhile to look into using threads rather than
processes.  comp.programming.threads is the newsgroup. Threads
in the same process share the resources naturally.

To share data structures seamlessly between processes, both processes have to
map the shared memory to the same virtual address. In POSIX, you can do this by
adding MAP_FIXED to your mmap() call.  If the addresses are not the same, then
all the pointers contained in the data are invalid in every process that is
using the wrong address. For mmap() questions, use comp.unix.programmer. Win32
has VirtualAlloc()---see some Windoze programming newsgroup.



Wed, 24 Oct 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. sharing data between processes

2. Sharing data between processes

3. Sharing data between processes

4. Sharing data between processes

5. Multiple processes sharing data space. --- HELP

6. is static data shared between processes

7. ??? Process Shared DLL and Data ???

8. sharing variables accros processes & process starting

9. DLL with shared data/class not sharing...

10. Common areas/common data/data sharing

11. How to exchange data between ISAPI process and Application Process

12. Child Process & Parent Process Data :: Win32

 

 
Powered by phpBB® Forum Software