RE: Updated Windows mmap() wrapper
Bob Friesenhahn <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.core |
|---|---|
| Message-ID | <Pine.GSO.4.44.0401191549280.29988-100000@scooby.simplesystems.org> |
On Mon, 19 Jan 2004, Bill Radcliffe wrote: > I have often found the source code to these kinds of wrappers quite > instructive. It should at least inform you on how they deal with some of the > legacy issues discussed below. It may very well yield secrets that will help > you. Maybe not, but it is certainly worth a shot IMHO. The Cygwin mmap wrapper may be instructive, but the MinGW "wrapper" is just a C prototype for Windows API functions, defines, and the equivalent of a .lib file for linking with the DLL. It will be a while before we explore using mmap with base offsets other than zero. It would require a re-write of cache.c. The real challenge with with cache views since if mmapped regions overlap, the address of the conflicting pages is determined by the last mmap. If cache views overlap then serious problems can result since part of the address space of the loser (the first request) will become invalid. A possible solution is to reject any request (i.e. return NULL) for an address region which overlaps with the address region used by a different view. A bitmap could be used to record which pages are currently mapped, or the info could be maintained as a list of ranges associated with the views. Testing under Solaris shows that the overhead of the mmap call is fairly small. The following are some timings to update 2GB of file data (using default page flushing) with various mmap lengths: One huge mmap (GraphicsMagick current approach): real 2:25.228 user 4.187 sys 43.900 mmap per 16 MMU pages: real 2:37.438 user 4.701 sys 47.228 mmap per MMU page: real 3:29.311 user 9.552 sys 1:05.738 I think that the MMU page size is 8K for this system. It remains to be seen how the overhead of memory mapping on other systems compares. Bob ====================================== Bob Friesenhahn [email protected] http://www.simplesystems.org/users/bfriesen ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn