Operating Systems and Interrupts/Exceptions
|
|
- Douglas Freeman
- 6 years ago
- Views:
Transcription
1 Operating Systems and Interrupts/Exceptions Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Code for the lecture is available on the course website under the code tab April 10, L15-1
2 Operating Systems application application Operating system Hardware Application binary interface (ABI) Supervisor binary interface (SBI) Modern processors cannot function without some resident programs ( services ), which are shared by all users Services: programs for accessing I/O devices like, keyboard, mouse, display, disks, printers, network,... I/O devices have very long access latency as compared to registers and memories (milliseconds as opposed to microseconds) For efficiency, it is common to employ multiprogramming and switch to another task while waiting for an I/O operation to complete This creates a host of new problems April 10, L15-2
3 Multiprogrammed Systems Protection & Privacy Each program (user) has a private address space and a way of accessing OS which is shared by all programs The OS ensures that a program cannot access the address space of any other program Scheduling OS multiplexes the use of CPU among programs; only one program can be active at a given time Resource management OS also manages access to all other shared resources, e.g., I/O devices OS prog i In the jargon we use the word process instead of program April 10, L15-3
4 Process Life Cycle completed process created ready executing waiting scheduled interrupted woken-up OS maintains a list of all processes and their status {ready, executing, waiting} a process is scheduled to run for a specified amount of CPU time or until completion process is interrupted if it needs I/O service or runs out of allotted time slice, and is put in the sleep/waiting state another process can be scheduled a waiting process is woken up and put in the ready list when waiting-condition has been satisfied April 10, L15-4
5 Physical Memory Private Address Space per Process 0 n Process1 OS pages 0 m Process2 free Each process is allocated space in the memory by OS A process is not allowed to access memory of other processes or OS It is convenient if the program and data addresses don t depend upon where the process is allocated in the memory free free free free April 3, L14-5
6 Mirrage Main Memory Simple dynamic address Translation much more on dynamic address translation in L16 Bound Reg Bound Violation Base Reg Load X Effective + Address Program Address Space Physical Address Effective address is translated into a physical address at run time Base register has to be reloaded by the OS every time the active process changes Bound register can provide safety and isolation User Program & Data Load X Base and Bound registers should not be accessed by user programs user mode versus supervisor mode
7 Communicating with I/O devices We have a set of I/O registers (different from GPRs) which both the I/O devices and the CPU can read and write CPU can be read I/O registers in two different ways: Polling: It periodically reads the register associated with a specific device Interrupt: The I/O device can write the register and then interrupt the processor (i.e., ring the door bell!). Often these registers are mapped to specific memory addresses (Memory-Mapped I/O), some of which can be accessed only in the supervisor mode Some care has to be exercised in address translation while accessing MMIO locations We need a general framework and addressing mapping conventions to deal with a plethora of I/O devices more general way April 10, L15-7
8 ISA Extensions to support OS In RISC-V all special registers needed to implement an OS are collectively referred to as CSRs (Control and Status Registers) we will introduce them as needed The instructions to access CSRs are atomic, i.e., they perform a read followed by a write csrrw (read-write), csrrs (read-set specified bits to 1), csrrc (read-clear specified bits to 0) Almost all services we built require a mechanism to stop the program at a specific instruction under a variety of conditions and the transfer control to an OS routine to deal with that specific condition These ISA extensions work only if hardware and software (OS) agree on a common set of conventions April 10, L15-8
9 Interrupt (aka Trap) altering the normal flow of control I i-1 HI 1 program I i HI 2 interrupt handler I i+1 HI n An external or internal event that needs to be processed by another (system) program. The event is usually unexpected or rare from program s point of view. April 10, L15-9
10 Interrupts caused by an external event External asynchronous event input/output device service-request/response timer expiration power disruptions, hardware failure After the processor decides to process the interrupt It stops the current program at instruction I i, completing all the instructions up to I i-1 (Precise interrupt) It saves the PC of instruction I i in a special register It disables interrupts and transfers control to a designated interrupt handler running in more privileged mode Switch from user mode to supervisor mode prevents user programs from causing harm to other users or OS April 10, L15-10
11 Exceptions caused by the execution of an instruction The instruction cannot be completed undefined opcode, privileged instruction arithmetic overflow, FPU exception misaligned memory access virtual memory exceptions: page faults, TLB misses, protection violations System call: Deliberately used by the programmer to invoke an OS service next lecture Either the faulting condition is fixed; or the instruction is emulated by the exception handler; or the program is aborted The processor must undo any partial execution of the instruction and record the cause of the exception April 10, L15-11
12 Trap (Interrupt or Exception) handling When an trap is caused Hardware saves the information about the interrupt in CSRs: mepc exception PC mcause cause of the exception mstatus.mpp privilege mode of exception... Processor jumps to the address of the trap handler (stored in the mtvec CSR) and increases the privilege level A trap handler, a software program, takes over and performs the necessary action April 10, L15-12
13 Trap handling software There is a great variety of interrupts and exceptions and each has to be handled differently Hardware transfers all traps to a program known as the common interrupt handler (CH) It saves registers in a known place and transfers control to a specific Interrupt handler (IH) If the trap has been handled successfully, IH returns the control back to CH, which restores the registers and resumes the interrupted program Typically CH is written in Assembler but IH s are written in C April 10, L15-13
14 Outline of Common Interrupt Handler (CH) 1. Saves all GPRs (x0-x31) into known memory locations 2. Passes mcause, mepc, stack pointer to the IH (a C function) to handle the specific interrupt mcause, mepc, etc are loaded by hardware 3. On the return from the IH, writes the return value to mepc 4. Loads all GPRs from the memory 5. Execute mret, which does: set pc to mepc a new pop mstatus (mode, enable) stack instruction CH GPR IH IH IH April 10, L15-14
15 Common Interrupt Handler- SW (RISC-V Assembly code) common_handler: # entry point for exception handler # save x1 to mscratch to free up a register csrw mscratch, x1 # write x1 to mscratch # get the pointer for storing GPRs li x1, GPR_BASE # save x2 - x31 sw x2, 8(x1) sw x3, 12(x1)... sw x31, 124(x1) # now registers x2 x31 are free # save original x1 (now in mscratch) csrr x2, mscratch # x2 used as temporary register sw x2, 4(x1) # x1 still points to GPR storage April 10, L15-15
16 Common handler- SW cont. Setting up and calling IH_Dispacher common_handler:... # we have saved all GPRs to stack # call C function to handle interrupt csrr a0, mcause # arg 0: cause csrr a1, mepc # arg 1: epc li a2, GPR_BASE # arg 2: pointer to all saved GPRs... # set up stack pointer for C-code jal ih_dispatcher # calls ih_dispatcher which may # have been written in C # return value is the PC to resume csrw mepc, a0 # restore mscratch and all GPRs li x1, GPR_BASE; lw x2, 8(x1); lw x3, 12(x1);...; lw x31, 124(x1) lw x1, 4(x1) # restore x1 last mret # finish handling interrupt April 10, L15-16
17 IH Dispatcher (in C) Dispatches to a specific handler based on cause Remember, before we call ih_dispatcher, we know the cause, epc, and have a pointer to where the registers (x1-x31) have been saved. (C can be used because of calling conventions) long ih_dispatcher(long cause, long epc, long *regs) { // regs[i] refers to GPR xi stored in stack if(cause == 0x02) // illegal instruction return illegal_ih(cause, epc, regs); else if(cause == 0x08) // system call, e.g, OS service write to file return syscall_ih(cause, epc, regs); else if (cause == 0x0D) // load address translation fault else if (cause < 0) // external interrupt... } Key board handler in Recitation on Friday As an example we show an interrupt handler to implement multiply instruction in Software April 10, L15-17
18 Multiply mul x1, x2, x3 is an instruction in the M extension (x1 := x2 * x3) If M is not implemented, this is an illegal instruction What happens if we run code from an RV32IM machine on an RV32I machine? mul causes an illegal instruction exception An exception handler can take over and abort the program or emulate the instruction April 10, L15-18
19 SW emulation of MULT instruction mul rd, rs1, rs2 MUL can be decoded as an unsupported instruction in the decoder It will throw an Illegal Instruction exception when executed Illegal Instruction handler illegal_inst_ih checks if the interrupted instruction is a MUL and if it is then it simply calls the code that emulates the multiply function Control is resumed to epc + 4 after emulation is done (MRET) April 10, L15-19
20 Illegal Instruction IH (in C) long illegal_inst_ih(long cause, long epc, long *regs) { uint32_t inst = *((uint32_t*)epc); // fetch inst // check opcode & function codes if((inst & MASK_MUL) == MATCH_MUL) { // is MUL, extract rd, rs1, rs2 from inst int rd = (inst >> 7) & 0x01F; int rs1 =...; int rs2 =...; // emulate regs[rd] = regs[rs1] * regs[rs2] multiply(rd, rs1, rs2, regs); return epc + 4; // done, resume at epc+4 } else abort(); } Multicycle-cycle implementation of Interrupts : the next few slides Optional April 10, L15-20
21 Decode function DecodedInst decode(data inst, Mode mode); DecodedInst dinst =?;... opsystem: begin case (funct3)... fnpriv: begin // privilege inst dinst.itype = case(inst[31:20]) fn12ecall: SYSCALL; // sys call // MRET can only be executed under a privileged mode fn12mret: ispriv(mode)? MRET : NoPermit;... default: Unsupported; endcase; dinst.dst = Invalid; dinst.rs1 =?; dinst.rs2 =?; dinst.imm =?; dinst.alufunc =?; dinst.brfunc =?; end... endcase... return dinst; endfunction end typedef enum {OP,..., SYSCALL, MRET, NoPermit} IType April 10, L15-21
22 Add Execute code for setting CSRs... if (einst.itype==syscall) begin csrf.setstatus(statuspush(csrf.getstatus)); csrf.setcause(32 h08); // cause for System call csrf.setepc(pc); end else if (einst.itype==mret) begin csrf.setstatus(statuspop(csrf.getstatus)); end April 10, L15-22
23 Redirecting PC if (einst.itype==syscall) pc <= csrf.gettvec; else if (einst.itype==mret) pc <= csrf.getepc; else pc <= einst.brtaken? einst.addr : pc + 4; Interrupt redirection is done from the last stage; speed is not a paramount concern in hardware handling of interrupts April 10, L15-23
24 Saving GPRs a small complication optional another CSR Operating system manages the space where GPRs are saved and provides a pointer to the space for the current program For simplicity we ll assume this location is fixed at GPR_BASE RISC-V s memory instructions require the base address to be stored in a GPR Therefore before GPRs can be saved, we need to free up a GPR (say x1) by storing its value in a special scratch register (mscratch) After saving the other GPRs, they (??) are freed up Finally, x1 is restored from mscratch and saved April 10, L15-24
Operating Systems: Virtual Machines & Exceptions
Operating Systems: Machines & Exceptions Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. L19-1 6.004 So Far: Single-User Machines Program Hardware ISA (e.g., RISC-V) Processor Memory
More informationExamples of IO, Interrupts, and Exceptions
Examples of IO, Interrupts, and Exceptions Andy Wright, Thomas Bourgeat, Silvina Hanono Wachman Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology L15-1 Keyboard Input
More informationVirtual Memory and Interrupts
Constructive Computer Architecture Virtual Memory and Interrupts Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology November 13, 2015 http://csg.csail.mit.edu/6.175
More informationInterrupts/Exceptions/Faults
Constructive Computer Architecture Interrupts/Exceptions/Faults Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology November 6, 2013 http://csg.csail.mit.edu/6.s195
More informationPOLITECNICO DI MILANO. Exception handling. Donatella Sciuto:
POLITECNICO DI MILANO Exception handling Donatella Sciuto: donatella.sciuto@polimi.it Interrupts: altering the normal flow of control I i-1 HI 1 program I i HI 2 interrupt handler I i+1 HI n An external
More information1 /20 2 /18 3 /20 4 /18 5 /24
M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.S084 Computation Structures Spring 2018 1 /20 2 /18 3 /20 4 /18 5 /24 Practice
More information1 /20 2 /18 3 /20 4 /18 5 /24
M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.S084 Computation Structures Spring 2018 1 /20 2 /18 3 /20 4 /18 5 /24 Practice
More informationEC 513 Computer Architecture
EC 513 Computer Architecture Single-cycle ISA Implementation Prof. Michel A. Kinsy Computer System View Processor Applications Compiler Firmware ISA Memory organization Digital Design Circuit Design Operating
More informationLast 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture
Last 2 Classes: Introduction to Operating Systems & C++ tutorial User apps OS Virtual machine interface hardware physical machine interface An operating system is the interface between the user and the
More informationLecture 11: Interrupt and Exception. James C. Hoe Department of ECE Carnegie Mellon University
18 447 Lecture 11: Interrupt and Exception James C. Hoe Department of ECE Carnegie Mellon University 18 447 S18 L11 S1, James C. Hoe, CMU/ECE/CALCM, 2018 Your goal today Housekeeping first peek outside
More informationOperating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst
Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Last Class: Intro to OS An operating system is the interface between the user and the architecture. User-level Applications
More informationEE 457 Unit 8. Exceptions What Happens When Things Go Wrong
1 EE 457 Unit 8 Exceptions What Happens When Things Go Wrong 2 What are Exceptions? Exceptions are rare events triggered by the hardware and forcing the processor to execute a software handler HW Interrupts
More informationWhat are Exceptions? EE 457 Unit 8. Exception Processing. Exception Examples 1. Exceptions What Happens When Things Go Wrong
8. 8.2 What are Exceptions? EE 457 Unit 8 Exceptions What Happens When Things Go Wrong Exceptions are rare events triggered by the hardware and forcing the processor to execute a software handler Similar
More informationInf2C - Computer Systems Lecture 16 Exceptions and Processor Management
Inf2C - Computer Systems Lecture 16 Exceptions and Processor Management Boris Grot School of Informatics University of Edinburgh Class party! When: Friday, Dec 1 @ 8pm Where: Bar 50 on Cowgate Inf2C Computer
More informationNon-Pipelined Processors - 2
Constructive Computer Architecture: Non-Pipelined Processors - 2 Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology October 4, 2017 http://csg.csail.mit.edu/6.175
More informationCSE 153 Design of Operating Systems Fall 18
CSE 153 Design of Operating Systems Fall 18 Lecture 2: OS model and Architectural Support Last time/today l Historic evolution of Operating Systems (and computing!) l Today: We start our journey in exploring
More informationThere are different characteristics for exceptions. They are as follows:
e-pg PATHSHALA- Computer Science Computer Architecture Module 15 Exception handling and floating point pipelines The objectives of this module are to discuss about exceptions and look at how the MIPS architecture
More informationCSE 153 Design of Operating Systems
CSE 153 Design of Operating Systems Winter 19 Lecture 3: OS model and Architectural Support Last time/today Historic evolution of Operating Systems (and computing!) Today: We start our journey in exploring
More informationInstruction Set Architecture of MIPS Processor
CSE 3421/5421: Introduction to Computer Architecture Instruction Set Architecture of MIPS Processor Presentation B Study: 2.1 2.3, 2.4 2.7, 2.10 and Handout MIPS Instructions: 32-bit Core Subset Read:
More informationSyscalls, exceptions, and interrupts, oh my!
Syscalls, exceptions, and interrupts, oh my! Hakim Weatherspoon CS 3410 Computer Science Cornell University [Altinbuken, Weatherspoon, Bala, Bracy, McKee, and Sirer] Announcements P4-Buffer Overflow is
More informationFast Interrupts. Krste Asanovic, UC Berkeley / SiFive Inc. (Chair) Kevin Chen, Andes (Vice-Chair)
Fast Interrupts Krste Asanovic, UC Berkeley / SiFive Inc. (Chair) Kevin Chen, Andes (Vice-Chair) 8 th RISC-V Workshop Barcelona Supercomputer Center, Barcelona, Spain May 9, 2018 RISC-V for Embedded Embedded
More information1 /15 2 /20 3 /20 4 /25 5 /20
M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.S084 Computation Structures Spring 2018 1 /15 2 /20 3 /20 4 /25 5 /20 Quiz
More informationNon-Pipelined Processors
Constructive Computer Architecture: Non-Pipelined Processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology L10-1 Single-Cycle RISC Processor As an illustrative
More informationInitial Representation Finite State Diagram. Logic Representation Logic Equations
Control Implementation Alternatives Control may be designed using one of several initial representations. The choice of sequence control, and how logic is represented, can then be determined independently;
More informationCMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013
CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013 TOPICS TODAY I/O Architectures Interrupts Exceptions FETCH EXECUTE CYCLE 1.7 The von Neumann Model This is a general
More informationCISC 662 Graduate Computer Architecture Lecture 7 - Multi-cycles. Interrupts and Exceptions. Device Interrupt (Say, arrival of network message)
CISC 662 Graduate Computer Architecture Lecture 7 - Multi-cycles Michela Taufer Interrupts and Exceptions http://www.cis.udel.edu/~taufer/teaching/cis662f07 Powerpoint Lecture Notes from John Hennessy
More informationCPS104 Computer Organization and Programming Lecture 17: Interrupts and Exceptions. Interrupts Exceptions and Traps. Visualizing an Interrupt
CPS104 Computer Organization and Programming Lecture 17: Interrupts and Exceptions Robert Wagner cps 104 Int.1 RW Fall 2000 Interrupts Exceptions and Traps Interrupts, Exceptions and Traps are asynchronous
More informationCISC 662 Graduate Computer Architecture Lecture 7 - Multi-cycles
CISC 662 Graduate Computer Architecture Lecture 7 - Multi-cycles Michela Taufer http://www.cis.udel.edu/~taufer/teaching/cis662f07 Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer
More informationece4750-tinyrv-isa.txt
========================================================================== Tiny RISC-V Instruction Set Architecture ========================================================================== # Author :
More information11/13/17. CS61C so far. Adding I/O C Programs. So How is a Laptop Any Different? It s a Real Computer! Raspberry Pi (Less than $40 on Amazon in 2017)
11/14/17 CS61C so far CS 61C: Great Ideas in Computer Architecture C Programs #include MIPS Assembly Project 2 int fib(int n) { return fib(n-1) + fib(n-2); }.foo lw $t0, 4($r0) addi $t1, $t0,
More informationNon-Pipelined Processors
Constructive Computer Architecture: Non-Pipelined Processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology September 29, 2014 http://csg.csail.mit.edu/6.175
More informationCOS 318: Operating Systems
COS 318: Operating Systems OS Structures and System Calls Prof. Margaret Martonosi Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall11/cos318/ Outline Protection
More informationCS 201. Exceptions and Processes. Gerson Robboy Portland State University
CS 201 Exceptions and Processes Gerson Robboy Portland State University Control Flow Computers Do One Thing From startup to shutdown, a CPU reads and executes (interprets) a sequence of instructions, one
More informationAnne Bracy CS 3410 Computer Science Cornell University
Anne Bracy CS 3410 Computer Science Cornell University The slides were originally created by Deniz ALTINBUKEN. P&H Chapter 4.9, pages 445 452, appendix A.7 Manages all of the software and hardware on the
More informationCS 61C: Great Ideas in Computer Architecture Virtual Memory. Instructors: John Wawrzynek & Vladimir Stojanovic
CS 61C: Great Ideas in Computer Architecture Virtual Memory Instructors: John Wawrzynek & Vladimir Stojanovic http://inst.eecs.berkeley.edu/~cs61c/ 1 Review Programmed I/O Polling vs. Interrupts Booting
More informationInstruction Set Architecture
Computer Architecture Instruction Set Architecture Lynn Choi Korea University Machine Language Programming language High-level programming languages Procedural languages: C, PASCAL, FORTRAN Object-oriented
More informationCS 61C: Great Ideas in Computer Architecture. Lecture 22: Operating Systems. Krste Asanović & Randy H. Katz
CS 61C: Great Ideas in Computer Architecture Lecture 22: Operating Systems Krste Asanović & Randy H. Katz http://inst.eecs.berkeley.edu/~cs61c/fa17 1 CPU Project 2 CS61C so far MIPS Assembly.foo lw $t0,
More informationHakim Weatherspoon CS 3410 Computer Science Cornell University
Hakim Weatherspoon CS 3410 Computer Science Cornell University The slides are the product of many rounds of teaching CS 3410 by Deniz Altinbuken, Professors Weatherspoon, Bala, Bracy, and Sirer. C practice
More informationException Handling. Precise Exception Handling. Exception Types. Exception Handling Terminology
Precise Handling CprE 581 Computer Systems Architecture Reading: Textbook, Appendix A Handling I/O Internal s Arithmetic overflow Illegal Instruction Memory Address s Protection violation Data alignment
More informationNon-pipelined Multicycle processors
Non-pipelined Multicycle processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Code for the lecture is available on the course website under the code tab
More informationNotes Interrupts and Exceptions. The book uses exception as a general term for all interrupts...
08 1 Interrupts and Exceptions 08 1 Notes The book uses exception as a general term for all interrupts...... in these notes interrupt is used as the general term...... and a narrower definition is used
More informationLecture 10 Exceptions and Interrupts. How are exceptions generated?
Lecture 10 Exceptions and Interrupts The ARM processor can work in one of many operating modes. So far we have only considered user mode, which is the "normal" mode of operation. The processor can also
More informationAppendix C: Pipelining: Basic and Intermediate Concepts
Appendix C: Pipelining: Basic and Intermediate Concepts Key ideas and simple pipeline (Section C.1) Hazards (Sections C.2 and C.3) Structural hazards Data hazards Control hazards Exceptions (Section C.4)
More informationInterrupts Peter Rounce
Interrupts Peter Rounce P.Rounce@cs.ucl.ac.uk 22/11/2011 11-GC03 Interrupts 1 INTERRUPTS An interrupt is a signal to the CPU from hardware external to the CPU that indicates than some event has occured,
More informationLecture 2: Architectural Support for OSes
Lecture 2: Architectural Support for OSes CSE 120: Principles of Operating Systems Alex C. Snoeren HW 1 Due Tuesday 10/03 Why Architecture? Operating systems mediate between applications and the physical
More informationProtection and System Calls. Otto J. Anshus
Protection and System Calls Otto J. Anshus Protection Issues CPU protection Prevent a user from using the CPU for too long Throughput of jobs, and response time to events (incl. user interactive response
More informationELEC / Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2)
ELEC 5200-001/6200-001 Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2) Victor P. Nelson, Professor & Asst. Chair Vishwani D. Agrawal, James J. Danaher Professor Department
More informationECE 250 / CPS 250 Computer Architecture. Processor Design Datapath and Control
ECE 250 / CPS 250 Computer Architecture Processor Design Datapath and Control Benjamin Lee Slides based on those from Andrew Hilton (Duke), Alvy Lebeck (Duke) Benjamin Lee (Duke), and Amir Roth (Penn)
More informationAnne Bracy CS 3410 Computer Science Cornell University
Anne Bracy CS 3410 Computer Science Cornell University The slides were originally created by Deniz ALTINBUKEN. P&H Chapter 4.9, pages 445 452, appendix A.7 Manages all of the software and hardware on the
More informationLecture 2: RISC V Instruction Set Architecture. Housekeeping
S 17 L2 1 18 447 Lecture 2: RISC V Instruction Set Architecture James C. Hoe Department of ECE Carnegie Mellon University Housekeeping S 17 L2 2 Your goal today get bootstrapped on RISC V RV32I to start
More informationCS3350B Computer Architecture Winter 2015
CS3350B Computer Architecture Winter 2015 Lecture 5.5: Single-Cycle CPU Datapath Design Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted from lectures on Computer Organization and Design, Patterson
More informationVirtual Machines & the OS Kernel
Comp 120, Spring 05 4/21 Lecture page 1 Virtual Machines & the OS Kernel (not in the book) L23 Virtual Machines & the OS Kernel 1 Power of Contexts: Sharing a CPU Virtual Memory 1 Physical Memory Virtual
More informationCSE 120 Principles of Operating Systems
CSE 120 Principles of Operating Systems Spring 2018 Lecture 2: Architectural Support for Operating Systems Geoffrey M. Voelker Administrivia Project 0 Due 4/9 11:59pm, done individually Homework #1 Due
More informationOperating System Control Structures
Operating System Control Structures Information about the current status of each process and resource Tables are constructed for each entity the operating system manages 26 Memory Tables Allocation of
More informationVirtual Machines and Dynamic Translation: Implementing ISAs in Software
Virtual Machines and Dynamic Translation: Implementing ISAs in Software Krste Asanovic Laboratory for Computer Science Massachusetts Institute of Technology Software Applications How is a software application
More informationCSE 141 Computer Architecture Spring Lectures 11 Exceptions and Introduction to Pipelining. Announcements
CSE 4 Computer Architecture Spring 25 Lectures Exceptions and Introduction to Pipelining May 4, 25 Announcements Reading Assignment Sections 5.6, 5.9 The Processor Datapath and Control Section 6., Enhancing
More information1 /18 2 /16 3 /18 4 /26 5 /22
M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.004 Computation Structures Fall 2018 Quiz #2 1 /18 2 /16 3 /18 4 /26 5 /22
More informationComputer System Architecture Midterm Examination Spring 2002
Computer System Architecture 6.823 Midterm Examination Spring 2002 Name: This is an open book, open notes exam. 110 Minutes 1 Pages Notes: Not all questions are of equal difficulty, so look over the entire
More informationEE 109 Unit 15 Subroutines and Stacks
1 EE 109 Unit 15 Subroutines and Stacks 2 Program Counter and GPRs (especially $sp, $ra, and $fp) REVIEW OF RELEVANT CONCEPTS 3 Review of Program Counter PC is used to fetch an instruction PC contains
More informationTraps, Exceptions, System Calls, & Privileged Mode
Traps, Exceptions, System Calls, & Privileged Mode Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University P&H Chapter 4.9, pages 509 515, appendix B.7 Operating Systems 2 Control Transfers
More informationMicroprogramming. Microprogramming
Microprogramming Alternative way of specifying control FSM State -- bubble control signals in bubble next state given by signals on arc not a great language to specify when things are complex Treat as
More informationMIPS Datapath. MIPS Registers (and the conventions associated with them) MIPS Instruction Types
1 Lecture 08 Introduction to the MIPS ISA + Procedure Calls in MIPS Longer instructions = more bits to address registers MIPS Datapath 6 bit opcodes... 2 MIPS Instructions are 32 bits More ways to address
More information1 /18 2 /16 3 /18 4 /26 5 /22
M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 6.004 Computation Structures Fall 2018 Quiz #2 1 /18 2 /16 3 /18 4 /26 5 /22
More informationHardware OS & OS- Application interface
CS 4410 Operating Systems Hardware OS & OS- Application interface Summer 2013 Cornell University 1 Today How my device becomes useful for the user? HW-OS interface Device controller Device driver Interrupts
More informationEE458 - Embedded Systems Exceptions and Interrupts
EE458 - Embedded Systems Exceptions and Interrupts Outline Exceptions Interrupts References RTC: Chapters 10 CUG: Chapters 8, 21, 23 1 Introduction An exception is any event that disrupts the normal execution
More informationLecture 2: RISC V Instruction Set Architecture. James C. Hoe Department of ECE Carnegie Mellon University
18 447 Lecture 2: RISC V Instruction Set Architecture James C. Hoe Department of ECE Carnegie Mellon University 18 447 S18 L02 S1, James C. Hoe, CMU/ECE/CALCM, 2018 Your goal today Housekeeping get bootstrapped
More informationMIPS Functions and Instruction Formats
MIPS Functions and Instruction Formats 1 The Contract: The MIPS Calling Convention You write functions, your compiler writes functions, other compilers write functions And all your functions call other
More informationLectures 5. Announcements: Today: Oops in Strings/pointers (example from last time) Functions in MIPS
Lectures 5 Announcements: Today: Oops in Strings/pointers (example from last time) Functions in MIPS 1 OOPS - What does this C code do? int foo(char *s) { int L = 0; while (*s++) { ++L; } return L; } 2
More informationOperating Systems ECE344
Operating Systems ECE344 Ding Yuan Announcements & reminders Lab schedule is out Form your group of 2 by this Friday (18 th ), 5PM Grading policy: Final exam: 50% Midterm exam: 25% Lab assignment: 25%
More informationControl Instructions. Computer Organization Architectures for Embedded Computing. Thursday, 26 September Summary
Control Instructions Computer Organization Architectures for Embedded Computing Thursday, 26 September 2013 Many slides adapted from: Computer Organization and Design, Patterson & Hennessy 4th Edition,
More informationControl Instructions
Control Instructions Tuesday 22 September 15 Many slides adapted from: and Design, Patterson & Hennessy 5th Edition, 2014, MK and from Prof. Mary Jane Irwin, PSU Summary Previous Class Instruction Set
More informationProcess Description and Control. Major Requirements of an Operating System
Process Description and Control Chapter 3 1 Major Requirements of an Operating System Interleave the execution of several processes to maximize processor utilization while providing reasonable response
More informationMajor Requirements of an Operating System Process Description and Control
Major Requirements of an Operating System Process Description and Control Chapter 3 Interleave the execution of several processes to maximize processor utilization while providing reasonable response time
More informationInstruction Set Architecture part 1 (Introduction) Mehran Rezaei
Instruction Set Architecture part 1 (Introduction) Mehran Rezaei Overview Last Lecture s Review Execution Cycle Levels of Computer Languages Stored Program Computer/Instruction Execution Cycle SPIM, a
More informationExceptions and Interrupts
Exceptions and Interrupts Unexpected events (asynchronous interrupt) requiring change in flow of control (different ISAs use the terms differently) exception Arises within the CPU e.g., undefined opcode,
More informationCSE 120 Principles of Operating Systems
CSE 120 Principles of Operating Systems Fall 2016 Lecture 2: Architectural Support for Operating Systems Geoffrey M. Voelker Administrivia Project 0 Due 10/4, done individually Homework #1 Due 10/6 Project
More informationRecap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011
CSE 2021: Computer Organization Recap from Last Time load from disk High-Level Program Lecture-3 Code Translation-1 Registers, Arithmetic, logical, jump, and branch instructions MIPS to machine language
More informationIntroduction to Operating Systems. Chapter Chapter
Introduction to Operating Systems Chapter 1 1.3 Chapter 1.5 1.9 Learning Outcomes High-level understand what is an operating system and the role it plays A high-level understanding of the structure of
More informationInterrupts Peter Rounce - room 6.18
Interrupts Peter Rounce - room 6.18 P.Rounce@cs.ucl.ac.uk 20/11/2006 1001 Interrupts 1 INTERRUPTS An interrupt is a signal to the CPU from hardware external to the CPU that indicates than some event has
More information5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers
CSE 2021: Computer Organization Recap from Last Time load from disk High-Level Program Lecture-2 Code Translation-1 Registers, Arithmetic, logical, jump, and branch instructions MIPS to machine language
More informationVirtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. April 12, 2018 L16-1
Virtual Memory Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. L16-1 Reminder: Operating Systems Goals of OS: Protection and privacy: Processes cannot access each other s data Abstraction:
More informationImplementing RISC-V Interpreter in Hardware
Implementing RISC-V Interpreter in Hardware Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology October 16, 2018 MIT 6.004 Fall 2018 L11-1 Instruction interpreter
More informationTraps, Exceptions, System Calls, & Privileged Mode
Traps, Exceptions, System Calls, & Privileged Mode Hakim Weatherspoon CS 3410, Spring 2013 Computer Science Cornell University P&H Chapter 4.9, pages 509 515, appendix B.7 Administrivia: Where are we now
More information6.004 Recitation Problems L11 RISC-V Interpreter
6.004 Recitation Problems L11 RISC-V Interpreter Refer to the 6.004 ISA Reference Tables (Website > Resources) for details about each instruction. New Bluespec Constructs: Maybe Types // Maybe#() is a
More informationCS 252 Graduate Computer Architecture. Lecture 4: Instruction-Level Parallelism
CS 252 Graduate Computer Architecture Lecture 4: Instruction-Level Parallelism Krste Asanovic Electrical Engineering and Computer Sciences University of California, Berkeley http://wwweecsberkeleyedu/~krste
More informationVirtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. November 15, MIT Fall 2018 L20-1
Virtual Memory Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. L20-1 Reminder: Operating Systems Goals of OS: Protection and privacy: Processes cannot access each other s data Abstraction:
More informationCS 152 Computer Architecture and Engineering. Lecture 5 - Pipelining II (Branches, Exceptions)
CS 152 Computer Architecture and Engineering Lecture 5 - Pipelining II (Branches, Exceptions) John Wawrzynek Electrical Engineering and Computer Sciences University of California at Berkeley http://www.eecs.berkeley.edu/~johnw
More informationLecture 5. Announcements: Today: Finish up functions in MIPS
Lecture 5 Announcements: Today: Finish up functions in MIPS 1 Control flow in C Invoking a function changes the control flow of a program twice. 1. Calling the function 2. Returning from the function In
More informationHardware, Modularity, and Virtualization CS 111
Hardware, Modularity, and Virtualization Operating System Principles Peter Reiher Page 1 Outline The relationship between hardware and operating systems Processors I/O devices Memory Organizing systems
More informationMath 230 Assembly Programming (AKA Computer Organization) Spring MIPS Intro
Math 230 Assembly Programming (AKA Computer Organization) Spring 2008 MIPS Intro Adapted from slides developed for: Mary J. Irwin PSU CSE331 Dave Patterson s UCB CS152 M230 L09.1 Smith Spring 2008 MIPS
More informationIntroduction to Operating Systems. Chapter Chapter
Introduction to Operating Systems Chapter 1 1.3 Chapter 1.5 1.9 Learning Outcomes High-level understand what is an operating system and the role it plays A high-level understanding of the structure of
More informationAdvanced Computer Architecture
ECE 563 Advanced Computer Architecture Fall 2007 Lecture 14: Virtual Machines 563 L14.1 Fall 2009 Outline Types of Virtual Machine User-level (or Process VMs) System-level Techniques for implementing all
More informationecture 33 Virtual Memory Friedland and Weaver Computer Science 61C Spring 2017 April 12th, 2017
ecture 33 Computer Science 61C Spring 2017 April 12th, 2017 Virtual Memory 1 Multiprogramming The OS runs multiple applications at the same time. But not really: have many more processes/threads than available
More informationCS 537 Lecture 2 Computer Architecture and Operating Systems. OS Tasks
CS 537 Lecture 2 Computer Architecture and Operating Systems Michael Swift OS Tasks What is the role of the OS regarding hardware? What does the OS need from hardware to perform this role? 1 Computer Hardware
More informationCOMP303 - Computer Architecture Lecture 10. Multi-Cycle Design & Exceptions
COP33 - Computer Architecture Lecture ulti-cycle Design & Exceptions Single Cycle Datapath We designed a processor that requires one cycle per instruction RegDst busw 32 Clk RegWr Rd ux imm6 Rt 5 5 Rs
More informationVirtual Machines & the OS Kernel
Virtual Machines & the OS Kernel Not in the book! L24 Virtual Machines & the OS Kernel 1 Power of Contexts: Sharing a CPU Virtual Memory 1 Physical Memory Virtual Memory 2 Every application can be written
More informationMIPS Instruction Set
MIPS Instruction Set Prof. James L. Frankel Harvard University Version of 7:12 PM 3-Apr-2018 Copyright 2018, 2017, 2016, 201 James L. Frankel. All rights reserved. CPU Overview CPU is an acronym for Central
More informationProcess Scheduling Queues
Process Control Process Scheduling Queues Job queue set of all processes in the system. Ready queue set of all processes residing in main memory, ready and waiting to execute. Device queues set of processes
More informationCS 152 Computer Architecture and Engineering. Lecture 13 - Out-of-Order Issue and Register Renaming
CS 152 Computer Architecture and Engineering Lecture 13 - Out-of-Order Issue and Register Renaming Krste Asanovic Electrical Engineering and Computer Sciences University of California at Berkeley http://wwweecsberkeleyedu/~krste
More informationCSE 4/521 Introduction to Operating Systems. Lecture 15 Virtual Memory I (Background, Demand Paging) Summer 2018
CSE 4/521 Introduction to Operating Systems Lecture 15 Virtual Memory I (Background, Demand Paging) Summer 2018 Overview Objective: To describe the benefits of a virtual memory system. To explain the concept
More information