* mmap/shared memory and mutex/semaphores
@ 1997-06-11 4:00 magrasjc
1997-06-12 4:00 ` magrasjc
0 siblings, 1 reply; 2+ messages in thread
From: magrasjc @ 1997-06-11 4:00 UTC (permalink / raw)
Greetings fellow unixheads,
I need to use a posix semaphore to control access to shared memory.
This thing is giving me problems. Any experience especially when
to invalidate the shared memory/mapped file segment since the
data space and semaphore will be handled together.
Thanks in advance for your advice,
J.C. Magras
--
Unix Software Engineer looking for C++/UNIX/Motif/Perl/Tk/Flex
Software Engineering position **NOW**. Currently in Austin at
(512) 672-5778/magrasjc@texas.net. have Answering machine.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: mmap/shared memory and mutex/semaphores
1997-06-11 4:00 mmap/shared memory and mutex/semaphores magrasjc
@ 1997-06-12 4:00 ` magrasjc
0 siblings, 0 replies; 2+ messages in thread
From: magrasjc @ 1997-06-12 4:00 UTC (permalink / raw)
magrasjc@texas.net wrote:
>
> Greetings fellow unixheads,
>
> I need to use a posix semaphore to control access to shared memory.
>
> This thing is giving me problems. Any experience especially when
> to invalidate the shared memory/mapped file segment since the
> data space and semaphore will be handled together.
Some updates and new questions.
I have found that if the server in this relationship "broadcasts" the
address returned by calling mmap() with the first paramater=0 and the
clients call mmap with the broadcasted (via shared memory) address
as the first paramater to mmap() and fourth value containing MAP_FIXED.
I got what I wanted a mmap()'ed file whose mapped space starts with 3
posix semaphores.
I dont know if the 3 posix semaphores are wise.
The posix semaphores+shmget() shared mem+mmap() are all inside 1 C++
object. The constructors work fine for clients and server processes.
The server tries to read and blocks correctly. The client tries to
write and the mmap descriptor returned in no longer valid.
Suggestions?
other info
POSIX inter-process mutexes are optional. The first posixsem guards
access to the client server transaction. the second posixsem is
for controlling server access. the third posixsem is controlling client
access to the mmap()'d file.
Thanks in advance for your advice,
J.C. Magras
--
Unix Software Engineer looking for C++/UNIX/Motif/Perl/Tk/Flex
Software Engineering position **NOW**. Currently in Austin at
(512) 672-5778/magrasjc@texas.net. have Answering machine.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1997-06-12 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-06-11 4:00 mmap/shared memory and mutex/semaphores magrasjc
1997-06-12 4:00 ` magrasjc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox