Xen – Memory Management
Virtual Execution Environments – Group 009 Department of Computer Science and Engineering at IST
Mudit Verma 2011/2012
Andr´ Amado e
This paper presents an overview of Xen’s memory management system. Keywords: Xen, memory management, virtual machine, ballooning, migration
Xen is an x86 virtual machine monitor that allows several operating systems to run in a managed manner on commodity hardware, with a minor impact on performance . It provides a virtual machine abstraction, similar to the underlying hardware, to which operating systems can be ported. In this paper we detail Xen’s memory management model focusing on the ubiquitous x86. We ﬁrst make a small introduction to some memory management fundamentals, proceed to talk about Xen’s memory management and conclude with an explanation of how it deals with memory during live migration.
may be stored back in memory. Memory management is a central piece of an operating system. To understand Xen’s memory management model we must ﬁrst be aware of how it is done in a regular operating system. Several approaches exist from a bare-machine approach to paging or segmentation . Paging consists in dividing physical memory into ﬁxed-sized blocks called frames and dividing logical memory into blocks of the same size called pages. When a process is near execution its pages are loaded into available memory frames. A page table is used to map logical memory addresses into physical memory addresses. This technique allows for the physical address space of a process to be noncontiguous solving the fragmentation problem present in other memory allocation strategies. In the segmentation approach memory is viewed as variable-sized segments instead of a linear array of bytes. The logical address space is composed by a collection of segments and external memory is subject to fragmentation. A segment table is used to translate between logical addresses and physical addresses.
Memory management overview
Xen’s memory management
The CPU can only access main memory and its own registers. It fetches instructions from memory and decodes those instructions. Once decoded more operands might have to be fetched from memory and after the instruction is executed, results 1
Xen is responsible for managing memory allocation to guests and paging and segmentation hardware. It ensures that an unprivileged guest cannot access another domain’s share of memory, thus guaranteeing isolation among them. Guests running in
HVM mode believe they are running in a regular system and as such can perform memory management as if they were not virtualized. These guests might detect that they are running in a Xen HVM domain and switch to using paravirtualized memory management for performance reasons. While in full virtualization guest OSes believe they are running on top of a real machine, in paravirtualization the guest OS understands that it is running inside a virtual machine allowing some optimizations to be made. The latter approach requires an explicit port of the operating system. Xen has two types of domains: domainO and domainU. DomainO start automatically on boot and is an OS with high privileges and direct access to physical hardware. It can be used to manage domainU OSes. DomainU is usually a modiﬁed version of a commodity operating systems though Xen also supports unmodiﬁed OSes. Ported OSes do, however, have access to Xen’s enhanced features and will be more eﬃcient than their unmodiﬁed counterparts.
its applications keep the ring 3 access. This way way the kernel and the applications do not have to be in the same protection ring. When two guest OS processes want to switch context they use page table and segmentation hypercalls and invoke Xen to switch the kernel stack pointer using the instruction stack switch(unsigned long ss, unsigned long esp) where ss is the new stack segment and esp is the...
Please join StudyMode to read the full document