# Lecture 6: The Walls to Sequential Computing. Moore’s Law.

## Lecture Summary

* Wrap up Caches
* Virtual Memory

## Caches

![](https://1313833672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMTslgmrrtRXvxD2lk9%2F-MT4F3hBLDyi874lc_5h%2F-MT4Gz0D9R0lC7yJDhbe%2FScreen%20Shot%202021-02-08%20at%2011.33.36%20PM.png?alt=media\&token=5b59d63e-1518-4f16-8c4f-e9305a2d99e3)

* Handling a write-hit
  * Write-through
  * Write-back
* Handling a write-miss
  * Write-allocate
  * No-write-allocate
* Typical combos in practice
  * Write-back + Write-allocate (more common)
  * Write-through + No-write-allocate

Miss rate is more important than the hit rate: 97% hit rate is \~2 times worse than 99% hit rate

![Cache Capacity Effects from Memory Mountain](https://1313833672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMTslgmrrtRXvxD2lk9%2F-MT4F3hBLDyi874lc_5h%2F-MT4NLNO8skPv67NM0ir%2FScreen%20Shot%202021-02-09%20at%2012.01.26%20AM.png?alt=media\&token=c6e0e04f-5657-48b1-bcd4-ad81f4376a30)

## Case Study: Rearranging Loops to Improve Spatial Locality

## Virtual Memory

Why memory virtualization?

* Ease of use (running programs that require more memory than physically available)&#x20;

* Isolation (running multiple programs simultaneously)

* Protection

* A page of virtual memory corresponds to a frame of physical memory

* Page table enables the translation of virtual address into physical addresses

* The page table is stored in main memory
  * If the page table is accessed for each address translation, this would be very costly

* Translation Lookaside Buffer (TLB): "Cache" for the addr translation process

![](https://1313833672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMTslgmrrtRXvxD2lk9%2F-MT4F3hBLDyi874lc_5h%2F-MT4TqtQ-6GaZW2HvDkn%2FScreen%20Shot%202021-02-09%20at%2012.29.50%20AM.png?alt=media\&token=c116e211-d842-4aa1-aac9-fad150b2324e)

![](https://1313833672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMTslgmrrtRXvxD2lk9%2F-MT4F3hBLDyi874lc_5h%2F-MT4TyJfcTfwIFBPdeA3%2FScreen%20Shot%202021-02-09%20at%2012.30.22%20AM.png?alt=media\&token=9670b4f3-7652-4efc-b0eb-d81c5c7b699e)
