Two Programming Questions

Doug Pintar dougp at ico.isc.com
Thu Aug 30 03:28:57 AEST 1990


In article <1990Aug28.221823.3897 at chinet.chi.il.us> les at chinet.chi.il.us (Leslie Mikesell) writes:
>In article <1990Aug27.230044.13699 at virtech.uucp> cpcahil at virtech.UUCP (Conor P. Cahill) writes:
>
>>>just forget about using shared memory and use a real file with file
>>>locking instead.  If it is being constantly accessed, it will be in
>>>memory anyway.
>
>I've considered opening a real file mapped against the shared memory
>just to be able to use the file locking routines to arbitrate
>access (i.e. lock the file region but access the memory segment
>instead).  Does anyone know how this would work performance-wise
>compared to any reasonable alternatives?

I'm doing this on a large database application I'm building.  The shared mem
databases get initialized from disk files and rewritten when the application
shuts down (with a journal file going to both disk and tape in case it DOESN'T
get shut down!).  I just leave the files open and use lock/unlock on them to
arbitrate access to the shared mem.  Works fine, but it isn't the quickest
operation in the world.  I tend to just lock the heads of lists I'm going to
search rather than each individual item, for example.  I ran a test on a
386/25 (cache) system, and each lock/unlock pair (assuming no conflicts) takes
about 360 microseconds.
DLP



More information about the Comp.unix.i386 mailing list