Operating Systems Design (CS 423)

Slides:



Advertisements
Similar presentations
4/14/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
Advertisements

ISA Issues; Performance Considerations. Testing / System Verilog: ECE385.
Chapter 2 Machine Language.
ELEN 468 Advanced Logic Design
1 COMS 361 Computer Organization Title: Instructions Date: 9/28/2004 Lecture Number: 10.
1 RISC Pipeline Han Wang CS3410, Spring 2010 Computer Science Cornell University See: P&H Chapter 4.6.
Chapter 2 Machine Language. Machine language The only language a computer can understand directly. Each type of computer has its own unique machine language.
Computer Architecture Pipelines Diagrams are from Computer Architecture: A Quantitative Approach, 2nd, Hennessy and Patterson.
Lec 8: Pipelining Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University.
Operating System Support for Virtual Machines Sam King George Dunlap Peter Chen CoVirt Project, University of Michigan.
Virtual Machine Monitors CSE451 Andrew Whitaker. Hardware Virtualization Running multiple operating systems on a single physical machine Examples:  VMWare,
Instruction Set Architecture
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Operating System Support for Virtual Machines Sam King George Dunlap Peter Chen CoVirt Project, University of Michigan.
Lecture 5: Pipelining Implementation Kai Bu
PA0 due 60 hours. Lecture 4 Memory Management OSTEP Virtualization CPU: illusion of private CPU RAM: illusion of private memory Concurrency Persistence.
1 Instruction Set Architecture (ISA) Alexander Titov 10/20/2012.
CBP 2009Comp 3014 The Nature of Computing 1 Choices in Designing an ISA Uniformity. Should each instruction –Be the same length (in bits or bytes?) –Take.
 Virtual machine systems: simulators for multiple copies of a machine on itself.  Virtual machine (VM): the simulated machine.  Virtual machine monitor.
CS.305 Computer Architecture Enhancing Performance with Pipelining Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from.
12/5/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
1 Pipelining Part I CS What is Pipelining? Like an Automobile Assembly Line for Instructions –Each step does a little job of processing the instruction.
Constructive Computer Architecture Interrupts/Exceptions/Faults Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology.
Lecture 26 Virtual Machine Monitors. Virtual Machines Goal: run an guest OS over an host OS Who has done this? Why might it be useful? Examples: Vmware,
Lecture 12 Virtualization Overview 1 Dec. 1, 2015 Prof. Kyu Ho Park “Understanding Full Virtualization, Paravirtualization, and Hardware Assist”, White.
Our programmer needs to do this !
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
Genesis: From Raw Hardware to Processes Andy Wang Operating Systems COP 4610 / CGS 5765.
1/31/20161 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
3/17/20161 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
6/13/20161 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
6/22/20161 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
Embedded Real-Time Systems
10/2/20161 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
Virtual Machine Monitors
MIPS Assembly.
CS161 – Design and Architecture of Computer Systems
Immediate Addressing Mode
COMPUTER ARCHITECTURE & OPERATIONS I
Operating Systems Design (CS 423)
Choices in Designing an ISA
ELEN 468 Advanced Logic Design
CMSC 611: Advanced Computer Architecture
Lecture 24 Virtual Machine Monitors
Overview Introduction General Register Organization Stack Organization
Processor Architecture: Introduction to RISC Datapath (MIPS and Nios II) CSCE 230.
Morgan Kaufmann Publishers
School of Computing and Informatics Arizona State University
Defending against malicious hardware
Introduction to Operating Systems
Instructions - Type and Format
RISC-V Instruction Set Architecture (ISA)
Lecture 4: MIPS Instruction Set
CSCI206 - Computer Organization & Programming
Genesis: From Raw Hardware to Processes
Operating System Support for Virtual Machines
An Introduction to pipelining
PZ01C - Machine architecture
Guest Lecturer TA: Shreyas Chand
Classification of instructions
Systems Architecture I
Introduction to Microprocessor Programming
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
Pipelining Appendix A and Chapter 3.
Lecture 06: Pipelining Implementation
Xen and the Art of Virtualization
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
Format 1 (call) disp30 op Format 2a (sethi, nop) imm22 op rd op2
Advanced OS COMP 755.
Presentation transcript:

Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC http://www.cs.illinois.edu/class/cs423/ Based on slides by Roy Campbell, Sam King, and Andrew S Tanenbaum 7/2/2018

Goldberg ‘74 A virtual machine is… “an efficient, isolated, duplicate of the real machine” VM environment created by VMM Guest == virtual Guest OS and apps run INSIDE a VM Guest OS runs ABOVE a VMM Host == physical 7/2/2018

VMM environment Duplicate Efficient Isolated Virtual machine == physical machine Efficient Runs almost as fast as real machine Isolated VMM has control over resources What are the resources the VMM controls? 7/2/2018

VMM control and isolation Guest software can only access resources allocated to it VMM can reclaim resources E.g., More guest physical mem than phys mem 7/2/2018

VMM research Record and replay Migration Security Debugging OSes Moka5 user convenience, VMmotion for reliability Security NSA NetTop Isolated email and browser Intrusion detection 7/2/2018

VMM as Simulators “A computer is a large state machine” Simulator state is easy to work with Instruction‐by‐instruction simulation is slow 7/2/2018

VMM is a simulator Simulator is software that simulates the execution of a computer while(1){ inst = mem[PC]; // fetch if(inst == add) { // decode// execute reg[inst.reg1] = reg[inst.reg2] + reg[inst.reg3]; PC++; } else if ... } // repeat 7/2/2018

Simulator Disk  file Memory  stack Display  window 7/2/2018

Simulation Lots of real instructions for single virtual instruction Many instructions more complicated Update condition codes Memory loads / stores Exceptions Question: how can we make this fast? First, get a simulator … 7/2/2018

Our Sparc Simulator 32 registers R0 is always 0 RISC architecture Load/store only instructions to access memory Around 75 instructions total 7/2/2018

Our Sparc simulator Simplified, no register windows No npc, a few other registers missing Does use branch delay slots Assume underlying endianess is same as simulated endianess Modified sparc binary to little endian 7/2/2018

Code from Sam King typedef uint32_t u32; typedef int32_t i32; // Visible state of CPU struct CPU { u32 regs[NUM_REGS]; u32 pc; bool icc_z; bool icc_n; }; 7/2/2018

Code from Sam King struct control_signals { u32 op; u32 rd; u32 cond; u32 op2; u32 op3; u32 rs1; u32 i; u32 asi; i32 simm; u32 imm; u32 disp22; u32 disp30; u32 rs2; u32 raw; }; 7/2/2018

Sparc Simulator – Sam King int main(int argc, char *argv[]) { ifstream infile; struct CPU *cpu; … signal(SIGINT, ctrlC); // initialize our state ram = new uint8_t[RAM_SIZE]; 7/2/2018

Sparc Simulator – Sam King cpu = new struct CPU; for(int idx = 0; idx < NUM_REGS; idx++) { cpu->regs[idx] = 0; } cpu->pc = 0; // setup the stack pointer cpu->regs[14] = RAM_SIZE-4-120; // setup the fib program cpu->regs[8] = RAM_SIZE-4; 7/2/2018

Sparc Simulator – Sam King // fetch our memory image and cpu state (if set) fillState(argv[1], ram, RAM_SIZE); if(argc >= 3) { fillState(argv[2], cpu, sizeof(struct CPU)); } startTime = time(NULL); cpu_exec(cpu); // Starts with fetch return 0; 7/2/2018

Task 1: Implement fetch u32 fetch(struct CPU */*cpu*/) { u32 opcode = 0; // XXX FILL THIS IN return opcode; } 7/2/2018

Task 1: Implement fetch u32 fetch(struct CPU */*cpu*/) { u32 opcode = 0; assert((cpu->pc & 0x3) == 0); assert(cpu->pc < RAM_SIZE); memcpy(&opcode, ram+cpu->pc, sizeof(opcode)); //ram pointer to 8 bit valiue; opcode 32 bit return opcode; } 7/2/2018

Task 2: Implement exec Decode instructions Update register state Update pc state Note: r0 is always 0! Note: advancing the pc in nonbranch pc+=4 7/2/2018

Sparc instruction format 7/2/2018

Add format 7/2/2018

Addi r[rd]=r[rs1]+sign_ext(simm13) void addi(struct CPU *cpu, u32 rd, u32 rs1, i32 signedImm) { cpu->regs[rd] = cpu->regs[rs1] + signedImm; 7/2/2018

Task 2: Implement exec Decode instructions Update register state Update pc state Note: r0 is always 0! Note: advancing the pc in nonbranch pc+=4 7/2/2018