Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
how to share memory in ubuntu using c++
Posted
Comments
Sergey Alexandrovich Kryukov 26-Feb-15 12:34pm    
What have you tried so far?
—SA

You can use POSIX shared memory objects (shm*). Please start here: http://man7.org/linux/man-pages/man7/shm_overview.7.html[^].

Good news for you: nothing of this is specific to Ubuntu, and not even exclusively to Linux. Please see also:
http://en.wikipedia.org/wiki/POSIX[^].

—SA
 
Share this answer
 
Comments
CPallini 26-Feb-15 13:13pm    
5.
Sergey Alexandrovich Kryukov 26-Feb-15 15:17pm    
Thank you, Carlo.
—SA
It depends on your needs. Sergey already pointed out how to share memory between processes.
In another scenario, memory is shared between different threads of the same process and all you have to do is synchronize the access to it (see, for instance
"Mutex Variables" at POSIX Threads Programming page
[^].
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 26-Feb-15 15:18pm    
I took sharing memory between threads of the same process for granted, but it is still possible that the inquirer needs at least the mention. 5ed.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900