1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
Paging Hardware With TLB
Advanced Operating Systems - Spring 2009 Lecture 17 – March 23, 2009 Dan C. Marinescu Office: HEC 439 B. Office hours:
1 Thursday, July 06, 2006 “Experience is something you don't get until just after you need it.” - Olivier.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 17: Wrapping up Virtual Memory.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
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.
Chapter 8.3: Memory Management
Memory Management.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
03/10/2004CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Chapter 7: Main Memory CS 170, Fall Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
Silberschatz, Galvin and Gagne  Operating System Concepts Segmentation Memory-management scheme that supports user view of memory. A program.
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.
 Background  Swapping  Contiguous Allocation  Paging  Segmentation  Segmentation with Paging.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Memory Management -1 Background Swapping Memory Management Schemes
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 8 Operating Systems.
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.
8.4 paging Paging is a memory-management scheme that permits the physical address space of a process to be non-contiguous. The basic method for implementation.
CS212: OPERATING SYSTEM Lecture 5: Memory Management Strategies 1 Computer Science Department.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
Page 110/20/2015 CSE 30341: Operating Systems Principles So far…  Page  Fixed size pages solve page allocation problem (and external fragmentation) 
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Memory Management 1. Background Programs must be brought (from disk) into memory for them to be run Main memory and registers are only storage CPU can.
Silberschatz and Galvin  Operating System Concepts Module 8: Memory Management Background Logical versus Physical Address Space Swapping Contiguous.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
8.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Implementation of Page Table Page table is kept in main memory Page-table base.
CE Operating Systems Lecture 14 Memory management.
Operating Systems CMPSC 473 Virtual Memory Management (4) November – Lecture 22 Instructor: Bhuvan Urgaonkar.
1 Memory Management (b). 2 Paging  Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter.
9.1 Operating System Concepts Paging Example. 9.2 Operating System Concepts.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
9.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 9.5 Allocation of Frames Each process needs minimum number of pages Example: machine.
CSC 360, Instructor Kui Wu Memory Management I: Main Memory.
Memory Management. Background Memory consists of a large array of words or bytes, each with its own address. The CPU fetches instructions from memory.
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Fragmentation External Fragmentation – total memory space exists to satisfy.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Memory Management Strategies.
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 9: Virtual Memory.
Chapter 8: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Chapter 2: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging Operating System Concepts.
W4118 Operating Systems Instructor: Junfeng Yang.
Main Memory: Paging and Segmentation CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition, Chapter 8: Memory- Management Strategies.
Chapter 9: Virtual Memory – Part II
Chapter 8: Memory Management
Chapter 8: Main Memory.
Paging and Segmentation
Chapter 8: Main Memory.
Storage Management Chapter 9: Memory Management
Operating System Concepts
Segmentation Lecture November 2018.
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
Main Memory Background Swapping Contiguous Allocation Paging
Main Memory Session - 16.
Lecture 3: Main Memory.
Chapter 8: Memory Management strategies
Lecture 35 Syed Mansoor Sarwar
COMP755 Advanced Operating Systems
Presentation transcript:

1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof. Mark Corner and Prof. Emery Berger’s OS course at Umass Amherst Assistant Professor, University of Maryland Baltimore County

2 Announcements Homework 3 will be out tomorrow Grades will be out for the midterm and project 1 before end of weekend.

Thrashing If a process does not have “enough” pages, the page-fault rate is very high –Page fault to get page –Replace existing frame –But quickly need replaced frame back –This leads to: Low CPU utilization Operating system thinking that it needs to increase the degree of multiprogramming Another process added to the system Thrashing  a process is busy swapping pages in and out

Allocating Kernel Memory Treated differently from user memory Often allocated from a free-memory pool –Kernel requests memory for structures of varying sizes –Some kernel memory needs to be contiguous I.e. for device I/O

Buddy System Allocates memory from fixed-size segment consisting of physically-contiguous pages Memory allocated using power-of-2 allocator –Satisfies requests in units sized as power of 2 –Request rounded up to next highest power of 2 –When smaller allocation needed than is available, current chunk split into two buddies of next-lower power of 2 Continue until appropriate sized chunk available For example, assume 256KB chunk available, kernel requests 21KB –Split into A L and A r of 128KB each One further divided into B L and B R of 64KB –One further into C L and C R of 32KB each – one used to satisfy request Advantage – quickly coalesce unused chunks into larger chunk Disadvantage - fragmentation

Buddy System Allocator

Slab Allocator Alternate strategy Slab is one or more physically contiguous pages Cache consists of one or more slabs Single cache for each unique kernel data structure –Each cache filled with objects – instantiations of the data structure When cache created, filled with objects marked as free When structures stored, objects marked as used If slab is full of used objects, next object allocated from empty slab –If no empty slabs, new slab allocated Benefits include no fragmentation, fast memory request satisfaction

Slab Allocation

Segmentation (another method of implementing virtual memory) Memory-management scheme that supports user view of memory A program is a collection of segments –A segment is a logical unit such as: main program procedure function method object local variables, global variables common block stack symbol table arrays

User’s View of a Program

Logical View of Segmentation user spacephysical memory space

Segmentation Architecture Logical address consists of a two tuple:, Segment table – maps two-dimensional physical addresses; each table entry has: –base – contains the starting physical address where the segments reside in memory –limit – specifies the length of the segment Segment-table base register (STBR) points to the segment table’s location in memory Segment-table length register (STLR) indicates number of segments used by a program; segment number s is legal if s < STLR

Segmentation Architecture (Cont.) Protection –With each entry in segment table associate: validation bit = 0  illegal segment read/write/execute privileges Protection bits associated with segments; code sharing occurs at segment level Since segments vary in length, memory allocation is a dynamic storage-allocation problem A segmentation example is shown in the following diagram

Segmentation Hardware

15 File Systems (Lets start with the disk) Disk (hard drive) is a block device –You can read and write blocks from the hard drive –E.g. give me block number 50, or block number 100 –Blocks are usually 1KB in size You can also create logical block sizes –E.g. using the command dd –Example of creating files without file system (demo?) You can write file systems for block devices (e.g., cdrom, harddrive, flash drives) Another type of devices is character devices? –Examples? –What are the major differences between char and block devices

16 File system structure and file manipulations File systems are made of directories –In linux the root directory is / All directories are children of some directory –Directories follow a tree structure Directories consist of files –We will later talk about how files and directories are represented Files are associated with two things –Name of the file –Pointer to the data stored in the file

17 Concept of virtual file systems In linux you can use the concept of mounting to add a custom file system to your directory tree You can also mount directories on remote machines onto your file system tree Lets take a look at a demo

(a) Existing (b) Unmounted Partition

Mount Point

20 Common file operations (you might be familiar with) Creating directories Removing directories Creating a file Open and reading a file Deleting a file Creating a soft link to a file Creating a hard link to a file Append a file Read last few bytes/characters of a file

Protection File owner/creator should be able to control: –what can be done –by whom Types of access –Read –Write –Execute –Append –Delete –List

Access Lists and Groups Mode of access: read, write, execute Three classes of users RWX a) owner access 7  RWX b) group access 6  RWX c) public access1  Ask manager to create a group (unique name), say G, and add some users to the group. For a particular file (say game) or subdirectory, define an appropriate access. ownergrouppublic chmod761game

23 In-class Discussion