
On Mon, 2005-01-17 at 13:44 -0800, Ben Rudiak-Gould wrote:
John Meacham wrote:
Actually, If I were writing new haskell libraries, I would use mmap whenever I could for accessing files. not only does it make the file pointer problem go away, but it can be drastically more efficient.
I'm not sure this is a good idea, because GHC really needs non-blocking I/O to support its thread model, and memory-mapped I/O always blocks. In fact this is a problem even if we only memory-map files at the programmer's request.
Indeed, a new IO system that could transparently take advantage of the system's native asynchronous IO features might be a good fit to GHC's thread model. Note that just using lots of system threads and blocking IO is usually not as efficient as single(/few) threaded multiplexed IO like GHC uses currently. Some OSs that do not have kernel native async IO implement the POSIX async IO API using OS threads and tend to get poor performance and few users. Duncan