|
|
Shared memory Problem
HI all I am new to unix programming,
I have client and server that uses shared memory I have code like this,
key = 5678;
if ((shmid = shmget(key, SHMSZ, IPC_CREAT | 0666)) < 0) {
perror("shmget");
exit(1);
}
if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) {
perror("shmat");
exit(1);
}
/*Initialize some data to the shm*/
Basically server creates shared memory and stays in the memory untill
the
data in shm is modified. Where as client acess the shared memory
and changes the shm value. But problem is even though server is not
running
client can access the shared memory . Can some body explain how
to delete or free the shared memory when client is closing down. Thanks
Prasanna Bhat mavinkuli
|
|
0
|
|
|
|
Reply
|
boss_bhat (11)
|
11/3/2005 11:44:42 AM |
|
Mavinkuli wrote:
> HI all I am new to unix programming,
> I have client and server that uses shared memory I have code like this,
> key = 5678;
> if ((shmid = shmget(key, SHMSZ, IPC_CREAT | 0666)) < 0) {
> perror("shmget");
> exit(1);
> }
> if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) {
> perror("shmat");
> exit(1);
> }
> /*Initialize some data to the shm*/
> Basically server creates shared memory and stays in the memory untill
> the
> data in shm is modified. Where as client acess the shared memory
> and changes the shm value. But problem is even though server is not
> running
> client can access the shared memory . Can some body explain how
> to delete or free the shared memory when client is closing down. Thanks
>
> Prasanna Bhat mavinkuli
shmctl() with cmd option as IPC_RMID or shmdt() will destroy shared
memory .
|
|
0
|
|
|
|
Reply
|
spat
|
11/3/2005 12:40:08 PM
|
|
"Mavinkuli" <boss_bhat@yahoo.co.in> wrote in message
news:1131018282.788930.153280@g47g2000cwa.googlegroups.com...
> if ((shmid = shmget(key, SHMSZ, IPC_CREAT | 0666)) < 0) {
> perror("shmget");
> exit(1);
> }
> if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) {
> perror("shmat");
> exit(1);
> }
> client can access the shared memory . Can some body explain how
> to delete or free the shared memory when client is closing down. Thanks
shmctl(IPC_RMID);
DS
|
|
0
|
|
|
|
Reply
|
David
|
11/4/2005 6:46:27 AM
|
|
|
2 Replies
115 Views
(page loaded in 0.14 seconds)
Similiar Articles: STL allocators, global new/delete using the heap and shared memory ...If all it is doing is allocating from shared memory instead of the heap, this shouldn't be a problem. Best wishes, Matthew Collett -- Those who assert that the ... Memory issue - Hash Approach - comp.soft-sys.sasMemory issue - Hash Approach - comp.soft-sys.sas data structures on shared memory? - comp.unix.programmer ... shared memory you're using); the problem with this approach ... Segmented images -- scanner or software problem? - comp.text.pdf ...Segmentation (image processing) - Wikipedia, the free encyclopedia Since there is no general solution to the image segmentation problem, these ... based method and solving ... Problem with Trimble Placer 450 - gpsd - ntpd - comp.protocols ...... are problems between gpsd and ntpd resolved? Specifically, how should a GPS receiver report a loss of satellite fix to ntpd over the shared memory ... the shared memory ... Oracle 10gR1 Memory Problem - Please help - comp.databases.oracle ...Hi, One of the Oracle 10gR1 Production Server faced few memory problems. ... Oracle Consulting, Oracle Support ... Cause: More shared memory is ... multiprocessors MB and shared BRAM - comp.arch.fpgaI want > to add, between the two processors, a shared memory BRAM_block_v1_00_a wi= th > the controler xps_bram_if_cntlr_v1_00_a. > > the problem is: when I want to ... Static globals in Shared library - comp.unix.programmerYou'll need to use some form of shared memory for that (SysV shm, shm_open & friends ... The problem is a every process trying to > access this library gets a local copy ... linux shared memory synchronization objects - comp.unix.programmer ...That's the problem. Semaphores and condition variables are in the processes memory so it can only be shared by threads of the same process (they share all memory so it's ... starting oracle with solaris project - comp.unix.solaris ...maybe solaris 10 has a bug with shared memory, so oracle has problems with a project other than default, but I used projects with dedicated listeners without problems ... sharing kernel buffer with user process - comp.sys.hp.hpux ...Option number 2: Use the fact that each process has a specific area dedicated for shared memory which is global to all processes in the system. Problems: 1.How do I ... Shared memory - Wikipedia, the free encyclopediaThe alternatives to shared memory are distributed memory and distributed shared memory, each having a similar set of issues. See also Non-Uniform Memory Access. Shared Memory problemHi all! I'm having trouble with sharing read-only data among processes on one computer. Recently i've developed an application that should read to RAM and ... 7/23/2012 2:32:50 AM
|
|
|
|
|
|
|
|
|