问题
In an application I am developing I use splice on Linux for socket-to-socket data transfer.
- Do other operating systems (specifically at least Windows, OS X and FreeBSD) implement
spliceor an equivalent solution? - Is it possible to imitate socket-to-socket data
spliceing on Windows withsendfile¹ +memmap¹?
¹ Both exist on Windows under different names which I do not remember.
Update
You can see the performance improvements of splice vs user space buffers on Linux.
DF,DR,F,MF,MRare my application in its different tunneling modes,NXis NGINX web server-p+tuses the Linux system callsplice+p-tuses a portable implementation with user space buffers+p+tuses a portable implementation with user space buffers and multiple OS threads- bars represent throughput in gigaBYTE s per second
- a single 1 gigabyte (1048576000 bytes) file was requsted 4 times by 4 concurrent clients
回答1:
OpenBSD has sosplice and somove: http://www.openbsd.org/cgi-bin/man.cgi?query=sosplice
回答2:
TransmitFile comes to mind as one such way in winsock to stream from one file handle to a socket, but I an not certain if that will help you as it's for streaming from file->disk. You might be able to use it with a memory mapped file handle.
I've heard a few people in the past speak of "kernel mode" as the way to speed up some echo and simple server operations, but I've never done it.
Some links on kernel mode winsock:
http://blogs.msdn.com/b/wndp/archive/2006/02/24/introduction-to-winsock-kernel-wsk.aspx
http://msdn.microsoft.com/en-us/library/windows/hardware/ff571084(v=vs.85).aspx
来源:https://stackoverflow.com/questions/12230316/do-other-operating-systems-implement-the-linux-system-call-splice