LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   share dynamic memery between process (https://www.linuxquestions.org/questions/programming-9/share-dynamic-memery-between-process-388568/)

dreamfly281 12-02-2005 05:56 AM

share dynamic memery between process
 
i want share dynamic memery between process(parent and child),if the memery is static I can get it by mmap or other methods. but i want share a list struct. it will insert list node or delete list node sometimes. i try my best but haven't solove it, who can tell me how can get it?

graemef 12-02-2005 07:27 AM

Just a thought but can you put a pointer in the the static area to the head of the list that you wanted to share?

graeme.

dreamfly281 12-02-2005 08:59 AM

I have done that you have said. but it doesn't work. because in different process. although the value of the pointer is the same (ie, the pointer = 0X3200 ), but the *pointer is different.but thank you all the same:)

graemef 12-02-2005 09:19 AM

Dang that makes sense because the pointer is a local reference...

How about using pipes to transfer the data from one process to another? Not easy to synchronise if you require write access on both processes? If you do require write access you may want to look at SQLite, probably better than a fully fledged database.

Anyway just some thoughts.

cheers,

graeme.

dreamfly281 12-02-2005 09:36 AM

I am sorry i don't know SQlite even before. I am googling it and find it can satisfy my need. Thanks

paulsm4 12-02-2005 11:37 AM

Have you tried using MAP_FIXED?

You might also wish to look here:

http://vig.pearsonptr.com:8081/sampl...0130810819.pdf

This book is very highly recommended:

Advanced Programming in the Unix Environment, W. Richard Stevens:
http://www.bookpool.com/sm/0201433079


All times are GMT -5. The time now is 07:37 AM.