On Tue, 2008-06-10 at 10:40 +0200, Frederik Ramm wrote: > Hi, > > > Um... no. At least not if it does the sensible thing and maps it > > for shared read. > > I don't think it is even possible to mmap somthing for "private read". > The boost lib only ever sets the SHARED flag when it wants write access: > > void* data = ::mmap( hint, pimpl_->size_, > readonly ? PROT_READ : (PROT_READ |PROT_WRITE), > readonly ? MAP_PRIVATE : MAP_SHARED, > pimpl_->handle_, p.offset ); > > I guess that a "shared" mode is implicitly used by mmap if you specify > read access only; anything else would not make sense (and would mean > that the boost guys got it wrong, which is not impossible but rare).
Those lines above imply that readonly mappings are flagged MAP_PRIVATE which looks a little odd. The the strace output below seems to confirm these these flags: 23807 open("/home/jburgess/osm/data/world_boundaries/processed_p.shp", O_RDONLY) = 18 ** 23807 mmap(NULL, 327324396, PROT_READ, MAP_PRIVATE, 18, 0) = 0x7f46842d9000 23807 open("/home/jburgess/osm/data/world_boundaries/processed_p.dbf", O_RDONLY) = 19 23807 mmap(NULL, 9758339, PROT_READ, MAP_PRIVATE, 19, 0) = 0x7f469a477000 23807 open("/home/jburgess/osm/data/world_boundaries/processed_p.index", O_RDONLY <unfinished ...> 23808 open("/home/jburgess/osm/data/world_boundaries/processed_p.shp", O_RDONLY <unfinished ...> 23807 <... open resumed> ) = 20 23808 <... open resumed> ) = 21 23807 mmap(NULL, 2268216, PROT_READ, MAP_PRIVATE, 20, 0) = 0x7f46840af000 ** 23808 mmap(NULL, 327324396, PROT_READ, MAP_PRIVATE, 21, 0) = 0x7f4670885000 The two lines ** are memory maps of the same 300MB shapefiles though the fd's are different. This is being done concurrently by 2 threads and the resulting address mappings returned are different. Jon _______________________________________________ talk mailing list talk@openstreetmap.org http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk