CS 162 Discussion Section Week 5
-
Upload
wing-richards -
Category
Documents
-
view
27 -
download
2
description
Transcript of CS 162 Discussion Section Week 5
![Page 1: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/1.jpg)
CS 162Discussion Section
Week 5
![Page 2: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/2.jpg)
Administrivia
• Project code submission due Tuesday midnight
• Autograder is up and running• Boat problem
![Page 3: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/3.jpg)
What does an OS scheduler do?
![Page 4: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/4.jpg)
Image Source: macdesign.net
![Page 5: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/5.jpg)
How would you measure the effectiveness of a scheduler?
• CPU Utilization• Throughput• Waiting time• Service time• Turnaround time for a process• Response time
![Page 6: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/6.jpg)
Work sheet time
![Page 7: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/7.jpg)
Recap: Why do we need memory management in the OS?
• Isolation / Protection• Ease of programming– Re-locatable code– Support for Dynamic Libraries
• Support larger address spaces (Program independent of hw availability)
![Page 8: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/8.jpg)
Memory Hierarchy
Image Source: http://www.sal.ksu.edu/faculty/tim/ossg/
![Page 9: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/9.jpg)
What are the typical segments in a process’ address space?
• Code• Data• Stack• Heap
![Page 10: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/10.jpg)
Seg ID # Base Limit
0 (code) 0x4000 0x0800
1 (data) 0x4800 0x1400
2 (shared) 0xF000 0x1000
3 (stack) 0x0000 0x3000
OffsetSeg014 1315
0x4000
0x0000
0x8000
0xC000
VirtualAddress Space
Virtual Address Format
0x0000
0x4800
0x5C00
0x4000
0xF000
PhysicalAddress Space
Space forOther Apps
Shared withOther Apps
Might be shared
SegID = 0
SegID = 1
![Page 11: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/11.jpg)
What is the problem with Memory Segmentation?
• Fragmentation!• Inter-process sharing is hard
What is the solution?
![Page 12: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/12.jpg)
![Page 13: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/13.jpg)
What is the size of the page table in a 64bit system if each
page is 4K in size?
![Page 14: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/14.jpg)
What is the problem with large pages?
What is the solution to large page tables?
![Page 15: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/15.jpg)
![Page 16: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/16.jpg)
![Page 17: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/17.jpg)
How does address translation really take place?
![Page 18: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/18.jpg)
What is the size of the page table in a 64bit system if each
page is 4K in size? – 16 PB
How many levels would you need if you had 1024 entry
page tables?
![Page 19: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/19.jpg)
Linear inverted page tables
![Page 20: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/20.jpg)
Hashed inverted page table
![Page 21: CS 162 Discussion Section Week 5](https://reader035.fdocuments.in/reader035/viewer/2022062517/56813919550346895da0c266/html5/thumbnails/21.jpg)
Hashed inverted page table