Lecture 35: Review for Midterm 2

Slides:



Advertisements
Similar presentations
Chapters 7 & 8 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Advertisements

Chapter 4 Memory Management Basic memory management Swapping
Page Replacement Algorithms
Cache and Virtual Memory Replacement Algorithms
Chapter 101 The LRU Policy Replaces the page that has not been referenced for the longest time in the past By the principle of locality, this would be.
Chapter 3.3 : OS Policies for Virtual Memory
Chapter 11 – Virtual Memory Management
Virtual Memory II Chapter 8.
Page Replacement Algorithms
Chapter 8 Virtual Memory
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
Operating Systems Review.
Operating Systems ECE344 Ding Yuan Final Review Lecture 13: Final Review.
1 Virtual Memory Management B.Ramamurthy. 2 Demand Paging Main memory LAS 0 LAS 1 LAS 2 (Physical Address Space -PAS) LAS - Logical Address.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Virtual Memory Chapter 8.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Paging Algorithms Vivek Pai / Kai Li Princeton University.
CMPT 300: Operating Systems Review THIS REIVEW SHOULD NOT BE USED AS PREDICTORS OF THE ACTUAL QUESTIONS APPEARING ON THE FINAL EXAM.
Virtual Memory Chapter 8.
1 Lecture 9: Virtual Memory Operating System I Spring 2007.
Memory Management Virtual Memory Page replacement algorithms
CSI 400/500 Operating Systems Spring 2009 Lecture #9 – Paging and Segmentation in Virtual Memory Monday, March 2 nd and Wednesday, March 4 th, 2009.
1 Virtual Memory Sample Questions Project 3 – Build Pthread Lib Extra Office Hour: Wed 4pm-5pm HILL 367 Recitation 6.
Virtual Memory Management B.Ramamurthy. Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table.
1 Virtual Memory Management B.Ramamurthy Chapter 10.
OS Spring’04 Virtual Memory: Page Replacement Operating Systems Spring 2004.
Memory Management 2 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping
CSCI2413 Lecture 6 Operating Systems Memory Management 2 phones off (please)
Demand Paging Virtual memory = indirect addressing + demand paging –Without demand paging, indirect addressing by itself is valuable because it reduces.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
CS 153 Design of Operating Systems Spring 2015 Final Review.
Memory Management From Chapter 4, Modern Operating Systems, Andrew S. Tanenbaum.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Virtual Memory. Background Virtual memory is a technique that allows execution of processes that may not be completely in the physical memory. Virtual.
Lecture 11 Page 1 CS 111 Online Virtual Memory A generalization of what demand paging allows A form of memory where the system provides a useful abstraction.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Lecture Topics: 11/24 Sharing Pages Demand Paging (and alternative) Page Replacement –optimal algorithm –implementable algorithms.
Operating Systems ECE344 Ding Yuan Final Review Lecture 13: Final Review.
1 Lecture 8: Virtual Memory Operating System Fall 2006.
CSE Four Fiddy One Section 7 Kurtis Heimerl Aaron Kimball
1 Memory Management Adapted From Modern Operating Systems, Andrew S. Tanenbaum.
Operating Systems ECE344 Ding Yuan Page Replacement Lecture 9: Page Replacement.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 9: Virtual Memory.
Virtual Memory Chapter 8.
Today topics: File System Implementation
Chapter 8 Virtual Memory
Lecture 10: Virtual Memory
Lecture 42: Review for Final Exam
EECE.4810/EECE.5730 Operating Systems
Chapter 9: Virtual-Memory Management
Operating Systems Review.
COT 4600 Operating Systems Spring 2011
Chapter 15 – Part 1 The Internal Operating System
Demand Paged Virtual Memory
Lecture 30: Virtual Memory-Page Replacement Algorithms
Lecture 29: Virtual Memory-Address Translation
Virtual Memory فصل هشتم.
Computer Architecture
Operating Systems CMPSC 473
Virtual Memory: Working Sets
Lecture 9: Caching and Demand-Paged Virtual Memory
CSE 153 Design of Operating Systems Winter 19
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Operating Systems Concepts
Chapter 9: Virtual Memory CSS503 Systems Programming
Chapter 8 & 9 Main Memory and Virtual Memory
CSE 542: Operating Systems
Presentation transcript:

Lecture 35: Review for Midterm 2

About Midterm 2 Cover scheduling, memory management, and file systems. We do have a couple of review questions for the materials covered in the 1st midterm exam. A single-side A4 or US letter sheet of note is allowed 50 minutes

Overview Process Scheduling Memory Management File System

Process scheduling What are the goals of process scheduling? Scheduling Algorithms for Batch Systems First come first serve Shortest job first Shortest remaining time next Scheduling Algorithms for Interactive Systems Round-Robin scheduling Priority scheduling Multiple queues Lottery scheduling

Memory management Memory allocation Memory de-allocation A new process comes into memory Memory de-allocation A process leaves memory Address translation Virtual address to physical address Process isolation One process cannot access the memory of other processes

Virtual memory Paging Address translation via page table MMU Page fault Speed up address translation TLB Large page tables Multi-level page table Inverted page table

Page Replacement Algorithms FIFO (First-In-First-Out) NRU (Not-Recently-Used) Second Chance LRU (Least-Recently-Used) Clock Algorithm(s) Determining which pages to replace is a decision that could have significant ramifications to system performance. If the wrong pages are replaced, i.e. pages which are referenced again fairly soon, then not only must these pages be fetched again, but a new set of pages must be tagged for removal. The FIFO scheme has the benefit of being easy to implement, but often removes the wrong pages. Now, we can’t assume that we have perfect knowledge of a process’s reference pattern to memory, but we can assume that most processes are reasonably “well behaved.” In particular, it is usually the case that pages referenced recently will be referenced again soon, and that pages that haven’t been referenced for a while won’t be referenced for a while. This is the basis for a scheme known as LRU—least recently used. We order pages in memory by the time of their last access; the next page to be removed is the page whose last access was the farthest in the past. A variant of this approach is LFU—least frequently used. Pages are ordered by their frequency of use, and we replace the page which has been used the least frequently of those still in primary storage. Both these latter two policies have the advantage that they behave better for average programs than FIFO, but the disadvantage that they are costly to implement. It is straightforward to implement LRU for the Unix buffer cache, since the time to order the buffers is insignificant compared to the time required to access them. But we cannot afford to maintain pages in order of last reference.

Belady's anomaly Intuitively, more page frames the memory has, the fewer page faults a program will get. Belady 1969

Files Naming Structure Types Access Attributes Operations

Directories Directory systems Path names Operations

File system implmentation Contiguous allocation Linked list allocation Linked list allocation with a table in memory I-nodes

UNIX V7 Directory Implementation The steps in looking up /usr/ast/mbox

Hard links vs. Symbolic links Inode 134 links=2 . 12 .. 14 f1 134 f2 Hard link inode 134 . 12 .. 14 f1 134 f2 208 special file data Symbolic link /home/gong/f1

Sample Questions

Sample Questions RR, Q = 10 P1: 4 36 8 112 1 13 16 P2: 23 40 2 20 13 16 20 P1: 4 36 8 112 1 P2: 23 40 2 P3: 4 20 112 40 2 40 2 40 1 P4: 2 150 3 10 1 Which process goes next, and when? Gantt chart P1 idle P2 P3 P4 0 4 13 23 27 29

Sample Questions MLFQ: Q0 = 8, Q1 = 16, Q2 =  40 q1 45 177 13 16 20 P1: 4 36 8 112 1 P2: 23 40 2 15 P3: 4 20 112 40 2 40 2 40 1 P4: 2 150 3 10 1 Gantt chart 1 idle 2 3 4 2 0 4 13 21 25 27

Sample Questions Which page frame will be replaced? Time loaded Time referenced R bit M bit 60 161 1 130 160 2 26 162 3 20 163 Which page frame will be replaced? First-In-First-Out (FIFO) Not-Recently-Used (NRU) Second Chance Least-Recently-Used (LRU)

Sample Questions Assume file “x” content is: 0123456789876543210 fdrw = open("x", O_RDWR); fdr = open("x", O_RDONLY); read(fdrw, buf, 3); read(fdr, buf2, 4);

Sample Questions Assume file “x” content is: 0123456789876543210 fdrw = open("x", O_RDWR); fdrw2 = dup(fdrw); read(fdrw, buf, 3); read(fdrw2, buf2, 4);

Sample Questions Assume file “x” content is: 0123456789876543210 fdrw = open("x", O_RDWR); Fork(); Parent: read(fdrw, buf, 3); Child: read(fdrw, buf2, 4);