DOC PREVIEW
Berkeley COMPSCI 152 - Lecture Notes

This preview shows page 1-2-3-21-22-23-42-43-44 out of 44 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 44 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 44 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 44 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 44 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 44 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 44 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 44 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 44 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 44 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 44 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 152 Computer Architecture and Engineering Lecture 22: Virtual MachinesOutlineWhat is a Virtual Machine (VM)?Software ApplicationsUser Virtual Machine = ISA + EnvironmentApplication Binary Interface (ABI)OS Can Support Multiple User VMsISA Implementations Partly in SoftwareSupporting Non-Native ISAsSoftware InterpreterSlide 11Binary TranslationBinary Translation, Take 1Binary Translation ProblemsPC Mapping TableSlide 16Binary Translation, Take 2IBM System/38 and AS/400Dynamic TranslationDynamic Binary Translation Example:ChainingCS152 AdministriviaTransmeta Crusoe (2000)Transmeta VLIW EngineCrusoe SystemTransmeta TranslationCompiler OptimizationsSchedulingTranslation OverheadExceptionsShadow Registers and Store BufferHandling Self-Modifying CodeSystem VMs: Supporting Multiple OSs on Same HardwareIntroduction to System Virtual MachinesVirtual Machine Monitors (VMMs)VMM Overhead?Other Uses of VMsRequirements of a Virtual Machine MonitorSlide 39ISA Support for Virtual MachinesImpact of VMs on Virtual MemoryISA Support for VMs & Virtual MemoryImpact of Virtualization on I/OAcknowledgementsCS 152 Computer Architecture and Engineering Lecture 22: Virtual MachinesKrste AsanovicElectrical Engineering and Computer SciencesUniversity of California, Berkeleyhttp://www.eecs.berkeley.edu/~krstehttp://inst.eecs.berkeley.edu/~cs1524/30/20092CS152-Spring’09Outline•Types of Virtual Machine–User-level–System-level•Techniques for implementing all or parts of a non-native ISA on a host machine:–Interpreter–Static binary translation–Dynamic binary translation–Hardware emulation4/30/20093CS152-Spring’09What is a Virtual Machine (VM)?•Broadest definition includes all emulation methods that provide a standard software interface, such as the Java VM (“User Virtual Machines”)•“(Operating) System Virtual Machines” provide a complete system level environment at binary ISA–Here assume ISAs always match the native hardware ISA–E.g., IBM VM/370, VMware ESX Server, and Xen–Present illusion that VM users have entire computer to themselves, including a copy of OS–Single computer runs multiple VMs, and can support a multiple, different OSes »On conventional platform, single OS “owns” all HW resources »With a VM, multiple OSes all share HW resources•Underlying HW platform is called the host, and its resources used to run guest VMs (user and/or system)4/30/20094CS152-Spring’09Software ApplicationsHow is a software application encoded?–What are you getting when you buy a software application?–What machines will it work on?–Who do you blame if it doesn’t work, i.e., what contract(s) were violated?4/30/20095CS152-Spring’09User Virtual Machine =ISA + EnvironmentISA alone not sufficient to write useful programs, need I/O•Direct access to memory mapped I/O via load/store instructions problematic–time-shared systems–portability•Operating system responsible for I/O–sharing devices and managing security–hiding different types of hardware (e.g., EIDE vs. SCSI disks)•ISA communicates with operating system through some standard mechanism, i.e., syscall instructions–example convention to open file:addi r1, r0, 27 # 27 is code for file openaddu r2, r0, rfname # r2 points to filename stringsyscall # cause trap into OS# On return from syscall, r1 holds file descriptor4/30/20096CS152-Spring’09Application Binary Interface (ABI)•Programs are usually distributed in a binary format that encodes the program text (instructions) and initial values of some data segments•Virtual machine specifications include–what state is available at process creation–which instructions are available (the ISA)–what system calls are possible (I/O, or the environment)•The ABI is a specification of the binary format used to encode programs for a virtual machine•Operating system implements the virtual machine–at process startup, OS reads the binary program, creates an environment for it, then begins to execute the code, handling traps for I/O calls, emulation, etc.4/30/20097CS152-Spring’09OS Can Support Multiple User VMs•Virtual machine features change over time with new versions of operating system–new ISA instructions added–new types of I/O are added (e.g., asynchronous file I/O)•Common to provide backwards compatibility so old binaries run on new OS–SunOS 5 (System V Release 4 Unix, Solaris) can run binaries compiled for SunOS4 (BSD-style Unix)–Windows 98 runs MS-DOS programs•If ABI needs instructions not supported by native hardware, OS can provide in software4/30/20098CS152-Spring’09ISA Implementations Partly in SoftwareOften good idea to implement part of ISA in software:•Expensive but rarely used instructions can cause trap to OS emulation routine:–e.g., decimal arithmetic instructions in MicroVax implementation of VAX ISA•Infrequent but difficult operand values can cause trap–e.g., IEEE floating-point denormals cause traps in almost all floating-point unit implementations•Old machine can trap unused opcodes, allows binaries for new ISA to run on old hardware–e.g., Sun SPARC v8 added integer multiply instructions, older v7 CPUs trap and emulate4/30/20099CS152-Spring’09Supporting Non-Native ISAsRun programs for one ISA on hardware with different ISA•Software Interpreter (OS software interprets instructions at run-time)–E.g., OS 9 for PowerPC Macs had interpreter for 68000 code•Binary Translation (convert at install and/or load time)–IBM AS/400 to modified PowerPC cores–DEC tools for VAX->MIPS->Alpha•Dynamic Translation (non-native ISA to native ISA at run time)–Sun’s HotSpot Java JIT (just-in-time) compiler–Transmeta Crusoe, x86->VLIW code morphing–OS X for Intel Macs has binary translator for PowerPC•Run-time Hardware Emulation–IBM 360 had IBM 1401 emulator in microcode–Intel Itanium converts x86 to native VLIW (two software-visible ISAs)–ARM cores support 32-bit ARM, 16-bit Thumb, and JVM (three software-visible ISAs!)4/30/200910CS152-Spring’09Software Interpreter•Fetch and decode one instruction at a time in softwareMemory image of guest VM lives in host interpreter data memoryInterpreter DataInterpreter CodeInterpreter Stackwhile(!stop){ inst = Code[PC]; PC += 4; execute(inst);}fetch-decode loopGuest ISA CodeGuest ISA DataExecutable on DiskGuest ISA CodeGuest ISA DataGuest StackLoad into interpreter process memory4/30/200911CS152-Spring’09Software Interpreter•Easy to code, small code


View Full Document

Berkeley COMPSCI 152 - Lecture Notes

Documents in this Course
Quiz 5

Quiz 5

9 pages

Memory

Memory

29 pages

Quiz 5

Quiz 5

15 pages

Memory

Memory

29 pages

Memory

Memory

35 pages

Memory

Memory

15 pages

Quiz

Quiz

6 pages

Midterm 1

Midterm 1

20 pages

Quiz

Quiz

12 pages

Memory

Memory

33 pages

Quiz

Quiz

6 pages

Homework

Homework

19 pages

Quiz

Quiz

5 pages

Memory

Memory

15 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?