Download - Discussion Week 6
![Page 1: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/1.jpg)
Discussion Week 6TA: Kyle Dewey
![Page 2: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/2.jpg)
Overview
•Project #2 questions
•Project #2 test cases
•Exam sample questions
•Project #3 high level overview
![Page 3: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/3.jpg)
Project #2 Error Conditions
•Do not worry about error codes
•Still should check for error conditions for your own testing
![Page 4: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/4.jpg)
Project #2 Questions?
![Page 5: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/5.jpg)
Project #2 Test Cases
•In code/test
•These will be used to test your code, along with similar variants of them
•Altogether, they have wide coverage
![Page 6: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/6.jpg)
Some Cases
•fork.c
•ncat.c
•test1.c
![Page 7: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/7.jpg)
Exam Sample Questions
![Page 8: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/8.jpg)
Question: “Do OSes actually swap anything
anymore?”
![Page 9: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/9.jpg)
Relevance
•Modern systems have tons of memory
•Usually a lot more free memory than in use
•Setups vary widely
![Page 10: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/10.jpg)
Memory Usage
•Linux has the free command
•Shows free and used memory, along with swap
![Page 11: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/11.jpg)
Occasional Webserver
total used free shared buffers cachedMem: 3962 3782 179 0 181 3009-/+ buffers/cache: 591 3370Swap: 1983 0 1983
![Page 12: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/12.jpg)
Occasional Fileserver
total used free shared buffers cachedMem: 496 481 14 0 270 65-/+ buffers/cache: 144 351Swap: 792 1 790
![Page 13: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/13.jpg)
CSIL Under Load
total used free shared buffers cachedMem: 8072 7493 579 0 277 3292-/+ buffers/cache: 3923 4149Swap: 12229 205 12023
![Page 14: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/14.jpg)
Server After Load Spike
total used free shared buffers cachedMem: 8002 7697 304 0 2098 4652-/+ buffers/cache: 946 7055Swap: 1811 353 1458
![Page 15: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/15.jpg)
Virtualization
•Multiple OSes feed off the same memory
•Memory tends to be the greatest limitation
•Special software used to force OS to page in one VM when another is starved for memory
![Page 16: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/16.jpg)
Virtualized Memory
OS1OS1 OS2OS2
MachineMachine4 GB total
4 GB total 4 GB total
Needs 3 GB Needs 2 GB
![Page 17: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/17.jpg)
On Paging
•Paging is a last resort mechanism
•A private, lightly loaded system will likely never need it
•In enterprise environments, it ranges from very nice to absolutely vital
![Page 18: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/18.jpg)
Project #3 Overview
![Page 19: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/19.jpg)
Part I
•Need to implement paging
•Tests will be so large as to need paging
•Paging algorithm cannot be naive
•Least recently used (LRU)
•Second chance FIFO queue
![Page 20: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/20.jpg)
FIFO Queue
Page 1Page 1 Page 2Page 2 Page 3Page 3 Page 4Page 4
Page 2Page 2 Page 3Page 3 Page 4Page 4 Page 5Page 5
Oldest Page Newest Page
Page swapped in
Oldest Page Newest Page
![Page 21: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/21.jpg)
FIFO + Second Chance
Page 1Page 1Ref: trueRef: true
Page 2Page 2Ref: trueRef: true
Page 3Page 3Ref: falseRef: false
Page 4Page 4Ref: trueRef: true
Page 4Page 4Ref: trueRef: true
Page 1Page 1Ref: falseRef: false
Page 2Page 2Ref: falseRef: false
Page 5Page 5Ref: trueRef: true
Page swapped in
![Page 22: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/22.jpg)
Part 2
•Make the NACHOS filesystem more useful
•Will be using the NACHOS disk for this
•Flat file hierarchy
![Page 23: Discussion Week 6](https://reader035.vdocuments.mx/reader035/viewer/2022062721/5681372a550346895d9eb617/html5/thumbnails/23.jpg)
Part 2
•Implement Create(), Open(), Remove(), List(), Seek(), Read(), ReadAt(), Write(), WriteAt(), and Length()