Popcorn: a Replicated-Kernel OS Based on Linux
Total Page:16
File Type:pdf, Size:1020Kb
Popcorn: a replicated-kernel OS based on Linux Antonio Barbalace Binoy Ravindran David Katz Virginia Tech Virginia Tech Virginia Tech [email protected] [email protected] [email protected] Abstract machines (e.g., SGI Altix [2]). These types of multi- processor systems, formerly available only as high cost In recent years, the number of CPUs per platform has products for the HPC market, are today more affordable continuously increased, affecting almost all segments and are present in the consumer market. Because of this of the computer market. Because of this trend, many trend, many researchers have investigated the problem researchers have investigated the problem of how to of how to better scale operating systems on high core scale operating systems better on high core-count ma- count machines. While some projects have used Linux chines. While many projects have used Linux as a ve- as a vehicle for this investigation [6,7], others have pro- hicle for this investigation, others have proposed new posed new operating system (OS) designs [5]. Among OS designs. Among them, the replicated-kernel OS them, the replicated-kernel OS model has gained trac- model, specifically the multikernel, has gained traction. tion. In this paper, we present Popcorn: a replicated-kernel OS based on Linux. Popcorn boots multiple Linux ker- Linux has been extended by its large community of de- nel instances on multicore hardware, one per core or velopers to run on multiprocessor shared memory ma- group of cores. Kernels communicate to give to ap- chines. Since kernel version 2.6, preemption patches, plications the illusion that they are running on top of a ticket spinlocks, read/write locks, and read-copy-update single OS. Applications can freely migrate between ker- (RCU) have all been added. Several new techniques nels, exploiting all the hardware resources available on have also been added to improve data locality, includ- the platform, as in SMP Linux. ing per_cpu infrastructure, the NUMA-aware memory allocator, and support for scheduling domains. B. Wick- izer et al. [6] conclude that vanilla Linux, on a large- 1 Introduction core-count machine, can be made to scale for differ- ent applications if the applications are carefully written. In recent years, the number of CPUs per platform has In [7] and [12] the authors show that scalable data struc- continuously grown, affecting almost all segments of tures, specifically scalable locks, like MCS, and RCU the computer market. After it was no longer practi- balanced tree, help Linux scale better when executing cal to increase the speed of a processor by increasing select applications. its clock frequency, chip vendors shifted to exploiting parallelism in order to maintain the rising performance Although recent research has demonstrated Linux’s that consumers had come to expect. Nowadays, multiple scalability on multicore systems to some extent, and chips, each containing multiple cores, are being assem- Linux is already running on high core count machines bled into single systems. All cores, across the differ- (e.g., SGI Altix [2]) and accelerators (e.g., Intel Xeon- ent chips, share the same physical memory by means of Phi [15]), it is important to understand whether Linux cache coherency protocols. Although researchers were can be used as the basic block of a replicated-kernel OS. skeptical that cache coherence would scale [6] the multi Understanding the advantages of this OS architecture on core market continues to grow. Multi core processors Linux – not just from a scalability standpoint – is im- are ubiquitous, they can be found in embedded devices, portant to better exploit the increasingly parallel hard- like tablets, set top boxes, and mobile devices (e.g., ware that is emerging. If future processors do not pro- Exynos Octa-Core [3]), in home/office computers (e.g., vide high-performance cache coherence, Linux’s shared AMD Fusion, Intel Sandy Bridge), in high-end servers memory intensive design may become a significant per- (e.g., AMD Opteron [13], Intel Xeon [1]), and in HPC formance bottleneck [6]. • 123 • 124 • Popcorn: a replicated-kernel OS based on Linux The replicated-kernel OS approach, advanced in oper- strategically partition those resources, ensuring that par- ating systems including Hive, Barrelfish, FOS, and oth- titions do not overlap, and dedicate them to single kernel ers, is a promising way to take advantage of emerging instances. high-core count architectures. A. Baumann et al. [5] with Barrelfish introduced the term multikernel OS and To create the illusion of a single operating system on showed appealing scalability results demonstrating that top of multiple independent kernel instances we intro- their design scales as well, if not better, than SMP Linux duced an inter-kernel communication layer, on top of on selected applications up to 32 cores. A multikernel which we developed mechanisms to create a single sys- OS is an operating system that is made up of different tem image (e.g. single filesystem namespace) and inter- (micro-) kernel instances, each of which runs on a sin- kernel task migration (i.e. task and address space migra- gle core of a multi core device. Kernels communicate in tion and address space consistency). TTY and a virtual order to cooperatively maintain partially replicated OS network switch was also developed to allow for com- state. Each kernel runs directly on bare hardware, no munication between kernels. Our contribution also in- (hardware or software) virtualization layer is employed. cludes a set of user-space libraries and tools to support Because Popcorn does not adhere to such definition we Popcorn. A modified version of kexec was introduced to use the term replicated-kernel OS to identify a broader boot the environment; the util toolchain was built to cre- category of multikernels, including Popcorn. ate replicated-kernel OS configurations. MPI-Popcorn and the cthread/pomp library were introduced to sup- port MPI and OpenMP applications on Popcorn, respec- Popcorn In this paper, we present Popcorn: a tively. Here we describe Popcorn’s architecture and im- replicated-kernel OS based on Linux. Popcorn boots plementation details, in particular, the modifications that multiple Linux kernel instances on multicore hardware, we introduced into the Linux source code to implement one per core or group of cores, with kernel-private mem- the features required by a replicated-kernel OS design. ory and hardware devices. The kernel instances directly We also present initial results obtained on our proto- communicate, kernel-to-kernel, in order to maintain a type, which was developed on x86 64bit multicore hard- common OS state that is partially replicated over ev- ware. Popcorn has been evaluated through the use of ery individual kernel instance. Hardware resources (i.e., cpu/memory intensive, as well as I/O intensive work- disks, network interface cards) are fully shared amongst loads. Results are compared to results from the same the kernels. Kernel instances coordinate to maintain the workloads collected on SMP Linux and KVM. abstraction of a single operating system (single system image), enabling traditional applications to run trans- parently across kernels. Inter-kernel process and thread Document Organization We first present the existing migration are introduced to allow application threads work on the topic in Section2. We introduce our de- to transparently execute across the kernels that together sign choices and architecture in Section3, and we cover form the OS. Considering that vanilla Linux scales well the implementation details of our prototype in Section4. on a bounded number of cores, we do not put any restric- We present the experimental environment in Section5 tions on how many cores the same kernel image will run and discuss the results we obtained by running selected on. benchmarks on Popcorn against mainly vanilla Linux (called SMP Linux hereafter) in Section6. Finally, we conclude in Section7. Contributions Our primary contribution is an open- source replicated-kernel OS using Linux as its basic building block, as well as its early evaluation on a set 2 Related Work of benchmarks. To the best of our knowledge this is the first attempt in applying this design to Linux. Mul- The body of work related to our approach includes con- tiple Popcorn kernels, along with the applications that tributions in operating systems, distributed and cluster they hosts, can simultaneously populate a multi core ma- systems, and Linux design and performance measure- chine. To facilitate this, we augmented the Linux ker- ments. We leveraged ideas and experience from these nel with the ability to run within a restricted subset of different efforts in order to build on their findings and to available hardware resources (e.g. memory). We then address their limitations where possible. 2014 Linux Symposium • 125 Non-Linux based Several decades ago, Hurricane Application [22] and Hive [11] (’92 and ’95) introduced the idea of a replicated-kernel OS by means of clusters or cells (in Linux Hive) of CPUs sharing the same kernel image. This is CPU CPU CPU different from common SMP operating systems, where a single kernel image is shared by all the CPUs. While Figure 1: SMP Linux software architecture on multi these approaches were built to work on research hard- core hardware. A single kernel instance controls all ware, the multikernel model was recently revisited by hardware resources and manages all applications. Barrelfish [5] on modern multicore commodity hard- ware, with each core loading a single kernel image. A similar approach was taken by FOS [23] addressing numbers, and they do not explore the functionality of emerging high core-count architectures where computa- their solution over 4 CPUs (on the x86 architecture). tional units do not share memory. All these approaches Twin Linux was deployed on a dual-core processor. The use message passing for inter-kernel communication.