TDT09 Topic 9


Fun with abstractions - what do they cost us?

All problems in computer science can be solved by another level of indirection.
A common way to enable problem-oriented, easy to handle programming, is to introduce abstractions, which provide a virtualized view of a system to higher levels in the software stack. For example, an operating system provides a virtual machine via system calls that enables a programmer to work with files instead of having to access the hard disk directly.

However, these abstractions are costly - they require e.g. transitions from user to kernel space (including switching of page tables) or copying and rewriting of data. An interesting recent study [1] has shown that the latencies for keyboard input, i.e. the time it takes from a keypress to the related character appearing on the screen, has increased significantly over the last four decades, even though computers are many orders of magnitude faster than in the 1970's.

This cost of abstraction can be observed on many levels and is usually considered a more-or-less worthwhile tradeoff to improve other non-functional properties of a system, such as security. For example, microkernel-based operating systems suffered significantly from a large context-switch overhead, since components of the OS that are executing in the kernel address space, such as device drivers, now run in user space and have to perform costly context switches to the microkernel. Liedtke discovered that the performance of inter-process communication (IPC) was crucial to building an efficient microkernel-based system [2]. However, hardware improvements may make some of these assumptions irrelevant, leading to publications that give a different view [3].

Similar approaches to overcome abstraction costs can be found in other performance-critical applications. In HPC applications, there is a trend to employ user-space networking [4] (of course, with a critique of this approach [5]) and storage [6]. For virtualized environments, GPU passthrough has been introduced as a way to provide full GPU performance to a virtualized host [7]. However, the OS still plays a significant role in an area of kernel-bypassing, as demonstrated by [8].

The hardware-software interface is interesting since abstractions that enable an easier use of the hardware usually cost performance. In this multi-criterial optimization problem, it is important to look at both sides of the problem to find a useful compromise without violating essential requirements, e.g. in security or energy consumption. The increasing use of libraries and frameworks has contributed significantly to the related overheads. In turn, some initiatives were started to again create lean software [9,10]. So far, these have unfortunately been mostly ignored...

References

  1. Dan Luu. Computer latency: 1977-2017. link
  2. Jochen Liedtke. 1993. Improving IPC by kernel design. SIGOPS Oper. Syst. Rev. 27, 5 (Dec. 1993) pdf
  3. Brian N. Bershad. The Increasing Irrelevance of IPC Performance for Microkernel-Based Operating Systems. Proceedings of the 1992 USENIX Workshops on Microkernels link
  4. Aled Edwards, Greg Watson, John Lumley, David Banks, Costas Calamvokis, and C. Dalton. 1994. User-space protocols deliver high performance to applications on a low-cost Gb/s LAN. In Proceedings of SIGCOMM '94 link
  5. Magoutis, Kostas, Margo Seltzer, and Eran Gabber. 2004. “The case against user-level networking.” Third Workshop on Novel Uses of System Area Networks (SAN-3) pdf
  6. Adrian M. Caulfield, Todor I. Mollov, Louis Alex Eisner, Arup De, Joel Coburn, and Steven Swanson. 2012. Providing safe, user space access to fast, solid state disks. SIGPLAN Not. 47, 4 link
  7. A. J. Younge, J. P. Walters, S. Crago and G. C. Fox, Evaluating GPU Passthrough in Xen for High Performance Cloud Computing, 2014 IEEE International Parallel & Distributed Processing Symposium Workshops link
  8. Zhang et al.. I’m Not Dead Yet! The Role of the Operating System in a Kernel-Bypass Era, HotOS'19 pdf
  9. N. Wirth, A Plea for Lean Software in Computer, vol. 28, no. 02, pp. 64-68, 1995 pdf
  10. Michael Franz and Thomas Kistler. 1997. Slim binaries. Commun. ACM 40, 12 (Dec. 1997) link