Presentation is loading. Please wait.

Presentation is loading. Please wait.

Calling Conventions, Caching

Similar presentations


Presentation on theme: "Calling Conventions, Caching"— Presentation transcript:

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

2 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)

3 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)

4 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.

5 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

6 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

7 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

8 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)


Download ppt "Calling Conventions, Caching"

Similar presentations


Ads by Google