Connecting Tech Pros Worldwide Help | Site Map

Implementing STL container in shared memeory

Pallav singh
Guest
 
Posts: n/a
#1: Dec 24 '07
Can we implement generic container like vector and set in shared
memory region ( we get from Linux system calls shmget( ) ,
shmat( ) ) ??

i am facing problem in that ?
kasthurirangan.balaji@gmail.com
Guest
 
Posts: n/a
#2: Dec 24 '07

re: Implementing STL container in shared memeory


On Dec 24, 3:42*pm, Pallav singh <singh.pal...@gmail.comwrote:
Quote:
Can we implement generic container like vector and set in shared
memory region ( we get from Linux system calls * shmget( ) ,
shmat( ) ) ??
>
i am facing problem in that ?
Shmget,shmat and all other system calls are not c++ standard. More
over these calls are system specific.

Coming to c++ vector, this template has 2 parameters(template
parameters). First is the generic type and the second an allocator
that is defaulted. This default allocator uses heap for memory
requirements. We could replace this allocator with our own one which
could possibly use shmget and so. You may want to refer to the link
below

http://www.open-std.org/jtc1/sc22/wg...006/n2044.html

Thanks,
Balaji.
=?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=
Guest
 
Posts: n/a
#3: Dec 24 '07

re: Implementing STL container in shared memeory


On 2007-12-24 11:42, Pallav singh wrote:
Quote:
Can we implement generic container like vector and set in shared
memory region ( we get from Linux system calls shmget( ) ,
shmat( ) ) ??
>
i am facing problem in that ?
Only with synchronising operations to the vector, and (as Balaji pointed
out) finding an allocator that used the shared memory.

--
Erik Wikström
Closed Thread