system virtual machines
play

System Virtual Machines Introduction Key concepts Resource - PowerPoint PPT Presentation

System Virtual Machines Introduction Key concepts Resource virtualization processors memory I/O devices Performance issues Applications EECS 768 Virtual Machines 1 Introduction System virtual machine


  1. System Virtual Machines • Introduction • Key concepts • Resource virtualization – processors – memory – I/O devices • Performance issues • Applications EECS 768 Virtual Machines 1

  2. Introduction • System virtual machine – capable of supporting multiple system images – each guest OS manages a set of virtualized hardware resources – VMM owns the real system resources – VMM allocates resources to guest OS by partitioning or time-sharing – guest OS allocates resources to its user programs – each virtual resource may not have physical resource – see Figure 8.1 EECS 768 Virtual Machines 2

  3. Introduction (2) L i n u x W i n d o w s O S / 2 A p p l i c a t i o n A p p l i c a t i o n A p p l i c a t i o n L i n u x O S W i n d o w s O S O S / 2 O S V i r t u a l I n t e l x 8 6 V i r t u a l I n t e l x 8 6 V i r t u a l I n t e l x 8 6 I n t e l x 8 6 H a r d w a r e EECS 768 Virtual Machines 3

  4. Key Concepts • Outward appearance • State management • Resource control • Native and hosted virtual machines • Several concepts are simplifjed – same guest and host ISA – uniprocessor systems EECS 768 Virtual Machines 4

  5. Outward Appearance • Create an illusion of multiple machines. • Illusion in software – no replication of hardware resources – switch to move devices from one VM to the other • Replication of hardware resources – devices used directly by each user are replicated – rest of the hardware is shared • Hosted VM – one OS more important than the other – UI of host OS provides way to display UI of the second EECS 768 Virtual Machines 5

  6. State Management • Refers to how each individual guest state is managed by the SVM – each guest OS has an architected state – host resources may not be adequate • Fixed location for all guest state in host – VMM manages pointer and switching – indirection can be very ineffjcient (Figure 8.3a) • Copy approach – more effjcient (Figure 8.3b) – essential to allow direct execution of native code EECS 768 Virtual Machines 6

  7. State Management (2) V M M M e m o r y V M M M e m o r y R e g is t e r v a lu e s R e g is t e r P r o c e s s o r P r o c e s s o r v a lu e s f o r V M 1 f o r V M 1 R e g is t e r v a lu e s R e g i s t e r v a l u e s f o r V M 2 P r o c e s s o r f o r V M 2 R e g is t e r B lo c k R e g is t e r s P o i n t e r R e g i s t e r R e g is t e r v a lu e s v a l u e s f o r V M 3 f o r V M 3 EECS 768 Virtual Machines 7

  8. Resource Control • Refers to how the VMM maintains overall control of all hardware resources. • Scheme similar to time-sharing OS – VMM intercept accesses to privileged resources – get control on all privileged instructions – VMM handles the timer interrupt (Figure 8.4) – similar tradeofgs between fair scheduling and large switching overhead EECS 768 Virtual Machines 8

  9. VMM Timesharing • VMM timeshares resources among guests – similar to OS timesharing V M M V M M r e s t o r e s d e t e r m i n e s n e x t a r c h i t e c t e d s t a t e V M t o b e f o r n e x t V M V M M s e t s t i m e r a c t i v a t e d V M M s e t s P C t o t i m e r i n t e r v a l a n d V M M s a v e s T i m e r i n t e r r u p t i n t e r r u p t h a n d l e r o f O S a r c h i t e c t e d s t a t e e n a b l e s o c c u r s i n n e x t V M i n t e r r u p t s o f r u n n i n g V M F i r s t V M A c t i v e V M M A c t i v e N e x t V M A c t i v e EECS 768 Virtual Machines 9

  10. Native and Hosted VM • Refers to the runtime privilege level of the VMM (and OS). – for effjciency, some part of VMM should have higher privileges • Figure 8.5 – analogous relationship to OS and user programs – native VM system: only the VMM operates in privilege mode – hosted VM: VMM installed on top of existing OS • some or no part of VMM in privilege mode EECS 768 Virtual Machines 10

  11. Native and Hosted VM (2) V i r t u a l V i r t u a l M a c h i n e M a c h i n e V i r t u a l N o n - p r i v i l e g e d A p p l i c a t i o n s M a c h i n e m o d e s V M M V M M P r i v i l e g e d O S V M M H o s t O S H o s t O S M o d e H a r d w a r e H a r d w a r e H a r d w a r e H a r d w a r e T r a d i t i o n a l N a t i v e U s e r - m o d e D u a l - m o d e u n i p r o c e s s o r V M s y s t e m H o s t e d H o s t e d s y s t e m V M s y s t e m V M s y s t e m EECS 768 Virtual Machines 11

  12. Resource Virtualization – Processors • T echniques to execute guest instructions – emulation – direct native execution • Emulation – interpretation or binary translation – necessary if difgerent host and guest ISAs • Direct native execution – same host and guest ISAs required – may still require emulation of some instructions EECS 768 Virtual Machines 12

  13. Conditions for ISA Virtualizability • Conditions laid out by Popek and Goldberg. • Assume native system VMs – VMM runs in system mode – all other software runs in user mode • Other assumptions – hardware consists of processor and uniformly addressable memory – processor can operate in two modes, user and system – some subset of instructions only available in system mode – relocation register available for memory addressing EECS 768 Virtual Machines 13

  14. Privileged Instructions • Instructions that trap if the machine is in user mode, and does not trap if the machine is in system mode. • LPSW (Load Processor Status Word) – PSW can change the state of the CPU – can also change the instruction address (PC) • SPT (Set CPU Timer) – can change the CPU interval timer EECS 768 Virtual Machines 14

  15. Privileged Instructions (cont…) • LRW (Load Real Address) – translate a virtual address, save corresponding real address in a specifjed GPR • POPF (Pop Stack into Flags Register) – replace fmag register with top of memory stack – interrupt-enable fmag can only be modifjed in system mode – no trap in user mode EECS 768 Virtual Machines 15

  16. Sensitive Instructions • These specify instructions that interact with hardware. • Control-sensitive instructions – can change the confjguration of system resources – e.g., physical memory assigned to a program – e.g., LPSW – change mode of operation – e.g., SPT – change CPU timer value EECS 768 Virtual Machines 16

  17. Sensitive Instructions (cont…) • Behavior-sensitive instructions – behavior or results depend on confjguration of resources – e.g., LRA – depends on mapping (state) of real memory resource – e.g., POPF – depends on mode of operation • Innocuous instructions – neither context-sensitive nor behavior- sensitive • see Figure 8.6 EECS 768 Virtual Machines 17

  18. Instruction T ypes – Summary N o n - P r i v i l e g e d I n n o c u o u s P r i v i l e g e d S e n s i t i v e B e h a v i o r - S e n s i t i v e C o n t r o l - s e n s i t i v e s e n s i t i v e EECS 768 Virtual Machines 18

  19. Components of a VMM I n s t r u c t i o n t r a p o c c u r s T h e s e i n s t r u c t i o n s D i s p a t c h e r d e s i r e t o c h a n g e P r i v i l e g e d m a c h i n e r e s o u r c e s , I n s t r u c t i o n e . g . L o a d R e l o c a t i o n B o u n d s R e g i s t e r P r i v i l e g e d P r i v i l e g e d I n t e r p r e t e r I n s t r u c t i o n I n s t r u c t i o n R o u t i n e 1 A l l o c a t o r P r i v i l e g e d I n s t r u c t i o n I n t e r p r e t e r R o u t i n e 2 T h e s e i n s t r u c t i o n s d o n o t c h a n g e m a c h i n e r e s o u r c e s , b u t a c c e s s p r i v i l e g e d I n t e r p r e t e r r e s o u r c e s , e . g . I N , O U T , R o u t i n e n W r i t e T L B EECS 768 Virtual Machines 19

  20. Components of a VMM (2) • Dispatcher – control module, called on hardware traps – decides the next module to be invoked • Allocator – decides allocation of system resources – invoked by dispatcher to change machine resource allocation for VMs • Interpreter routines – emulates trap functionality for each user VM – all traps except resource re-assignment traps EECS 768 Virtual Machines 20

  21. Properties for a True VMM • Effjciency – All innocuous instructions must be natively executed • Resource control – impossible for guest s/w to directly change system resource confjgurations • Equivalence – guaranty of identical behavior – allowed exceptions • performance can be slower • available resources can be limited • difgerences in performance due to changed timings EECS 768 Virtual Machines 21

  22. Requirement for True VMM • For any third-generation computer, a VMM may be constructed if the set of sensitive instructions for a computer is a subset of the set of privileged instructions – sensitive instructions always trap in user mode – non-privileged instructions execute natively EECS 768 Virtual Machines 22

Recommend


More recommend