LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   How to create a shared memory and some shared objects in linux? (http://www.linuxquestions.org/questions/programming-9/how-to-create-a-shared-memory-and-some-shared-objects-in-linux-813491/)

jeremy28 06-11-2010 01:27 AM

How to create a shared memory and some shared objects in linux?
 
Hi all;

I want to create a "Shared Memory" in linux, then create multiple "Shared Objects" that can access to a Table for example;
And one of them can write something into the Table and the other can access and read it, so that these operations can be handled by programmer!

I'm using Ubuntu 9.04 and I've set it's runlevel at 3 (I have commandline environment now!)
I've searched the Internet so much, but couldn't find a good sample code for this!
I have no experience about it and need your help to introduce me a sample code about it and advise me how to compile and use it with "GCC"?!


Please help me with this, I'm so hurry!!

TIA

jeremy28 06-11-2010 01:28 AM

How to create a shared memory and some shared objects in linux?
 
Hi all;

I want to create a "Shared Memory" in linux, then create multiple "Shared Objects" that can access to a Table for example;
And one of them can write something into the Table and the other can access and read it, so that these operations can be handled by programmer!

I'm using Ubuntu 9.04 and I've set it's runlevel at 3 (I have commandline environment now!)
I've searched the Internet so much, but couldn't find a good sample code for this!
I have no experience about it and need your help to introduce me a sample code about it and advise me how to compile and use it with "GCC"?!


Please help me with this, I'm so hurry!!

TIA

druuna 06-11-2010 01:37 AM

Do not cross-post, it is against the LQ rules.

Continue in this thread

paulsm4 06-11-2010 01:39 AM

Hi -

You probably want to use the standard "shm*" shared memory API.

Beej's Guide to IPC is an excellent tutorial:
http://beej.us/guide/bgipc/output/ht...age/bgipc.html

'Hope that helps .. PSM

PS:
I'd go easy on the exclamation points in your next post, if I were you ;)

PPS:
Nobody really cares if you're "in a hurry" :)
As Pixellany said:
Quote:

There are 2 magic words here: "Please" and "Patience"
Sage advice, that :)

paulsm4 06-11-2010 01:41 AM

Don't yell "!!!URGENT!!!"

Nobody CARES if you're "so hurry!"

And, as druuna said:
Quote:

Do not cross-post, it is against the LQ rules.

Continue your thread here
.

pixellany 06-11-2010 03:50 AM

jeremy*;
You were warned yesterday not to start duplicate threads. Do not do this again.

I've merged these since both had replies.

<< PS: Moved to Programming (What I thought I was doing when I did the merge.) >>

TheIndependentAquarius 06-11-2010 05:21 AM

Quote:

Originally Posted by jeremy28 (Post 3999817)
Hi all;

I want to create a "Shared Memory" in linux, then create multiple "Shared Objects" that can access to a Table for example;
And one of them can write something into the Table and the other can access and read it, so that these operations can be handled by programmer!

....
and advise me how to compile and use it with "GCC"?!

See if the following helps you !
http://www.cs.cf.ac.uk/Dave/C/node27.html

and for compiling with gcc see below:
http://luv.asn.au/overheads/compile.html


All times are GMT -5. The time now is 11:58 AM.