[erlang-questions] why is mmap so darn difficult
Wed Jun 12 09:24:44 CEST 2013
This is part plea, part question. The short version is that what I really want is for OTP to provide file:mmap. Along with file:sendfile, this would allow me to rely heavily on the OS to deal with getting data onto the disk, paging in and out and delivering it to clients (i.e., sockets) with a minimum of copying and bringing data into user space.
The long version is that I'm quite happy to roll my sleeves up and write a driver to handle mmap, but I'm unconvinced that there's a practical way to do this without having to copy (see, for example, emmap, which does indeed copy), and that kinda defeats the object. In fact, since NIF calls taking longer than a millisecond or so can get the schedulers in a tizzy, my instinct is that a driver would be a better choice, but my question is whether or not one can avoid copying - yes I know that you can pass a binary from erlang to a driver without copying, but that's not quite the same thing. And even if I did manage that, presumably file:sendfile would no longer be of much use.
Any pointers here would be much appreciated, though proper mmap support would obviously be ideal. From a bit of quality time with google, it seems I'm not the only person frustrated by this.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 235 bytes
Desc: Message signed with OpenPGP using GPGMail
More information about the erlang-questions