由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - Key in Shared Memory
相关主题
CGI之Perl Script一问unix下编译fortran 的错误太多,看不到怎么办?
[转载] 请教 How to capture all keystrokes in linux?
有没有四舍无入的函数?Bash里面 <<< 是什么意思
help!!! pipe program[转载] Anyone ever installed Solaris 8 on PC?
问一个关于at的问题another question about priority under Unix/Linux
what's wrong with this ftp batch file?CYGWIN set up ??
paste command 里面的 -[转载] help! install cxterm in RH7.3, ld causes problems
command line socket toolsA quick emacs question
相关话题的讨论汇总
话题: key话题: memory话题: shared话题: shmget话题: share
进入Unix版参与讨论
1 (共1页)
b*********a
发帖数: 28
1
Thank you all very much for providing me the
useful information, I almost make it clear
for 2 different programs to share data.
however, I still have one question. When Program A
and B want to share the memory, they need a common
KEY to be passed to the shmget, shmat, shmdt, shmctrl.
What is this KEY? Where to get it? Can I just use
any integer number provided that A and B use the same?
Anybody experienced this please kindly give more information
or any clue.
Thank you all!
c*m
发帖数: 9
2

key is used for that u can get unique mem(semphora, msg queue,....) ID for the
system. In general, you can input an integer from the stdin. Before using the
share mem, make sure u called shmget(...), get the ID.

【在 b*********a 的大作中提到】
: Thank you all very much for providing me the
: useful information, I almost make it clear
: for 2 different programs to share data.
: however, I still have one question. When Program A
: and B want to share the memory, they need a common
: KEY to be passed to the shmget, shmat, shmdt, shmctrl.
: What is this KEY? Where to get it? Can I just use
: any integer number provided that A and B use the same?
: Anybody experienced this please kindly give more information
: or any clue.

s*****g
发帖数: 219
3
Moreover, you need to know the Key has a time out;
After you terminate your program, you can not reuse
the same key in following several minutes. You have
to change your source code to use another KEY.
It is not mentioned in books, but makes you mad in
debugging.

【在 c*m 的大作中提到】
:
: key is used for that u can get unique mem(semphora, msg queue,....) ID for the
: system. In general, you can input an integer from the stdin. Before using the
: share mem, make sure u called shmget(...), get the ID.

1 (共1页)
进入Unix版参与讨论
相关主题
A quick emacs question问一个关于at的问题
How to ensure atomic execution of lineswhat's wrong with this ftp batch file?
Solaris disk driverpaste command 里面的 -
winterm background colorcommand line socket tools
CGI之Perl Script一问unix下编译fortran 的错误太多,看不到怎么办?
[转载] 请教 How to capture all keystrokes in linux?
有没有四舍无入的函数?Bash里面 <<< 是什么意思
help!!! pipe program[转载] Anyone ever installed Solaris 8 on PC?
相关话题的讨论汇总
话题: key话题: memory话题: shared话题: shmget话题: share