The Case for Writing Network Drivers in High-Level Programming Languages

The Case for Writing Network Drivers in High-Level Programming Languages
复制标题

使用高级编程语言编写网络驱动程序的案例

DOI:
10.1109/ancs.2019.8901892
复制
发表时间:
2019
期刊:
2019 ACM/IEEE Symposium on Architectures for Networking and Communications Systems (ANCS)
影响因子:
--
通讯作者:
G. Carle
G. Carle
中科院分区:
--
文献类型:
--
作者:
Paul Emmerich;Simon Ellmann;Fabian Bonk;A. Egger;Esaú García Sánchez;T. Günzel;Sebastian Di Luzio;Alexandru Obada;Maximilian Stadlmeier;Sebastian Voit;G. Carle

文献摘要

被引文献

相似文献

在所有生产级服务器、桌面和移动的操作系统上,驱动程序都是用C或C++的受限子集编写的。它们占Linux中代码的66%,但2017年在Linux中发现的40个与内存安全相关的安全漏洞中有39个位于驱动程序中。这些错误可以通过使用高级驱动程序语言来防止。我们展示了使用Rust、Go、C#、Java、OCaml、Haskell、Swift、JavaScript和Python实现的英特尔ixgbe 10 Gbit/s网卡的用户空间驱动程序,这些驱动程序都是以各自语言的惯用风格从头开始编写的。我们量化了使用这些语言的成本和收益:高级语言更安全(更少的错误,更多的安全检查),但运行时安全检查会降低吞吐量,垃圾收集会导致延迟峰值。乱序CPU降低了安全检查的成本:我们的Rust驱动程序每个数据包执行的指令增加了63%,但只比参考C实现慢4%。Go的垃圾收集器即使在重负载下也能将延迟保持在100 μs以下。其他语言的情况更糟,但它们独特的属性是一个有趣的案例研究。所有实现都可以在https://githud.com/ixy-languages/ixy-languages上免费获得。
Drivers are written in C or restricted subsets of C++ on all production-grade server, desktop, and mobile operating systems. They account for 66 % of the code in Linux, but 39 out of 40 security bugs related to memory safety found in Linux in 2017 are located in drivers. These bugs could have been prevented by using high-level languages for drivers. We present user space drivers for the Intel ixgbe 10 Gbit/s network cards implemented in Rust, Go, C#, Java, OCaml, Haskell, Swift, JavaScript, and Python written from scratch in idiomatic style for the respective languages. We quantify costs and benefits of using these languages: High-level languages are safer (fewer bugs, more safety checks), but run-time safety checks reduce throughput and garbage collection leads to latency spikes. Out-of-order CPUs mitigate the cost of safety checks: Our Rust driver executes 63 % more instructions per packet but is only 4 % slower than a reference C implementation. Go's garbage collector keeps latencies below 100 μs even under heavy load. Other languages fare worse, but their unique properties make for an interesting case study. All implementations are available as free and open source at https://githud.com/ixy-languages/ixy-languages.