Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: magrasjc@texas.net
Subject: Re: mmap/shared memory and mutex/semaphores
Date: 1997/06/12	[thread overview]
Message-ID: <33A0C144.5498@texas.net> (raw)
In-Reply-To: 339F1672.1396@texas.net


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.



      reply	other threads:[~1997-06-12  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-11  4:00 mmap/shared memory and mutex/semaphores magrasjc
1997-06-12  4:00 ` magrasjc [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox