LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-02-2005, 05:56 AM   #1
dreamfly281
LQ Newbie
 
Registered: Dec 2005
Posts: 4

Rep: Reputation: 0
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?
 
Old 12-02-2005, 07:27 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
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.
 
Old 12-02-2005, 08:59 AM   #3
dreamfly281
LQ Newbie
 
Registered: Dec 2005
Posts: 4

Original Poster
Rep: Reputation: 0
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
 
Old 12-02-2005, 09:19 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
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.
 
Old 12-02-2005, 09:36 AM   #5
dreamfly281
LQ Newbie
 
Registered: Dec 2005
Posts: 4

Original Poster
Rep: Reputation: 0
I am sorry i don't know SQlite even before. I am googling it and find it can satisfy my need. Thanks
 
Old 12-02-2005, 11:37 AM   #6
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
memery used by fprintf() lordofring Programming 2 09-14-2005 10:43 AM
any one willing to share dynamic ip software and vhost.conf information? knightdog Fedora 3 11-09-2004 09:57 AM
Process dies when i try to browse mounted SAMBA windows share poko Linux - Software 1 08-12-2004 11:40 PM
ar counterpart for dynamic share libraries ? colmmagoo Linux - Software 0 08-06-2004 02:36 PM
share socket between two process Vikash Singh Linux - Networking 0 10-10-2003 07:21 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration