This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Monday, May 4 Project #3 We will contact you if your Plan of Attack has run off the road Be sure to follow kernel coding guidelines Comments on Rob's seminar? Other? Midterm Exam in class Wednesday Today's topics Wrap up virtual memory Homework #3 Review for midterm Solutions are posted Virtual memory Possibly only part of an executing program needs to be in main memory at a given time. Logical address space can be much larger than physical address space Allows address spaces to be shared by several processes. use disk space (secondary memory) as if it were main memory Demand Paging Bring a page into main memory only when it is referenced. When a process references some part of a page, the entire page must be in a main memory frame Less main memory needed Space for more processes, more users Page stays in main memory until it is replaced Must prevent overallocation of memory If referenced page is not in main memory, load it. Basic Page Replacement
s s Find the location on disk of the page that is to be loaded. Find a free frame:
If there is a free frame, use it. If there is no free frame, use a page replacement algorithm to select a victim frame.
Copy the victim to disk (if dirty) s 3. 4. 5. Copy the desired page into the (newly) free frame. Update the page and frame tables. Start/resume the process. Page Replacement Algorithms Algorithm evaluation: for each algorithm ... Run algorithm on a particular string of memory references (reference string) Compute the number of page faults on that string. Goal: minimize number of page faults!! Considerations / Tradeoffs Prepaging Page size selection Attempt to bring in multiple pages Anticipatory paging Exploit locality of reference Avoid fragmentation Minimize page table size Minimize I/O overhead Considerations / Tradeoffs TLB Reach The amount of memory accessible from the TLB. Ideally, the active pages of each process are referenced by the TLB. TLB Reach = (TLB Size) X (Page Size) Otherwise there may be a high degree of page faults. Considerations / Tradeoffs Increase the size of the TLB? Increase the Page Size? expensive Smaller page tables May cause increased internal fragmentation Provide Multiple Page Sizes? not all applications require a large page size. Allows applications that require larger page sizes the opportunity to use them without an increase in fragmentation. Increases bookkeeping Considerations / Tradeoffs Program structure for (j = 0; j < 1024; j++) for (i = 0; i < 1024; i++) A[i,j] = 0; int A = new int; Each row is stored in one page One frame allocated Program 1 (assume rowmajor order) 1024 x 1024 = 1,048,576 page faults Considerations / Tradeoffs Program structure for (i = 0; i < 1024; i++) for (j = 0; j < 1024; j++) A[i,j] = 0; 1024 page faults One frame allocated Program 2 (assume rowmajor order) Page Locking Some pages may be critical, swapped too frequently, shared by multiple processes, etc. Additional bit may be used to lock a page Page may not be selected as a victim Summary (Virtual Memory) Separation of logical memory from physical memory. From user's perspective, secondary memory is used as if it were primary memory Thrashing Executing program must be in primary memory Page faults Page swapping/overlays Summary (Virtual Memory) Pageswapping algorithms. (Victim selection) Goal is lowest pagefault rate. FIFO LRU LFU/MFU Optimal Belady's Anomaly Test/compare with reference string Summary (Virtual Memory) Performance Memory allocation Pagefault rate, pagefault overhead Effective access time Fixed (equal, proportional) Priority Clean/dirty pages Page size Program structure Locked pages Etc. Other factors Homework #3 Wednesday, May 6, inclass Covers Midterm exam Format Love Chapters 1 5, 11, 14, [15, 18] Lectures 1 16 Homeworks 1 3 Quiz 1 Projects 1 2 Mostly shortanswer Calculator and 4x6 notecard encouraged No sharing Midterm: OS Fundamentals Definition(s) User/System views Factors affecting decisions/tradeoffs in design/implementation Protection Architectures, environments, etc Dualmode operation, permissions, privileged instructions, etc. Midterm: Processes Process/program definitions What's in the process environment? PID, Lifecycle How is process created? Process control Create/terminate, load/link, suspend/resume PCB (what's in it?) Instruction execution cycle Process state Parent/child, init() Midterm: Concurrent Processes
Multiprocessing, concurrency Short, intermediate, longterm schedulers Contextswitching CPU burst time I/Obound, CPUbound processes Predicting with exponential averaging Midterm: CPU Scheduling
Queues (ready, waiting, etc.) How does CPU become available? Scheduling criteria, algorithms FCFS, SJF, SRTF, Priority, RR Preemptive, nonpreemptive Linux schedulers Starvation, aging Midterm: Memory Management Process address space Logical/physical addresses, address binding Contiguous allocation, algorithms Fragmentation First, best, worstfit Internal, external Pages, frames, page tables, TLB, EAT Segmentation Midterm: Virtual Memory Demand paging Page faults, page replacement Page replacement algorithms Dirty/clean pages Performance FIFO, LRU, MFU, LFU, Optimal Goals Belady's anomaly Page fault rate, overhead, EAT Midterm: Virtual Memory Page allocation Thrashing Fixed, proportional, priority Causes, consequences Other factors, tradeoffs Midterm: Kernel Development Virtual machine, version control, etc. Kernel Coding Style Motivations Rules Questions? Midterm Wednesday ...
View Full Document
This note was uploaded on 06/28/2009 for the course CS 411 taught by Professor Staff during the Spring '08 term at Oregon State.
- Spring '08
- Operating Systems