File Buffering Questions ...
Roger Oberholtzer
roger
Wed Jun 14 08:45:09 PDT 2006
On Wed, 2006-06-14 at 09:51 -0500, Ben Duncan wrote:
> Thanks Roger,
>
> Yes, this is a database application.
>
> I looked at mmap, briefly.
>
> However (correct me if I am wrong here):
>
> mmap does not seem to support record locking in a multi user
> environment (fcntl , lockf or flock).
I think (not positive) that you can lock pages (areas of memory). Not
sure of the specifics. If a record is some unit in the file, then the
record info in the file could have a 'locked' field. Then you do not
worry about the OS having something.
> If I am the first to mmap a file, and when I am done decide to close
> the mmap'ing and you are using the file ( a second process) ,
> what happens then ? Does the mapping stay open? Does the mapping
> go away? Does your process inherit the mapped file ? Is there
> a major fubar? Does little Debbie still get to go to college ?
Debbie graduates first in the class. mmaps can go across forks. A single
app never needs to map a file more than once. Different apps can map
them. We have a config thing that does this across forks of the app. We
even have it so the memory address in each app is the same when a new
map is made after the processes forked. That way pointer references into
this are valid in all processes.
> I could not find the answer when googling or RTFM'ing ..
>
> On Wed, 2006-06-14 at 08:36 -0500, Ben Duncan wrote:
> <SNIP>
>
> > I gather this is a database app. Why not mmap() the file? The OS does a
> > great job of managing the cache when you do this. Not sure what MVISAM
> > is up to. But maybe it offers this as a file access option?
>
> > --
> > Roger Oberholtzer
>
> Thanks ...
>
--
Roger Oberholtzer
OPQ Systems AB
Ramb?ll Sverige AB
Kapellgr?nd 7
P.O. Box 4205
SE-102 65 Stockholm, Sweden
Tel: Int +46 8-615 60 20
Fax: Int +46 8-31 42 23
More information about the Linux-users
mailing list