[comp.unix.questions] Question about shared memory on UNIX

jian@kuhub.cc.ukans.edu (07/03/90)

Hi folks:
   I posted a help wanted message about shared memory on UNIX. I very much 
appreciate all responses and helps. After reading some usefull books, I got
some idea about shared memory on UNIX and would like to place a comment about
it. As what I understand, shared memory on Unix means two or more processes 
share a common physical memory segment. That implies I can't dynamically 
create memory segments to be shared by other processes. Am I right? If I am 
wrong, please indicate how can I dynamically create a link list that can be 
shared by other processes. I would appreciate any helps.

Jian Q. Li
jian@kuhub.cc.ukan.edu

gt0178a@prism.gatech.EDU (BURNS,JIM) (07/03/90)

in article <24844.268f5e69@kuhub.cc.ukans.edu>, jian@kuhub.cc.ukans.edu says:
> 
>     As what I understand, shared memory on Unix means two or more processes 
> share a common physical memory segment. That implies I can't dynamically 
> create memory segments to be shared by other processes. Am I right? If I am 

Incorrect. Using shmget(2), shmop(2) (shmat(), shmdt()), and shmctl(2) in
SysV, you can do this. An excellent tutorial on this is in the chapter on
shared memory in HP's Real Time I/O Programming Manual (I have the version
for the Series 9000/800).
Basically, you can obtain a shared memory id that other processes can find,
if you wish them to, and allocate a block of memory (a pointer is
returned). You must then use this pointer to implement your linked list,
within the constraints of the size of memory you requested.
-- 
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a@prism.gatech.edu