2001-07-03 08:49:52

by Blesson Paul

[permalink] [raw]
Subject: shared memory problem

hi
I have some confusion regarding key in shmget(). Let I
have two shared memory variables. For the first one, I put key "99" and the
size is 1024. Next, I put key "199" for the second variable and size 1024.
Will the two shared memory area overwrite each other. How can I gurranty. Is
the Linux kernel or the developer who should care about this problem
by
BLesson


2001-07-03 09:31:48

by Erik Mouw

[permalink] [raw]
Subject: [OT] Re: shared memory problem

On Tue, Jul 03, 2001 at 02:49:24AM -0600, Blesson Paul wrote:
> I have some confusion regarding key in shmget(). Let I
> have two shared memory variables. For the first one, I put key "99" and the
> size is 1024. Next, I put key "199" for the second variable and size 1024.
> Will the two shared memory area overwrite each other. How can I gurranty. Is
> the Linux kernel or the developer who should care about this problem

No, the segments will not overwrite each other, see man shmget and get
"Advanced programming in the UNIX environment" by Richard Stevens.


Erik

--
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands
Phone: +31-15-2783635 Fax: +31-15-2781843 Email: [email protected]
WWW: http://www-ict.its.tudelft.nl/~erik/