LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-11-2010, 01:27 AM   #1
jeremy28
Member
 
Registered: Sep 2009
Posts: 48

Rep: Reputation: 15
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
 
Old 06-11-2010, 01:28 AM   #2
jeremy28
Member
 
Registered: Sep 2009
Posts: 48

Original Poster
Rep: Reputation: 15
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
 
Old 06-11-2010, 01:37 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Do not cross-post, it is against the LQ rules.

Continue in this thread
 
Old 06-11-2010, 01:39 AM   #4
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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
 
Old 06-11-2010, 01:41 AM   #5
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

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

Last edited by paulsm4; 06-11-2010 at 01:44 AM.
 
Old 06-11-2010, 03:50 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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.) >>

Last edited by pixellany; 06-11-2010 at 03:55 AM.
 
Old 06-11-2010, 05:21 AM   #7
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,622
Blog Entries: 29

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
Quote:
Originally Posted by jeremy28 View Post
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
 
0 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to create shared libraries and configure shared object location vijaya_svk Programming 2 11-19-2007 12:30 PM
How to create shared objects and how are they useful jeevanladhe Programming 4 05-01-2007 01:41 PM
Dynamically sized objects in shared memory jtshaw Programming 2 03-16-2005 10:12 AM
any links on linking, loading shared libraries, shared objects. etc? ananthbv Programming 0 02-03-2005 07:47 AM


All times are GMT -5. The time now is 01:14 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration