The benefits and costs of writing a POSIX kernel in Go

This paper presents an evaluation of the use of a high-level language (HLL) with garbage collection to implement a monolithic POSIX-style kernel. The goal is to explore if it is reasonable to use an HLL instead of C for such kernels, by examining performance costs, implementation challenges, and programmability and safety benefits.

The paper contributes Biscuit, a kernel written in Go that implements enough of POSIX (virtual memory, mmap, TCP/IP sockets, a logging file system, poll, etc.) to execute significant applications. Biscuit makes liberal use of Go’s HLL features (closures, channels, maps, interfaces, garbage collected heap allocation), which sub- jectively made programming easier. The most challenging puzzle was handling the possibility of running out of kernel heap memory; Biscuit benefited from the analyzability of Go source to address this challenge.

On a set of kernel-intensive benchmarks (including NGINX and Redis) the fraction of kernel CPU time Biscuit spends on HLL features (primarily garbage collection and thread stack expansion checks) ranges up to 13%. The longest single GC-related pause suffered by NGINX was 115 microseconds; the longest observed sum of GC delays to a complete NGINX client request was 600 microsec- onds. In experiments comparing nearly identical system call, page fault, and context switch code paths written in Go and C, the Go version was 5% to 15% slower.

Scientific papers about operating system experiments – who doesn’t love them?

55 Comments

  1. Alfman 2018-10-09 3:11 am EST
    • Lennie 2018-10-09 3:46 pm EST
      • Alfman 2018-10-09 6:12 pm EST
        • Lennie 2018-10-10 5:52 pm EST
    • christian 2018-10-09 8:53 pm EST
      • Alfman 2018-10-10 11:25 am EST
  2. The123king 2018-10-09 7:38 am EST
    • feamatar 2018-10-09 10:07 am EST
      • The123king 2018-10-09 12:29 pm EST
  3. AndrewZ 2018-10-09 12:44 pm EST
    • moondevil 2018-10-09 1:21 pm EST
  4. kwan_e 2018-10-09 4:27 pm EST
  5. FlyingJester 2018-10-09 5:45 pm EST
    • christian 2018-10-09 8:26 pm EST
      • FlyingJester 2018-10-09 8:40 pm EST
        • christian 2018-10-09 9:02 pm EST
          • FlyingJester 2018-10-09 11:14 pm EST
          • kwan_e 2018-10-10 3:34 am EST
          • christian 2018-10-10 9:13 am EST
          • Alfman 2018-10-10 11:09 am EST
          • christian 2018-10-10 12:53 pm EST
          • Alfman 2018-10-10 2:54 pm EST
          • christian 2018-10-10 9:09 pm EST
          • Alfman 2018-10-11 1:08 am EST
          • kwan_e 2018-10-10 6:12 pm EST
          • Alfman 2018-10-11 12:44 am EST
          • kwan_e 2018-10-11 4:03 am EST
          • Alfman 2018-10-11 1:31 pm EST
          • kwan_e 2018-10-11 4:25 pm EST
          • moondevil 2018-10-11 6:32 pm EST
          • kwan_e 2018-10-11 9:19 pm EST
          • Alfman 2018-10-11 9:51 pm EST
          • kwan_e 2018-10-11 10:20 pm EST
          • Alfman 2018-10-12 3:28 am EST
          • kwan_e 2018-10-12 6:18 am EST
          • moondevil 2018-10-12 6:58 am EST
          • Alfman 2018-10-12 8:23 am EST
          • kwan_e 2018-10-12 3:08 pm EST
          • Alfman 2018-10-12 6:04 pm EST
          • kwan_e 2018-10-12 7:40 pm EST
          • Alfman 2018-10-12 10:30 pm EST
          • Alfman 2018-10-13 12:16 am EST
          • kwan_e 2018-10-13 6:30 am EST
          • Alfman 2018-10-13 9:04 am EST
          • kwan_e 2018-10-13 10:04 am EST
          • zima 2018-10-13 1:34 pm EST
          • kwan_e 2018-10-13 3:15 pm EST
          • zima 2018-10-13 5:53 pm EST
          • Alfman 2018-10-13 6:16 pm EST
          • zima 2018-10-13 11:59 pm EST
          • kwan_e 2018-10-13 6:18 pm EST
          • Alfman 2018-10-13 6:24 pm EST
          • kwan_e 2018-10-13 6:38 pm EST
          • Alfman 2018-10-13 8:41 pm EST
          • kwan_e 2018-10-13 9:59 pm EST