vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I'm using aIX 5.1 I wrote a shared memory library in c++ which using 'shmget' and 'shmat' to allocate a shared memory segment. The varibale which attaches the shared memory segment using 'shmat' is defined static. I have two questions: Since the latrer variable is static, is it possible for each process which links this lobrary, to use this shared segment? If i want to remove this shared segment from memory, do i need to use both 'shmdt' and 'shmctl', or only 'shmctl'? Thanks from advance Boaz |
| ||||
| "Boaz" <boazter@hotmail.com> writes: > I wrote a shared memory library in c++ which using 'shmget' and 'shmat' > to allocate a shared memory segment. > The varibale which attaches the shared memory segment using 'shmat' is > defined static. > I have two questions: > Since the latrer variable is static, is it possible for each process > which links this lobrary, to use this shared segment? The visibilty of the variable has *absolutely* nothing to do with whether the processes can use this shared memory. You continue to demonstrate complete lack of understanding of how UNIX virtual memory works. I advise you (for the last time) to read an introductory book on the subject. > If i want to remove this shared segment from memory, do i need to use > both 'shmdt' and 'shmctl', or only 'shmctl'? Remove this segment from memory of the process? Use shmdt. Remove it from the system (so no other process can attach to it)? Use shmctl(..., IPC_RMID). Note that the segment will not be actually destroyed until last attached process exits or performs shmdt. Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. |