Calling Conventions, Caching

Slides:



Advertisements
Similar presentations
Computer ArchitectureFall 2007 © November 14th, 2007 Majd F. Sakr CS-447– Computer Architecture.
Advertisements

How caches take advantage of Temporal locality
Cs 61C L17 Cache.1 Patterson Spring 99 ©UCB CS61C Cache Memory Lecture 17 March 31, 1999 Dave Patterson (http.cs.berkeley.edu/~patterson) www-inst.eecs.berkeley.edu/~cs61c/schedule.html.
Computer ArchitectureFall 2008 © November 3 rd, 2008 Nael Abu-Ghazaleh CS-447– Computer.
COEN 180 Main Memory Cache Architectures. Basics Speed difference between cache and memory is small. Therefore:  Cache algorithms need to be implemented.
1 Copyright © 2011, Elsevier Inc. All rights Reserved. Appendix B Authors: John Hennessy & David Patterson.
IT253: Computer Organization
Lecture Topics: 11/17 Page tables TLBs Virtual memory flat page tables
Virtual Memory Expanding Memory Multiple Concurrent Processes.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 10 Memory Hierarchy.
Computer Architecture Lecture 26 Fasih ur Rehman.
The Goal: illusion of large, fast, cheap memory Fact: Large memories are slow, fast memories are small How do we create a memory that is large, cheap and.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
DECStation 3100 Block Instruction Data Effective Program Size Miss Rate Miss Rate Miss Rate 1 6.1% 2.1% 5.4% 4 2.0% 1.7% 1.9% 1 1.2% 1.3% 1.2% 4 0.3%
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
CSCI 156: Lab 11 Paging. Our Simple Architecture Logical memory space for a process consists of 16 pages of 4k bytes each. Your program thinks it has.
Virtual Memory Review Goal: give illusion of a large memory Allow many processes to share single memory Strategy Break physical memory up into blocks (pages)
1 Appendix C. Review of Memory Hierarchy Introduction Cache ABCs Cache Performance Write policy Virtual Memory and TLB.
Cache Small amount of fast memory Sits between normal main memory and CPU May be located on CPU chip or module.
Virtual Memory 1 Computer Organization II © McQuain Virtual Memory Use main memory as a “cache” for secondary (disk) storage – Managed jointly.
CSE 351 Caches. Before we start… A lot of people confused lea and mov on the midterm Totally understandable, but it’s important to make the distinction.
COSC2410: LAB 19 INTRODUCTION TO MEMORY/CACHE DIRECT MAPPING 1.
Lecture 5 Cache Operation
Performance improvements ( 1 ) How to improve performance ? Reduce the number of cycles per instruction and/or Simplify the organization so that the clock.
CSCI206 - Computer Organization & Programming
Chapter 1 Computer System Overview
Section 8 Address Translation March 10th, 2017 Taught by Joshua Don.
Address – 32 bits WRITE Write Cache Write Main Byte Offset Tag Index Valid Tag Data 16K entries 16.
COSC3330 Computer Architecture
CSE 351 Section 9 3/1/12.
CS2100 Computer Organization
Replacement Policy Replacement policy:
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Lecture: Cache Hierarchies
Chapter 11: File System Implementation
Copyright © 2011, Elsevier Inc. All rights Reserved.
Consider a Direct Mapped Cache with 4 word blocks
Morgan Kaufmann Publishers
Lecture: Cache Hierarchies
Review.
CS61C : Machine Structures Lecture 6. 2
Lecture 21: Memory Hierarchy
EECE.4810/EECE.5730 Operating Systems
Replacement Policies Assume all accesses are: Cache Replacement Policy
CSCI206 - Computer Organization & Programming
CS241 Section: Week 10.
Chapter 11: File System Implementation
Lecture 22: Cache Hierarchies, Memory
Help! How does cache work?
Direct Mapping.
Module IV Memory Organization.
Memory Hierarchy Memory: hierarchy of components of various speeds and capacities Hierarchy driven by cost and performance In early days Primary memory.
ECE232: Hardware Organization and Design
CSE 351: The Hardware/Software Interface
EE108B Review Session #6 Daxia Ge Friday February 23rd, 2007
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Lecture 22: Cache Hierarchies, Memory
CSE451 Virtual Memory Paging Autumn 2002
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Chapter 1 Computer System Overview
Memory Hierarchy Memory: hierarchy of components of various speeds and capacities Hierarchy driven by cost and performance In early days Primary memory.
Chapter 11: File System Implementation
Cache Memory and Performance
File Systems and Reliability, Two Phase Commit
Lecture 13: Cache Basics Topics: terminology, cache organization (Sections )
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
10/18: Lecture Topics Using spatial locality
Caches and Blocking 26th February 2018.
Overview Problem Solution CPU vs Memory performance imbalance
Presentation transcript:

Calling Conventions, Caching Section 9 Calling Conventions, Caching March 17th, 2017 Taught by Joshua Don

Method call – what to push on the stack? Calling Conventions Method call – what to push on the stack? Push the arguments in reverse order Push the return address Push the saved EBP %esp : stack pointer %ebp : frame base pointer (the top of the current function frame on the stack)

Caching Direct mapped cache TAG | Index | Offset Each memory address maps to a single block in the cache TAG | Index | Offset If cache has 2x rows, then the index has x bits If each row holds 2y bytes, then the offset is y bits The number of bits in tag = (total bits in address) – x – y If we want to look up the memory at address Z, we first look in the cache We check if the entry currently at Index has the same tag as Z (and if it is valid)

Caching N-way set associate Each memory address maps to a N possible blocks in the cache TAG | Index | Offset If it is 2-way set associate, we have half the number of rows (for the same size cache), so we need 1 fewer index bit - extra bit goes to the tag If we want to look up the memory at address Z, we first look in the cache We look at each of the N blocks until we find one (or don’t) that has a tag matching Z’s If we have to evict, we need an algorithm; LRU, MRU, clock, etc.

Caching Note that both of these caches hold the same amount of data Direct mapped 2-way set associative 8 rows -> 3 index bits 4 rows -> 2 index bits 1 1 10 10 11 11 100 101 110 111 Note that both of these caches hold the same amount of data

Caching Fully associative TAG | Offset Each memory address can map to any block of the cache TAG | Offset With fully associate, it is as if we only have one row to choose from, so we don’t need an index anymore … We must compare with each block of the cache until we get a tag hit If we must evict, we need a replacement algorithm such as LRU

Project 2 Want to use malloc? #include threads/malloc.h Files you’ll probably be editing (you might touch more or fewer files than this): userprog/process.c/h threads/thread.c/h userprog/syscall.c/h userprog/exception.c Unless you are very very confident with your project 1 solution, revert to the skeleton. DON’T erase your project 1 code! Easiest to just save it in another branch. Project 3 depends on project 2, so everyone must pass all project 2 tests Project 2 is overall slightly easier than project 1

Project 2 Task difficulty Argument passing Process control syscalls Easy Hard Task difficulty Argument passing Process control syscalls File operation syscalls Staff solution: 763 lines Personal: 783 lines Tips: Do arg passing first (you won’t be able to pass any tests till you get this right) Many file operation syscalls can easily be implemented in parallel (split them up amongst your group) DO NOT make a giant syscall handler function that has all of your code in it (dispatch to a unique function per syscall) Even though they are easier than the other parts, the syscalls will take a while (lot of code to write, code itself isn’t that bad)