On sockets and system calls minimizing context switches for the socket API

Tomáš Hrubý, Teodor Crivat, Herbert Bos, Andrew S. Tanenbaum · 2014

Traditionally, applications use sockets to access the net-work. The socket API is well understood and simple to use. However, its simplicity has also limited its ef-ficiency in existing implementations. Specifically, the socket API requires the application to execute many sys-tem 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 high concurrency and have become bottlenecks in modern systems where processing simultaneous tasks is key to performance. We show that we can retain the orig-inal socket API without the current limitations. Specifi-cally, 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 per-formance of its network I/O approaches, and sometimes surpasses, the performance of the highly-optimized Linux network stack. 1

Read the paper · More papers on PaperTik