Virtual Memory and Interrupts

Size: px
Start display at page:

Download "Virtual Memory and Interrupts"

Transcription

1 Constructive Computer Architecture Virtual Memory and Interrupts Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology November 13, L21-1

2 Address Translation: putting it all together Virtual Address TLB Lookup hardware hardware or software software miss hit Page Table Walk Protection Check the page is memory memory denied permitted Page Fault (OS loads page) Update TLB Protection Fault Physical Address (to cache) Where? Resume the instruction November 13, 2015 SEGFAULT L21-2

3 Address Translation in Pipeline Machines PC Inst TLB Inst. Cache D Decode E M Data + TLB Data Cache W TLB miss? Page Fault? Protection violation? TLB miss? Page Fault? Protection violation? Software handlers need a restartable exception on page fault or protection violation Handling a TLB miss needs a hardware or software mechanism to refill TLB Methods to overcome the additional latency of a TLB: slow down the clock pipeline the TLB and cache access virtual address caches parallel TLB/cache access November 13, L21-3

4 Physical vs Virtual Address Caches? CPU VA TLB Physical Cache PA Primary Memory Alternative: place the cache before the TLB VA CPU Virtual Cache TLB PA Primary Memory (StrongARM) One cycle in case of a hit (+) cache needs to be flushed on a context switch unless address space identifiers (ASIDs) included in tags (-) aliasing problems due to the sharing of pages (-) November 13, L21-4

5 Aliasing in Virtual-Address Caches Page Table Tag Data VA 1 Data Pages VA 1 1st Copy of Data at PA PA VA 2 2nd Copy of Data at PA VA 2 Two virtual pages share one physical page Virtual cache can have two copies of same physical data. Writes to one copy not visible to reads of other! General Solution: Disallow aliases to coexist in cache Software (i.e., OS) solution for direct-mapped cache VAs of shared pages must agree in cache index bits; this ensures all VAs accessing same PA will conflict in directmapped cache (early SPARCs) November 13, L21-5

6 VA Concurrent Access to TLB & Cache VPN L b Virtual Index PA TLB PPN Page Offset k Direct-map Cache 2 L blocks 2 b -byte block Tag hit? = Physical Tag Data Index L is available without consulting the TLB cache and TLB accesses can begin simultaneously Tag comparison is made after both accesses are completed Cases: L + b = k L + b < k L + b > k what happens here? Partially VA cache! November 13, L21-6

7 Virtual-Index Physical-Tag Caches: Associative Organization VA VPN L = k-b b W ways Virtual Index TLB k Direct-map 2 L blocks Direct-map 2 L blocks PA PPN Page Offset Phy. Tag Tag = hit? = After the PPN is known, W physical tags are compared Data Allows cache size to be greater than 2 L+b bytes November 13, L21-7

8 Exception handling in a pipeline machine November 13, L21-8

9 Exception Handling Commit Point PC Inst. Mem D Decode E + M Data Mem W PC address Exception Ex D Illegal Opcode Ex E Overflow Ex M Data address Exceptions Cause Select Handler PC Kill F Stage PC D Kill D Stage PC E Kill E Stage PC M External Interrupts EPC Kill Writeback 1. An instruction may cause multiple exceptions; which one should we process? from the earliest stage 2. When multiple instructions are causing exceptions; which one should we process first? from the oldest instruction November 13, L21-9

10 Interrupt processing Internal interrupts can happen at any stage but cause a redirection only at Commit External interrupts are considered only at Commit If an instruction causes an interrupt then the external interrupt, if present, is given a priority and the instruction is executed again Some instructions, like Store, cannot be undone once launched. So an instruction is considered to have completed before an external interrupt is taken November 13, L21-10

11 Exception Handling When instruction x in stage i raises an exception, its cause is recorded and passed down the pipeline For a given instruction, exceptions from the later stages of the pipeline do not override cause of exception from the earlier stages If an exception is present at commit: Cause and EPC registers are set, and pc is redirected to the handler PC Epoch mechanism takes care of redirecting the pc November 4, L19-11

12 Epoch PC Killing vs Poisoning Next Addr Pred f12f2 Inst Memory f2d wrong path insts are dropped Decode d2e scoreboard wrong path insts are poisoned Register File Execute e2m Data Memory This affects whether an instruction is removed from sb in case of an interrupt November 4, L19-12 m2c external interrupts considered at Commit

13 Interrupt processing at Execute Incoming Interrupt no yes -if (mem type) issue Ld/St -if (mispred) redirect -pass einst to M stage -pass einst to M stage unmodified einst will contain information about any newly detected interrupts at Execute November 13, L21-13

14 Interrupt processing at Memory stage -pass einst with modified data to Commit Incoming Interrupt no yes Memory Interrupt? no yes -pass new Cause to Commit -pass einst to Commit unmodified November 13, L21-14

15 Interrupt processing at Commit -commit -sb.rm External Interrupt? no yes Incoming interrupt Incoming interrupt no yes no yes EPC<= pc; causer <= incause; if (incause after Reg Fetch) sb.rm; mode <= privilege; Redirect commit; sb.rm; EPC<= ppc; causer <= Ext; mode <= privilege; Redirect EPC<= pc; causer <= Ext; if (incause after Reg Fetch) sb.rm; mode <= privilege; Redirect November 13, L21-15

16 Final comment There is generally a lot of machinery associated with a plethora of exceptions in ISAs Precise exceptions are difficult to implement correctly in pipelined machines Performance is usually not the issue and therefore sometimes exceptions are implemented using microcode The code slides follow November 4, L19-16

17 One-Cycle SMIPS rule doexecute; let inst = imem.req(pc); let dinst = decode(inst, csrf.getstatus); let rval1 = rf.rd1(frommaybe(?, dinst.src1)); let rval2 = rf.rd2(frommaybe(?, dinst.src2)); let einst = exec(dinst, rval1, rval2, pc,?); if(einst.itype == Ld) einst.data <- dmem.req(memreq{op: Ld, addr: einst.addr, data:?}); else if(einst.itype == St) let d <- dmem.req(memreq{op: St, addr: einst.addr, data: einst.data}); if (isvalid(einst.dst)) rf.wr(frommaybe(?, einst.dst), einst.data); setting special registers next address calculation endrule endmodule November 4, L19-17

18 Type: Decoded Instruction typedef struct { IType itype; AluFunc alufunc; BrFunc brfunc; Maybe#(RIndx) dst; Maybe#(RIndx) src1; Maybe#(RIndx) src2; Maybe#(Data) imm; Maybe#(CsrIndx) csr; } DecodedInst deriving(bits, Eq); typedef enum {Unsupported, NoPermit, Alu, Ld, St, J, Jr, Br,..., Syscall, ERet} IType deriving(bits, Eq); November 4, L19-18

19 Decode function DecodedInst decode(data inst, Status status); DecodedInst dinst =?;... opsystem: begin case (funct3)... fnpriv: begin // privilege inst dinst.itype = (case(inst[31:20]) fn12scall: Syscall; // sys call // ERET can only be executed under privilege mode fn12eret: isprivmode(status)? Eret : NoPermit; default: Unsupported; endcase); dinst.dst = Invalid; dinst.src1 = Invalid; dinst.src2 = Invalid; dinst.imm dinst.alufunc =?; dinst.brfunc = NT; end... endcase end... return dinst; endfunction = Invalid; November 4, L19-19

20 Set special registers if (einst.itype==syscall) begin csrf.setstatus(statuspushku(csrf.getstatus)); csrf.setcause(32 h08); // cause for System call csrf.setepc(pc); end else if (einst.itype==eret) begin cop.setstatus(statuspopku(cop.getstatus)); end November 4, L19-20

21 Redirecting PC if (einst.itype==syscall) pc <= csrf.gettvec; else if (einst.itype==eret) pc <= cop.getepc; else pc <= einst.brtaken? einst.addr : pc + 4; November 4, L19-21

Interrupts/Exceptions/Faults

Interrupts/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 information

Virtual Memory: From Address Translation to Demand Paging

Virtual Memory: From Address Translation to Demand Paging Constructive Computer Architecture Virtual Memory: From Address Translation to Demand Paging Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology November 12, 2014

More information

Non-Pipelined Processors

Non-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 information

Non-Pipelined Processors - 2

Non-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 information

Non-Pipelined Processors

Non-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 information

Operating Systems and Interrupts/Exceptions

Operating Systems and Interrupts/Exceptions 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

More information

Non-pipelined Multicycle processors

Non-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 information

6.004 Recitation Problems L11 RISC-V Interpreter

6.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 information

Multicycle processors. Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology

Multicycle processors. Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Multicycle processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology L14-1 Single-Cycle RISC Processor As an illustrative example, we use a subset of RISC-V

More information

Multicycle processors. Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology

Multicycle processors. Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Multicycle processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology L12-1 Single-Cycle RISC Processor As an illustrative example, we use a subset of RISC-V

More information

Modern Virtual Memory Systems. Modern Virtual Memory Systems

Modern Virtual Memory Systems. Modern Virtual Memory Systems 6.823, L12--1 Modern Virtual Systems Asanovic Laboratory for Computer Science M.I.T. http://www.csg.lcs.mit.edu/6.823 6.823, L12--2 Modern Virtual Systems illusion of a large, private, uniform store Protection

More information

Virtual Memory: From Address Translation to Demand Paging

Virtual Memory: From Address Translation to Demand Paging Constructive Computer Architecture Virtual Memory: From Address Translation to Demand Paging Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology November 9, 2015

More information

6.004 Recitation Problems L11 RISC-V Interpreter

6.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 information

CS 152 Computer Architecture and Engineering. Lecture 11 - Virtual Memory and Caches

CS 152 Computer Architecture and Engineering. Lecture 11 - Virtual Memory and Caches CS 152 Computer Architecture and Engineering Lecture 11 - Virtual Memory and Caches Krste Asanovic Electrical Engineering and Computer Sciences University of California at Berkeley http://www.eecs.berkeley.edu/~krste

More information

Control Unit. Main Memory. control. status. address instructions. address data. Internal storage Datapath

Control Unit. Main Memory. control. status. address instructions. address data. Internal storage Datapath control Internal storage Datapath status Control Unit address data address instructions Main Memory March 20, 2018 http://csg.csail.mit.edu/6.s084 L11-1 Our interpreter is a Single-Cycle RISC-V Processor

More information

Implementing RISC-V Interpreter in Hardware

Implementing 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 information

CS 152 Computer Architecture and Engineering. Lecture 9 - Virtual Memory

CS 152 Computer Architecture and Engineering. Lecture 9 - Virtual Memory CS 152 Computer Architecture and Engineering Lecture 9 - Virtual Memory Krste Asanovic Electrical Engineering and Computer Sciences University of California at Berkeley http://www.eecs.berkeley.edu/~krste!

More information

1 /20 2 /18 3 /20 4 /18 5 /24

1 /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 information

1 /15 2 /20 3 /20 4 /25 5 /20

1 /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 information

1 /20 2 /18 3 /20 4 /18 5 /24

1 /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 information

1 /18 2 /16 3 /18 4 /26 5 /22

1 /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 information

6.004 Recitation Problems L13 RISC-V Interpreter

6.004 Recitation Problems L13 RISC-V Interpreter 6.004 Recitation Problems L13 RISC-V Interpreter Refer to the 6.004 ISA Reference Tables (Website > Resources) for details about each instruction. RISC-V Interpreter: Components Register File typedef Bit#(32)

More information

1 /18 2 /16 3 /18 4 /26 5 /22

1 /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 information

Lecture 9 - Virtual Memory

Lecture 9 - Virtual Memory CS 152 Computer Architecture and Engineering Lecture 9 - Virtual Memory Dr. George Michelogiannakis EECS, University of California at Berkeley CRD, Lawrence Berkeley National Laboratory http://inst.eecs.berkeley.edu/~cs152

More information

CS252 Spring 2017 Graduate Computer Architecture. Lecture 17: Virtual Memory and Caches

CS252 Spring 2017 Graduate Computer Architecture. Lecture 17: Virtual Memory and Caches CS252 Spring 2017 Graduate Computer Architecture Lecture 17: Virtual Memory and Caches Lisa Wu, Krste Asanovic http://inst.eecs.berkeley.edu/~cs252/sp17 WU UCB CS252 SP17 Last Time in Lecture 16 Memory

More information

6.004 Recitation Problems L13 RISC-V Interpreter

6.004 Recitation Problems L13 RISC-V Interpreter 6.004 Recitation Problems L13 RISC-V Interpreter Refer to the 6.004 ISA Reference Tables (Website > Resources) for details about each instruction. RISC-V Interpreter: Components Register File typedef Bit#(32)

More information

Branch Prediction: Direction Predictors

Branch Prediction: Direction Predictors Constructive Computer Architecture: Branch Prediction: Direction Predictors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology October 27, 2014 http://csg.csail.mit.edu/6.175

More information

Constructive Computer Architecture Tutorial 7: SMIPS Epochs. Andy Wright TA. October 7,

Constructive Computer Architecture Tutorial 7: SMIPS Epochs. Andy Wright TA. October 7, Constructive Computer Architecture Tutorial 7: SMIPS Epochs Andy Wright 6.7 TA T0- drecirect erecirect N-Stage pipeline: Two predictors f fdepoch redirect depoch redirect d miss pred? miss pred? Fetch

More information

Data Hazards in Pipelined Processors

Data Hazards in Pipelined Processors Data Hazards in Pipelined Processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology March 13, 2013 http://csg.csail.mit.edu/6.375 L11-1 A different 2-Stage

More information

CS 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 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 information

Virtual 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. 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 information

Contributors to the course material

Contributors to the course material Constructive Computer Architecture: Data Hazards in Pipelined Processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology October 11, 2013 http://csg.csail.mit.edu/6.s195

More information

Lecture 9 Virtual Memory

Lecture 9 Virtual Memory CS 152 Computer Architecture and Engineering CS252 Graduate Computer Architecture Lecture 9 Virtual Memory Krste Asanovic Electrical Engineering and Computer Sciences University of California at Berkeley

More information

Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology

Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Constructive Computer Architecture: Data Hazards in Pipelined Processors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology January 2, 2014 http://csg.csail.mit.edu/6.s195/cdac

More information

Virtual 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. 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 information

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Modeling Processors Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L08-1 Instruction set typedef enum {R0;R1;R2; ;R31} RName; typedef union tagged { struct

More information

Topic 18: Virtual Memory

Topic 18: Virtual Memory Topic 18: Virtual Memory COS / ELE 375 Computer Architecture and Organization Princeton University Fall 2015 Prof. David August 1 Virtual Memory Any time you see virtual, think using a level of indirection

More information

Computer System Architecture Midterm Examination Spring 2002

Computer 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 information

EE 457 Unit 8. Exceptions What Happens When Things Go Wrong

EE 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 information

6.175: Constructive Computer Architecture. Tutorial 5 Epochs, Debugging, and Caches

6.175: Constructive Computer Architecture. Tutorial 5 Epochs, Debugging, and Caches 6.175: Constructive Computer Architecture Tutorial 5 Epochs, Debugging, and Caches Quan Nguyen (Troubled by the two biggest problems in computer science and Comic Sans) T05-1 Agenda Epochs: a review Debugging

More information

EECS 470. Lecture 16 Virtual Memory. Fall 2018 Jon Beaumont

EECS 470. Lecture 16 Virtual Memory. Fall 2018 Jon Beaumont Lecture 16 Virtual Memory Fall 2018 Jon Beaumont http://www.eecs.umich.edu/courses/eecs470 Slides developed in part by Profs. Austin, Brehob, Falsafi, Hill, Hoe, Lipasti, Shen, Smith, Sohi, Tyson, and

More information

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Modeling Processors Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L07-1 Instruction set typedef enum {R0;R1;R2; ;R31} RName; typedef union tagged { struct

More information

Topic 18 (updated): Virtual Memory

Topic 18 (updated): Virtual Memory Topic 18 (updated): Virtual Memory COS / ELE 375 Computer Architecture and Organization Princeton University Fall 2015 Prof. David August 1 Virtual Memory Any time you see virtual, think using a level

More information

John Wawrzynek & Nick Weaver

John Wawrzynek & Nick Weaver CS 61C: Great Ideas in Computer Architecture Lecture 23: Virtual Memory John Wawrzynek & Nick Weaver http://inst.eecs.berkeley.edu/~cs61c From Previous Lecture: Operating Systems Input / output (I/O) Memory

More information

Cache Performance (H&P 5.3; 5.5; 5.6)

Cache Performance (H&P 5.3; 5.5; 5.6) Cache Performance (H&P 5.3; 5.5; 5.6) Memory system and processor performance: CPU time = IC x CPI x Clock time CPU performance eqn. CPI = CPI ld/st x IC ld/st IC + CPI others x IC others IC CPI ld/st

More information

Transla'on, Protec'on, and Virtual Memory. 2/25/16 CS 152 Sec'on 6 Colin Schmidt

Transla'on, Protec'on, and Virtual Memory. 2/25/16 CS 152 Sec'on 6 Colin Schmidt Transla'on, Protec'on, and Virtual Memory 2/25/16 CS 152 Sec'on 6 Colin Schmidt Agenda Protec'on Transla'on Virtual Memory Lab 1 Feedback Ques'ons/Open-ended discussion Hand back Lab 1 Protec'on Why? Supervisor

More information

CS 61C: Great Ideas in Computer Architecture. Lecture 23: Virtual Memory. Bernhard Boser & Randy Katz

CS 61C: Great Ideas in Computer Architecture. Lecture 23: Virtual Memory. Bernhard Boser & Randy Katz CS 61C: Great Ideas in Computer Architecture Lecture 23: Virtual Memory Bernhard Boser & Randy Katz http://inst.eecs.berkeley.edu/~cs61c Agenda Virtual Memory Paged Physical Memory Swap Space Page Faults

More information

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology

Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Modeling Processors Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L07-1 The Plan Non-pipelined processor Two-stage synchronous pipeline Two-stage asynchronous

More information

What are Exceptions? EE 457 Unit 8. Exception Processing. Exception Examples 1. Exceptions What Happens When Things Go Wrong

What 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 information

Announcement. ECE475/ECE4420 Computer Architecture L4: Advanced Issues in Pipelining. Edward Suh Computer Systems Laboratory

Announcement. ECE475/ECE4420 Computer Architecture L4: Advanced Issues in Pipelining. Edward Suh Computer Systems Laboratory ECE475/ECE4420 Computer Architecture L4: Advanced Issues in Pipelining Edward Suh Computer Systems Laboratory suh@csl.cornell.edu Announcement Lab1 is released Start early we only have limited computing

More information

CS 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 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 information

CS 61C: Great Ideas in Computer Architecture. Lecture 23: Virtual Memory

CS 61C: Great Ideas in Computer Architecture. Lecture 23: Virtual Memory CS 61C: Great Ideas in Computer Architecture Lecture 23: Virtual Memory Krste Asanović & Randy H. Katz http://inst.eecs.berkeley.edu/~cs61c/fa17 1 Agenda Virtual Memory Paged Physical Memory Swap Space

More information

Bypassing and EHRs. Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. L23-1

Bypassing and EHRs. Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. L23-1 Bypassing and EHRs Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. L23-1 Bypassing F D RF bypass E/WB Bypassing is a technique to reduce the number of stalls (that is, the number

More information

CS 318 Principles of Operating Systems

CS 318 Principles of Operating Systems CS 318 Principles of Operating Systems Fall 2018 Lecture 10: Virtual Memory II Ryan Huang Slides adapted from Geoff Voelker s lectures Administrivia Next Tuesday project hacking day No class My office

More information

POLITECNICO DI MILANO. Exception handling. Donatella Sciuto:

POLITECNICO 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 information

CS 252 Graduate Computer Architecture. Lecture 4: Instruction-Level Parallelism

CS 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 information

CS 152 Computer Architecture and Engineering. Lecture 9 - Address Translation

CS 152 Computer Architecture and Engineering. Lecture 9 - Address Translation CS 152 Computer Architecture and Engineering Lecture 9 - Address Translation Krste Asanovic Electrical Engineering and Computer Sciences University of California at Berkeley http://www.eecs.berkeley.edu/~krste

More information

Need for a scheduler. Concurrent rule execution. L17/L18 Review- Rule Scheduling

Need for a scheduler. Concurrent rule execution. L17/L18 Review- Rule Scheduling L17/L18 Review- Rule Scheduling Conflict Matri (CM) BSV compiler generates the pairwise conflict information Eample 1 rule ra;

More information

Virtual memory. Hung-Wei Tseng

Virtual memory. Hung-Wei Tseng Virtual memory Hung-Wei Tseng Why virtual memory How VM works VM and cache Outline 4 Virtual memory 5 Scenario I An application is design on machine A with memory size X. Can we safely execute the same

More information

CS 152 Computer Architecture and Engineering. Lecture 8 - Address Translation

CS 152 Computer Architecture and Engineering. Lecture 8 - Address Translation CS 152 Computer Architecture and Engineering Lecture 8 - Translation Krste Asanovic Electrical Engineering and Computer Sciences University of California at Berkeley http://www.eecs.berkeley.edu/~krste!

More information

Virtual memory. Hung-Wei Tseng

Virtual memory. Hung-Wei Tseng Virtual memory Hung-Wei Tseng Why virtual memory How VM works VM and cache Outline 2 Virtual memory 3 Scenario I An application is design on machine A with memory size X. Can we safely execute the same

More information

Contributors to the course material

Contributors to the course material Constructive Computer Architecture: Branch Prediction: Direction Predictors Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology October 23, 2013 http://csg.csail.mit.edu/6.s195

More information

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1 Virtual Memory Patterson & Hennessey Chapter 5 ELEC 5200/6200 1 Virtual Memory Use main memory as a cache for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs

More information

CS 152 Computer Architecture and Engineering. Lecture 8 - Address Translation

CS 152 Computer Architecture and Engineering. Lecture 8 - Address Translation CS 152 Computer Architecture and Engineering Lecture 8 - Translation Krste Asanovic Electrical Engineering and Computer Sciences University of California at Berkeley http://www.eecs.berkeley.edu/~krste!

More information

CS 152 Computer Architecture and Engineering. Lecture 10 - Complex Pipelines, Out-of-Order Issue, Register Renaming

CS 152 Computer Architecture and Engineering. Lecture 10 - Complex Pipelines, Out-of-Order Issue, Register Renaming CS 152 Computer Architecture and Engineering Lecture 10 - Complex Pipelines, Out-of-Order Issue, Register Renaming John Wawrzynek Electrical Engineering and Computer Sciences University of California at

More information

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory CPS 104 Computer Organization and Programming Lecture 20: Virtual Nov. 10, 1999 Dietolf (Dee) Ramm http://www.cs.duke.edu/~dr/cps104.html CPS 104 Lecture 20.1 Outline of Today s Lecture O Virtual. 6 Paged

More information

Realistic Memories and Caches

Realistic Memories and Caches Realistic Memories and Caches Li-Shiuan Peh Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology L13-1 Three-Stage SMIPS Epoch Register File stall? PC +4 fr Decode Execute

More information

COEN-4730 Computer Architecture Lecture 3 Review of Caches and Virtual Memory

COEN-4730 Computer Architecture Lecture 3 Review of Caches and Virtual Memory 1 COEN-4730 Computer Architecture Lecture 3 Review of Caches and Virtual Memory Cristinel Ababei Dept. of Electrical and Computer Engineering Marquette University Credits: Slides adapted from presentations

More information

Improving Cache Performance and Memory Management: From Absolute Addresses to Demand Paging. Highly-Associative Caches

Improving Cache Performance and Memory Management: From Absolute Addresses to Demand Paging. Highly-Associative Caches Improving Cache Performance and Memory Management: From Absolute Addresses to Demand Paging 6.823, L8--1 Asanovic Laboratory for Computer Science M.I.T. http://www.csg.lcs.mit.edu/6.823 Highly-Associative

More information

Translation Buffers (TLB s)

Translation Buffers (TLB s) Translation Buffers (TLB s) To perform virtual to physical address translation we need to look-up a page table Since page table is in memory, need to access memory Much too time consuming; 20 cycles or

More information

LECTURE 3: THE PROCESSOR

LECTURE 3: THE PROCESSOR LECTURE 3: THE PROCESSOR Abridged version of Patterson & Hennessy (2013):Ch.4 Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU

More information

6.175: Constructive Computer Architecture. Tutorial 4 Epochs and Scoreboards

6.175: Constructive Computer Architecture. Tutorial 4 Epochs and Scoreboards 6.175: Constructive Computer Architecture Tutorial 4 Epochs and Scoreboards Quan Nguyen (Hopes to help you avoid epoch fails) https://xkcd.com/376/ (not that kind of epoch) T04-1 Outline Epochs Scoreboards

More information

CSC 631: High-Performance Computer Architecture

CSC 631: High-Performance Computer Architecture CSC 631: High-Performance Computer Architecture Spring 2017 Lecture 4: Pipelining Last Time in Lecture 3 icrocoding, an effective technique to manage control unit complexity, invented in era when logic

More information

CS 152 Computer Architecture and Engineering. Lecture 9 - Address Translation

CS 152 Computer Architecture and Engineering. Lecture 9 - Address Translation CS 152 Computer Architecture and Engineering Lecture 9 - Address Translation Krste Asanovic Electrical Engineering and Computer Sciences University of California at Berkeley http://www.eecs.berkeley.edu/~krste!

More information

CSE502: Computer Architecture CSE 502: Computer Architecture

CSE502: Computer Architecture CSE 502: Computer Architecture CSE 502: Computer Architecture Instruction Commit The End of the Road (um Pipe) Commit is typically the last stage of the pipeline Anything an insn. does at this point is irrevocable Only actions following

More information

Announcements. ECE4750/CS4420 Computer Architecture L11: Speculative Execution I. Edward Suh Computer Systems Laboratory

Announcements. ECE4750/CS4420 Computer Architecture L11: Speculative Execution I. Edward Suh Computer Systems Laboratory ECE4750/CS4420 Computer Architecture L11: Speculative Execution I Edward Suh Computer Systems Laboratory suh@csl.cornell.edu Announcements Lab3 due today 2 1 Overview Branch penalties limit performance

More information

Instruction Level Parallelism. Appendix C and Chapter 3, HP5e

Instruction Level Parallelism. Appendix C and Chapter 3, HP5e Instruction Level Parallelism Appendix C and Chapter 3, HP5e Outline Pipelining, Hazards Branch prediction Static and Dynamic Scheduling Speculation Compiler techniques, VLIW Limits of ILP. Implementation

More information

HY225 Lecture 12: DRAM and Virtual Memory

HY225 Lecture 12: DRAM and Virtual Memory HY225 Lecture 12: DRAM and irtual Memory Dimitrios S. Nikolopoulos University of Crete and FORTH-ICS May 16, 2011 Dimitrios S. Nikolopoulos Lecture 12: DRAM and irtual Memory 1 / 36 DRAM Fundamentals Random-access

More information

CPS104 Computer Organization and Programming Lecture 16: Virtual Memory. Robert Wagner

CPS104 Computer Organization and Programming Lecture 16: Virtual Memory. Robert Wagner CPS104 Computer Organization and Programming Lecture 16: Virtual Memory Robert Wagner cps 104 VM.1 RW Fall 2000 Outline of Today s Lecture Virtual Memory. Paged virtual memory. Virtual to Physical translation:

More information

Virtual Memory. Virtual Memory

Virtual Memory. Virtual Memory Virtual Memory Virtual Memory Main memory is cache for secondary storage Secondary storage (disk) holds the complete virtual address space Only a portion of the virtual address space lives in the physical

More information

CS 4284 Systems Capstone. Virtual Memory Page Tables Godmar Back

CS 4284 Systems Capstone. Virtual Memory Page Tables Godmar Back CS 4284 Systems Capstone Virtual Memory Page Tables Godmar Back Virtual Memory Virtual Memory Is not a kind of memory Is a technique that combines one or more of the following concepts: Address translation

More information

VIRTUAL MEMORY II. Jo, Heeseung

VIRTUAL MEMORY II. Jo, Heeseung VIRTUAL MEMORY II Jo, Heeseung TODAY'S TOPICS How to reduce the size of page tables? How to reduce the time for address translation? 2 PAGE TABLES Space overhead of page tables The size of the page table

More information

CISC 662 Graduate Computer Architecture Lecture 7 - Multi-cycles

CISC 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 information

COSC3330 Computer Architecture Lecture 20. Virtual Memory

COSC3330 Computer Architecture Lecture 20. Virtual Memory COSC3330 Computer Architecture Lecture 20. Virtual Memory Instructor: Weidong Shi (Larry), PhD Computer Science Department University of Houston Virtual Memory Topics Reducing Cache Miss Penalty (#2) Use

More information

Memory System Implementation

Memory System Implementation Memory System Implementation Silvina Hanono Wachman Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L14-1 Best Wishes from Japan October 25, 2018 MIT 6.004 Fall 2018

More information

ECE468 Computer Organization and Architecture. Virtual Memory

ECE468 Computer Organization and Architecture. Virtual Memory ECE468 Computer Organization and Architecture Virtual Memory ECE468 vm.1 Review: The Principle of Locality Probability of reference 0 Address Space 2 The Principle of Locality: Program access a relatively

More information

Reducing Hit Times. Critical Influence on cycle-time or CPI. small is always faster and can be put on chip

Reducing Hit Times. Critical Influence on cycle-time or CPI. small is always faster and can be put on chip Reducing Hit Times Critical Influence on cycle-time or CPI Keep L1 small and simple small is always faster and can be put on chip interesting compromise is to keep the tags on chip and the block data off

More information

ECE4680 Computer Organization and Architecture. Virtual Memory

ECE4680 Computer Organization and Architecture. Virtual Memory ECE468 Computer Organization and Architecture Virtual Memory If I can see it and I can touch it, it s real. If I can t see it but I can touch it, it s invisible. If I can see it but I can t touch it, it

More information

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Chapter 5. Large and Fast: Exploiting Memory Hierarchy Chapter 5 Large and Fast: Exploiting Memory Hierarchy Processor-Memory Performance Gap 10000 µproc 55%/year (2X/1.5yr) Performance 1000 100 10 1 1980 1983 1986 1989 Moore s Law Processor-Memory Performance

More information

Hakim Weatherspoon CS 3410 Computer Science Cornell University

Hakim 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 information

CS 152 Computer Architecture and Engineering. Lecture 9 - Virtual Memory. Last?me in Lecture 9

CS 152 Computer Architecture and Engineering. Lecture 9 - Virtual Memory. Last?me in Lecture 9 CS 152 Computer Architecture and Engineering Lecture 9 - Krste Asanovic Electrical Engineering and Computer Sciences University of California at Berkeley http://www.eecs.berkeley.edu/~krste! http://inst.eecs.berkeley.edu/~cs152!

More information

are Softw Instruction Set Architecture Microarchitecture are rdw

are Softw Instruction Set Architecture Microarchitecture are rdw Program, Application Software Programming Language Compiler/Interpreter Operating System Instruction Set Architecture Hardware Microarchitecture Digital Logic Devices (transistors, etc.) Solid-State Physics

More information

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Chapter 5. Large and Fast: Exploiting Memory Hierarchy Chapter 5 Large and Fast: Exploiting Memory Hierarchy Processor-Memory Performance Gap 10000 µproc 55%/year (2X/1.5yr) Performance 1000 100 10 1 1980 1983 1986 1989 Moore s Law Processor-Memory Performance

More information

EITF20: Computer Architecture Part2.2.1: Pipeline-1

EITF20: Computer Architecture Part2.2.1: Pipeline-1 EITF20: Computer Architecture Part2.2.1: Pipeline-1 Liang Liu liang.liu@eit.lth.se 1 Outline Reiteration Pipelining Harzards Structural hazards Data hazards Control hazards Implementation issues Multi-cycle

More information

ECE 552 / CPS 550 Advanced Computer Architecture I. Lecture 9 Instruction-Level Parallelism Part 2

ECE 552 / CPS 550 Advanced Computer Architecture I. Lecture 9 Instruction-Level Parallelism Part 2 ECE 552 / CPS 550 Advanced Computer Architecture I Lecture 9 Instruction-Level Parallelism Part 2 Benjamin Lee Electrical and Computer Engineering Duke University www.duke.edu/~bcl15 www.duke.edu/~bcl15/class/class_ece252fall12.html

More information

CS 537 Lecture 6 Fast Translation - TLBs

CS 537 Lecture 6 Fast Translation - TLBs CS 537 Lecture 6 Fast Translation - TLBs Michael Swift 9/26/7 2004-2007 Ed Lazowska, Hank Levy, Andrea and Remzi Arpaci-Dussea, Michael Swift Faster with TLBS Questions answered in this lecture: Review

More information

COMPUTER ORGANIZATION AND DESIGN

COMPUTER ORGANIZATION AND DESIGN COMPUTER ORGANIZATION AND DESIGN 5 Edition th The Hardware/Software Interface Chapter 4 The Processor 4.1 Introduction Introduction CPU performance factors Instruction count CPI and Cycle time Determined

More information

CS 152 Computer Architecture and Engineering CS252 Graduate Computer Architecture. Lecture 9 Virtual Memory

CS 152 Computer Architecture and Engineering CS252 Graduate Computer Architecture. Lecture 9 Virtual Memory CS 152 Computer Architecture and Engineering CS252 Graduate Computer Architecture Lecture 9 Virtual Memory Krste Asanovic Electrical Engineering and Computer Sciences University of California at Berkeley

More information

CS162 - Operating Systems and Systems Programming. Address Translation => Paging"

CS162 - Operating Systems and Systems Programming. Address Translation => Paging CS162 - Operating Systems and Systems Programming Address Translation => Paging" David E. Culler! http://cs162.eecs.berkeley.edu/! Lecture #15! Oct 3, 2014!! Reading: A&D 8.1-2, 8.3.1. 9.7 HW 3 out (due

More information

CSE 120 Principles of Operating Systems Spring 2017

CSE 120 Principles of Operating Systems Spring 2017 CSE 120 Principles of Operating Systems Spring 2017 Lecture 12: Paging Lecture Overview Today we ll cover more paging mechanisms: Optimizations Managing page tables (space) Efficient translations (TLBs)

More information