Re: Linked List in Shared Memory

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Although it requires a bit more work, it is still possible to implement a linked list and insert and delete items using an array.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com


"C Programmer , MFC" <sathishsster@xxxxxxxxx> wrote in message news:5c3cafb2-1a21-4e80-9b5a-4846d65ab058@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Oct 5, 5:34 pm, Goran <goran.pu...@xxxxxxxxx> wrote:
On Oct 5, 1:31 pm, "C Programmer , MFC" <sathishss...@xxxxxxxxx>
wrote:

> Hi,
> I am Satheesh asking a question
> how can i implement a LinkedList (singly/doubly) in a Shared Memory in
> C++.
> Bcse In interprocess communication 2/more process can share the add/
> delete/update the values in the object in the Linkedlist via
> pointer's.how can i achieve this.

> Plz Give me an example.
> Regards
> Satheesh.S

Simple data structure that will do that is index-based (not pointer-
based) linked list, e.g:

template <typename YOUR_DATA>
struct Example
{
Example() :Prev(end), next(end) {}
YOUR_DATA Data;
enum { end = -1 };
int Prev;
int Next;};

Example example[ITEM_COUNT];

(I am too lazy to write operations down, but you can probably find
that on the internet. In fact, I'd be surprised that there isn't even
a C++ implementation of the above somewhere already.)

Why do you need indexes? Because pointers are specific to your
process's address space, and are different from one process to
another, hence their inapplicability in an IPC scenario.

That said... Unless this is not for a homework, I would strongly
suggest COM for any inter-process communication under Windows. COM may
seem to be from another world, but (bar learning curve), for anything
"real", it's leaps and bounds better than lower level system
primitives (shared memory, pipes, mailslots etc).

Goran.

Hi Goran ,
Thank you very much for your reply.
And i am using winxp os, unfortunately i forget this to say.
in my research i got some idea is that ,it is not satisfied with
indexes bcse we need to delete the node add new node etc etc , in the
case of array using in shared memory is is not proper well i am
finding to get a new technique to do some hot work as to implement the
same linkedlist to avail the pointer's through shared memory , i am
not sure to get this but trying...
regards
Sathish.S

.



Relevant Pages

  • Re: Reading code of a function?
    ... In the shared memory, there would be an array of function names, and the ... ADT could refer to an index in that array. ... and the function lookup is a direct array lookup rather than a ...
    (comp.unix.programmer)
  • Re: IPC:Shareable
    ... shared memory. ... that array as reference as value of the hash. ... It's best not to 'use' modules inside a sub (except for lowercase ... You cannot assign a ref to an IPC::Shareable tied hash. ...
    (comp.lang.perl.misc)
  • Re: Multiprocessing, shared memory vs. pickled copies
    ... I've added a few lines to this code which allows subclassing the ... more than just the array, ... difference between named and anonymous shared memory (that is, ... By subclassing numpy.ndarray a pickle dump would encode a copy of ...
    (comp.lang.python)
  • Re: Optimal Solution
    ... can write the entire array and read it in again very ... I got stuck on how the science has to wait while the graphics finished ... Then reading and writing can very well overlap. ... where in the shared memory the chunk is. ...
    (comp.lang.c)
  • Re: Linked List in Shared Memory
    ... Bcse In interprocess communication 2/more process can share the add/ ... Simple data structure that will do that is index-based (not pointer- ... primitives (shared memory, pipes, mailslots etc). ...
    (microsoft.public.vc.mfc)