Hi folks :blink:
I want to try some shared memory program on my PC (ubuntu) .... I m scared that some mistakes (related to shared memory/sephomore) may spoil my PC' memory...Suggest some tips :rules: and simple program that can be execute on my PC:thumbup:
simple shared memory program on C
Started by kattythebest, Sep 08 2009 11:01 PM
3 replies to this topic
#1
Posted 08 September 2009 - 11:01 PM
|
|
|
#2
Posted 08 September 2009 - 11:54 PM
Don't worry, using shared memory won't physically harm your memory cards. :)
Shared memory in Ubuntu is actually very painless to implement. There's a folder in Ubuntu called "/dev/shm" which, as I read it, is a RAMdisk, or a shared RAM drive, that acts just like a normal folder to write data to, but is actually stored into RAM so you can output data to and get data from it just as fast as you could from normal RAM, while sharing the resource as if it were a normal file on the hard disk. Go ahead and look into it, it might be just what you're looking for...
Shared memory in Ubuntu is actually very painless to implement. There's a folder in Ubuntu called "/dev/shm" which, as I read it, is a RAMdisk, or a shared RAM drive, that acts just like a normal folder to write data to, but is actually stored into RAM so you can output data to and get data from it just as fast as you could from normal RAM, while sharing the resource as if it were a normal file on the hard disk. Go ahead and look into it, it might be just what you're looking for...
Wow I changed my sig!
#3
Posted 09 September 2009 - 12:48 AM
Thank you ...
#4
Posted 11 September 2009 - 04:33 AM
That's publicly shared memory though, isn't it? There's a way to share memory between programs that you've written. I can't remember the exact procedure right now (it's simple, like five lines), but it's really quite useful. And more secure.
You'll have to call these functions, in this order:
shm_open (create memory object)
ftruncate (set size of memory object)
mmap (map memory object into address space)
(memory is ready to use)
munmap
shm_unlink
You'll have to call these functions, in this order:
shm_open (create memory object)
ftruncate (set size of memory object)
mmap (map memory object into address space)
(memory is ready to use)
munmap
shm_unlink
sudo rm -rf /


Sign In
Create Account

Back to top









