CMPT 300: Final Review Chapters 8 – 14. 2 Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Part IV: Memory Management
Operating Systems ECE344 Ding Yuan Final Review Lecture 13: Final Review.
CS 311 – Lecture 21 Outline Memory management in UNIX
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Memory Management Design & Implementation Segmentation Chapter 4.
Modified from Silberschatz, Galvin and Gagne Lecture 16 Chapter 8: Main Memory.
Operating System Support Focus on Architecture
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
CS 104 Introduction to Computer Science and Graphics Problems
Memory Management 2010.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Computer Organization and Architecture
Main Memory. Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are only.
03/17/2008CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
03/05/2008CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
COMPSYS 304 Computer Architecture Memory Management Units Reefed down - heading for Great Barrier Island.
Chap 8 Memory Management. Background Program must be brought into memory and placed within a process for it to be run Input queue – collection of processes.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Example of a Resource Allocation Graph CS1252-OPERATING SYSTEM UNIT III1.
Operating Systems CMPSC 473 I/O Management (4) December 09, Lecture 25 Instructor: Bhuvan Urgaonkar.
Silberschatz and Galvin  Chapters 3 and 5 Possible questions –Tracing a given program involving fork, exec, semaphores, and share memory –Wring.
Chapter 11: File System Implementation Hung Q. Ngo KyungHee University Spring 2009
Review of Memory Management, Virtual Memory CS448.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
CS 153 Design of Operating Systems Spring 2015 Final Review.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 8: Main Memory.
Operating Systems Chapter 8
Chapter 5 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
Chapter 4 Storage Management (Memory Management).
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
OSes: 11. FS Impl. 1 Operating Systems v Objectives –discuss file storage and access on secondary storage (a hard disk) Certificate Program in Software.
Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Page Replacement Allocation of.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
1 Rutgers UniversityCS 416: Operating Systems Final exam details December 22, pm-3pm. Venue: SEC 118. Tips: Spend time reading the questions before.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Chapter 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
Chapters 3 and 5 Possible questions
Chapter 11: File System Implementation
Operating System I/O System Monday, August 11, 2008.
Review.
Lecture 45 Syed Mansoor Sarwar
Main Memory Management
Chapter 8: Main Memory.
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
Chapter 9: Virtual-Memory Management
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
So far… Text RO …. printf() RW link printf Linking, loading
Memory Management-I 1.
Main Memory Background Swapping Contiguous Allocation Paging
Chapter 8: Memory management
Outline Module 1 and 2 dealt with processes, scheduling and synchronization Next two modules will deal with memory and storage Processes require data to.
Lecture 3: Main Memory.
Chapter 8: Memory Management strategies
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
COMP755 Advanced Operating Systems
CSE 542: Operating Systems
Page Main Memory.
Presentation transcript:

CMPT 300: Final Review Chapters 8 – 14

2 Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory unit User program deals with logical addresses; never sees physical addresses Mapping from logical to physical addresses Static: done at compile-time Dynamic: done at load or execution time

3 Memory Allocation Memory is usually divided into two partitions for: Kernel: usually held in low memory User processes: usually held in high memory Typically, the two partitions are managed differently Memory allocation Contiguous  First-, Best-, Worst-fit  Fragmentation: external and internal Paging, segmentation, virtual memory

4 Paging

5 Segmentation user spacephysical memory space

6 Segmentation Hardware

7 Paging and Segmentation Paging issues: Page size  Internal fragmentation and page table size Page table (one table for each process)  Access time: use cache (TLB)  Size: use two- or three-levels page tables use hashed or inverted page tables for > 32 bits architectures Segmentation: variable size External fragmentation Facilitates sharing of code and data (share the whole segment) Combined Segmentation + paging: Example Intel Pentium

8 Virtual Memory Logical address space can be much larger than physical address space Only the needed parts of the program are brought to memory for execution Allows address spaces to be shared by several processes Allows for more efficient process creation Virtual memory can be implemented via Demand paging Demand segmentation

9 Virtual Memory and Page Fault

10 Page Replacement When we need to bring a page from disk and there is no free frame: Find a victim page to evict from memory Objective: minimize number of page faults (they are very costly) Replacement algorithms FIFO, OPT, LRU, second-chance, …

11 Thrashing Thrashing  a process is busy swapping pages in and out more than executing (because OS allocated too few frames to it)

12 Locality Model As a process executes, it moves from locality to locality, where a locality is a set of pages that are actively used together Locality could be: function, module, segment of code, … Locality model helps us to estimate the working set of a process Working set: pages that are actively being used (within a window)

13 Allocating Kernel Memory Treated differently from user memory because Kernel requests memory for structures of varying sizes  Process descriptors (PCB), semaphores, file descriptors, …  Some of them are less than a page Some kernel memory needs to be contiguous  some hardware devices interact directly with physical memory without using virtual memory Virtual memory may just be too expensive for the kernel (cannot afford a page fault)

14 Kernel Memory: Buddy System

15 Kernel Memory: Slab Allocation

16 File Systems: Ch. 10, 11, 12  Interface: file and directory structure  Maintains pointers to logical block addresses Application Programs Logical File System File-organization Module Device Drivers Storage Devices  Implementation: device-specific instructions  Writes specific bit patterns to device controller  Implementation: block allocation, …  Maps logical into physical addresses

17 File System Interface Files The smallest storage unit from the user’s perspective A collection of blocks on the disk from OS’ perspective Directory structure Tree-structured with links (general graphs) Each file has an entry in the directory

18 File System Implementation To implement a file system, we need On-disk structures, e.g.,  directory structure, number of blocks, location of free blocks, boot information, …  (In addition to data blocks, of course) In-memory structures to:  improve performance (caching)  manage file system

19 On-disk Structures Boot block Superblock Directory structure Free block File control block Data block

20 Opening and Reading from a File

21 Block Allocation Allocate free blocks to files to achieve efficient disk space utilization, and fast file access Three common allocation methods Contiguous Linked Indexed OS keeps track of free blocks using Bitmaps Linked lists

22 Combined Scheme: UNIX inode

23 Disk Structure and Scheduling Disk structure cylinders, tracks, sectors, logical blocks Disk operation Move the head to desired track (seek time) Wait for desired sector to rotate under the head (rotational latency time) Transfer the block to a local buffer, then to main memory (transfer time) Disk scheduling To minimize seek time (head movements) Algorithms: FCFC, SSTF, SCAN, LOOK

24 Protection: Ch. 14 Protection: Ensure that each object is accessed correctly and only by those processes that are allowed to do so A process operates within a protection domain Domain = set of access rights (= user-id in UNIX)

25 Access Matrix Protection as a matrix Implemented as Access Control List (columns), or Capability List (rows)

26 Protection in UNIX Default: Coarse-grained protection using 9 bits rwx rwx rwx filename Owner group all_others Optional: fine-grained protection using Access Control List

27 Warp Up: What We Have Covered How to manage resources in a single computer

28 Warp Up: What We Have NOT Covered How to manage resources distributed over multiple computers CMPT 371: Computer Networks  Protocols and algorithms to make computers talk to each other CMPT 401: Operating Systems II  Distributed file systems, distributed synchronization, inter- process communications, consistency and reliability, security Special-purpose operating systems, e.g., Real-time OS OS on small devices (PDAs, sensors,…)

29 That is it with CMPT 300! Good Luck on Your Final