CS:APP 第 9 章重點提示和練習
導讀
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
出處: Memory mapping
Virtual Memory
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Why Virtual Memory (VM)?
- Uses main memory efficiently
- Use DRAM as a cache for parts of a virtual address space
- Simplifies memory management
- Each process gets the same uniform linear address space
- Isolates address spaces
- One process can’t interfere with another’s memory
- User program cannot access privileged kernel information and code
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Page 561 ~ 563
MMU 的 page size 選擇是有限的,而在 x86 32-bit 保護模式有以下兩種 page 設定:
- normal ones, 4 KiB
- huge ones, 4 MiB
不是每種 x86 處理器都支援 large page,需要具備 Page Size Extension (PSE)
4 KiB 不僅在 x86 架構出現,其他架構也常見,計算方式:
So assume that both page directory and page table contain 2x entries, and the page size is 2y bytes. To make full use of the 232 address, we have:
2x * 2 x * 2y = 232
Each entry in page directory/table consumes 4 bytes (32-bit), therefore:
2y / 4 = 2x
Thus y = 12, and page size in bytes will be 2y = 212 = 4 KiB.
注意: 4M hugepages are only for 32-bit mode x86. 64-bit x86 uses 2M or 1G hugepages, because the 4-level page-table format uses 9 bits per level.
Page size trade-off
參考輸出: (x86_64/Linux)
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
往後到 p.19
Page 565
- Virtual memory seems terribly inefficient, but it works
because of locality.
- At any point in time, programs tend to access a set of active
virtual pages called the working set
- Programs with better temporal locality will have smaller working sets
- If (working set size < main memory size)
- Good performance for one process (after cold misses)
- If (working set size > main memory size )
- Thrashing: Performance meltdown where pages are swapped (copied)
in and out continuously
- If multiple processes run at the same time, thrashing occurs if
their total working set size > main memory size
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Page 565 ~ 567
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
VM Address Translation
p.29 到 p.42
Page 568 ~ 575
Copy-on-write (COW): p.31 ~ p.42
Page 582 ~ 586
搭配參照: