Lecture 9 Virtual memory OS

Lecture 9 Virtual memory OS - Administrivia Project 2 due...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Administrivia Project 2 due Thursday- As before, free extension to midnight if you come to class Use the newsgroup!- Lots of similar questions to cs140-staff- TAs are too polite to tell people to ask on newsgroup- But everyone benefits if these questions are answered in public- Plus Ben Pfaff answers questions on newsgroup Midterm one week from today- Open book, open notes (but not open notebook computer) Review section for midterm this Friday Section for Project 3 next Friday 1/41 Paging Use disk to simulate larger virtual than physical mem 2/41 Working set model Disk much, much slower than memory- Goal: Run at memory, not disk speeds 90/10 rule: 10% of memory gets 90% of memory refs- So, keep that 10% in real memory, the other 90% on disk- How to pick which 10%? 3/41 Paging challenges How to resume a process after a fault?- Need to save state and resume- Process might have been in the middle of an instruction! What to fetch?- Just needed page or more? What to eject?- How to allocate physical pages amongst processes?- Which of a particular processs pages to keep in memory? 4/41 Re-starting instructions Hardware provides kernel w. info about page fault- Faulting virtual address (In %cr2 reg on x86may have seen it if you modified Pintos page fault and used fault addr )- Address of instruction that caused fault- Was the access a read or write? Was it an instruction fetch? Was it caused by user access to kernel-only memory? Hardware must allow resuming after a fault Idempotent instructions are easy- E.g., simple load or store instruction can be restarted- Just re-execute any instruction that only accesses one address Complex instructions must be re-started, too- E.g., x86 move string instructions- Specify srd, dst, count in %esi, %edi, %ecx registers- On fault, registers adjusted to resume where move left off 5/41 What to fetch Bring in page that caused page fault Pre-fetch surrounding pages?- Reading two disk blocks approximately as fast as reading one- As long as no track/head switch, seek time dominates- If application exhibits spacial locality, then big win to store and read multiple contiguous pages Also pre-zero unused pages in idle loop- Need 0-filled pages for stack, heap, anonymously mmapped memory- Zeroing them only on demand is slower- So many OSes zero freed pages while CPU is idle 6/41 Selecting physical pages May need to eject some pages- More on eviction policy in two slides May also have a choice of physical pages Direct-mapped physical caches- Virtual Physical mapping can affect performance- Applications can conflict with each other or themselves- Scientific applications benefit if consecutive virtual pages to not conflict in the cache- Many other applications do better with random mapping 7/41 Superpages How should OS make use of large mappings- x86 has 2/4MB pages that might be useful- Alpha has even more choices: 8KB, 64KB, 512KB, 4MB...
View Full Document

This note was uploaded on 03/13/2010 for the course CS 02523 taught by Professor Davidmieres during the Winter '10 term at A.T. Still University.

Page1 / 44

Lecture 9 Virtual memory OS - Administrivia Project 2 due...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online