On Sockets and System Calls: Minimizing Context Switches for the Socket API

Tomás Hrubý, Teodor Crivat, Herbert Bos, Andrew S. Tanenbaum
2014 USENIX Symposium on Operating Systems Design and Implementation  
Traditionally, applications use sockets to access the network. The socket API is well understood and simple to use. However, its simplicity has also limited its efficiency in existing implementations. Specifically, the socket API requires the application to execute many system calls like select, accept, read, and write. Each of these calls crosses the protection boundary between user space and the operating system, which is expensive. Moreover, the system calls themselves were not designed for
more » ... igh concurrency and have become bottlenecks in modern systems where processing simultaneous tasks is key to performance. We show that we can retain the original socket API without the current limitations. Specifically, our sockets almost completely avoid system calls on the "fast path". We show that our design eliminates up to 99% of the system calls under high load. Perhaps more tellingly, we used our sockets to boost NewtOS, a microkernel-based multiserver system, so that the performance of its network I/O approaches, and sometimes surpasses, the performance of the highly-optimized Linux network stack.
dblp:conf/osdi/HrubyCBT14 fatcat:7egrfhqssbeinmqctdw2rcawau