CHAPTER 3 RESOURCE MANAGEMENT

Similar documents
Chapter 8 Memory Management

CS399 New Beginnings. Jonathan Walpole

Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation

Preview. Memory Management

Memory: Overview. CS439: Principles of Computer Systems February 26, 2018

MEMORY MANAGEMENT. Jo, Heeseung

Last Class: Deadlocks. Where we are in the course

UNIT III MEMORY MANAGEMENT

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Operating Systems Unit 6. Memory Management

Last class: Today: Deadlocks. Memory Management

ECE519 Advanced Operating Systems

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358

12: Memory Management

Memory Management Virtual Memory

With regard to operating systems the kernel consists of the most frequently used functions in the operating system and it kept in main memory.

Memory Management. Jo, Heeseung

Chapter 8. Virtual Memory

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

MEMORY MANAGEMENT/1 CS 409, FALL 2013


CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 27, SPRING 2013

Operating Systems Memory Management. Mathieu Delalandre University of Tours, Tours city, France

Chapter 8 Virtual Memory

Memory Management. Frédéric Haziza Spring Department of Computer Systems Uppsala University

Chapter 8 Virtual Memory

Operating System Principles: Memory Management Swapping, Paging, and Virtual Memory CS 111. Operating Systems Peter Reiher

Virtual Memory I. Jo, Heeseung

Memory and multiprogramming

Operating Systems. Memory Management. Lecture 9 Michael O Boyle

Operating Systems. 09. Memory Management Part 1. Paul Krzyzanowski. Rutgers University. Spring 2015

Operating systems. Part 1. Module 11 Main memory introduction. Tami Sorgente 1

Goals of Memory Management

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

CPE300: Digital System Architecture and Design

Memory Management: Virtual Memory and Paging CS 111. Operating Systems Peter Reiher

The memory of a program. Paging and Virtual Memory. Swapping. Paging. Physical to logical address mapping. Memory management: Review

Memory Management Basics

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 27, FALL 2012

Chapter 8 Virtual Memory

Lecture 7. Memory Management

Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1

Operating Systems and Computer Networks. Memory Management. Dr.-Ing. Pascal A. Klein

Introduction to Operating Systems

CS370 Operating Systems

Chapters 9 & 10: Memory Management and Virtual Memory

Chapter 8: Memory Management. Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging

Virtual Memory. control structures and hardware support

Paging. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Memory Management. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory

Memory Management william stallings, maurizio pizzonia - sistemi operativi

Main Memory (Part I)

CHAPTER 6 Memory. CMPS375 Class Notes (Chap06) Page 1 / 20 Dr. Kuo-pao Yang

Q1. What is Deadlock? Explain essential conditions for deadlock to occur?

Chapter 8 Main Memory

14 May 2012 Virtual Memory. Definition: A process is an instance of a running program

Memory Management (1) Memory Management

Memory Management (1) Memory Management. CPU vs. memory. No.8. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

COSC Operating Systems Design, Fall 2001, Byunggu Yu. Chapter 9 Memory Management (Lecture Note #8) 1. Background

Operating Systems (2INC0) 2017/18

Virtual Memory. Kevin Webb Swarthmore College March 8, 2018

Performance of Various Levels of Storage. Movement between levels of storage hierarchy can be explicit or implicit

6 - Main Memory EECE 315 (101) ECE UBC 2013 W2

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Chapter 4: Memory Management. Part 1: Mechanisms for Managing Memory

The Memory Management Unit. Operating Systems. Autumn CS4023

CS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College November 15, 2018

Course Outline. Processes CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Distributed Systems

CISC 7310X. C08: Virtual Memory. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/22/2018 CUNY Brooklyn College

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time

memory management Vaibhav Bajpai

Operating Systems Design Exam 2 Review: Spring 2011

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition

Memory Hierarchy. Goal: Fast, unlimited storage at a reasonable cost per bit.

Today: Segmentation. Last Class: Paging. Costs of Using The TLB. The Translation Look-aside Buffer (TLB)

CS 416: Opera-ng Systems Design March 23, 2012

Unit II: Memory Management

General Objective:To understand the basic memory management of operating system. Specific Objectives: At the end of the unit you should be able to:

ECE 598 Advanced Operating Systems Lecture 10

CS 261 Fall Mike Lam, Professor. Virtual Memory

Operating Systems CSE 410, Spring Virtual Memory. Stephen Wagner Michigan State University

File Systems. OS Overview I/O. Swap. Management. Operations CPU. Hard Drive. Management. Memory. Hard Drive. CSI3131 Topics. Structure.

Memory Management. To do. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory

Requirements, Partitioning, paging, and segmentation

Virtual Memory. CS61, Lecture 15. Prof. Stephen Chong October 20, 2011

Operating Systems. Paging... Memory Management 2 Overview. Lecture 6 Memory management 2. Paging (contd.)

Virtual Memory. Chapter 8

Recall: Address Space Map. 13: Memory Management. Let s be reasonable. Processes Address Space. Send it to disk. Freeing up System Memory

Processes and Tasks What comprises the state of a running program (a process or task)?

Chapter 9 Real Memory Organization and Management

Chapter 9 Real Memory Organization and Management

CS Operating Systems

CS Operating Systems

John Wawrzynek & Nick Weaver

Main Memory. CISC3595, Spring 2015 X. Zhang Fordham University

Paging. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Basic Memory Management

Recall from Tuesday. Our solution to fragmentation is to split up a process s address space into smaller chunks. Physical Memory OS.

a process may be swapped in and out of main memory such that it occupies different regions

Transcription:

CHAPTER 3 RESOURCE MANAGEMENT

SUBTOPIC Understand Memory Management Understand Processor Management

INTRODUCTION Memory management is the act of managing computer memory. This involves providing ways to allocate portions of memory to programs at their request, and freeing it for reuse when no longer needed. The management of main memory is critical to the computer system.

THE PURPOSE Why memory management? Process isolation Automatic allocation and management Support for modular programming Protection and access control Long term storage

RESIDENT ROUTINES In a cache system, that part of the cached storage which currently has a copy in the cache is called resident. Ideally, the working set should be resident. resident set In a virtual memory system, a process resident set is that part of a process' address space which is currently in main memory. If this does not include all of the process' working set, the system may thrash.

cache A cache is any small, fast piece of storage, used for copies of data that normally reside in a larger, slower piece of storage. The cache is used to speed up access to data resident in the slower storage. In a typical cache, recently used data is resident in the cache (although the details of this depend on the cache policy). A cache is the most common example of a cache.

Resident and Transient Resident A routine that stays in memory. Transient A routine that is loaded as needed. Transient area Memory for application programs and transient routines.

Instruction execution cycle Fetch an instruction (opcode) from memory Decode instruction Fetch operands from memory, if needed Execute instruction Store results into memory, if necessary FETCH DECODE EXECUTE STORE

FIXED-PARTITION MEMORY MANAGEMENT Simplest memory management scheme for multiprogrammed systems Divide memory into fixed size partitions, possibly of different size Partitions fixed at system initialization time and may not be changed during system operation Single-Partition Allocation User is provided with a bare machine User has full control of entire memory space

Advantages Maximum flexibility to the user. User controls the use of memory as per his own desire Maximum possible simplicity Minimum cost No need for special hardware No need for operating system software

Disadvantages No services OS has no control over interrupts No mechanism to process system calls and errors No space to provide multiprogramming

DYNAMIC MEMORY MANAGEMENT In computer science, dynamic memory allocation (also known as heap-based memory allocation) is the allocation of memory storage for use in a computer program during the runtime of that program. It can be seen also as a way of distributing ownership of limited memory resources among many pieces of data and code. Dynamically allocated memory exists until it is released either explicitly by the programmer, or by the garbage collector. This is in contrast to static memory allocation, which has a fixed duration. It is said that an object so allocated has a dynamic lifetime.

RUNTIME The qualifier run time, run-time, runtime, or execution time refers to the period while a computer program is actually executed ("run") in a computer, from beginning to termination. It may also mean the program's running time, the duration of that period.

First-fit strategy Allocate first hole that is big enough Stop searching as soon as first hole large enough to hold the process is found Best-fit strategy Allocate the smallest hole that is big enough Entire list of holes is to be searched Search of entire list can be avoided by keeping the list of holes sorted by size Worst-fit strategy Allocate the largest available hole Similar problems as the best-fit approach

SEGMENTATION In computing, memory segmentation is one of the most common ways to achieve memory protection; another common one is paging. In a computer system using segmentation, an instruction operand that refers to a memory location includes a value that identifies a segment and an offset within that segment. A segment has a set of permissions, and a length, associated with it.

If the currently running process is allowed by the permissions to make the type of reference to memory that it is attempting to make, and the offset within the segment is within the range specified by the length of the segment, the reference is permitted; otherwise, a hardware exception is raised.

In addition to the set of permissions and length, a segment also has associated with it information indicating where the segment is located in memory. It may also have a flag indicating whether the segment is present in main memory or not; if the segment is not present in main memory, an exception is raised, and the operating system will read the segment into memory from secondary storage.

PAGING In computer operating systems there are various ways in which the operating system can store and retrieve data from secondary storage for use in main memory. One such memory management scheme is referred to as paging. In the paging memory-management scheme, the operating system retrieves data from secondary storage in same-size blocks called pages.

The main advantage of paging is that it allows the physical address space of a process to be noncontiguous. Prior to paging, systems had to fit whole programs into storage contiguously which caused various storage and fragmentation problems.

Paging is an important part of virtual memory implementation in most contemporary general-purpose operating systems, allowing them to use disk storage for data that does not fit into physical RAM. Paging is usually implemented as architecture-specific code built into the kernel of the operating system.

The information indicating where the segment is located in memory might be the address of the first location in the segment, or might be the address of a page table for the segment, if the segmentation is implemented with paging. In the first case, if a reference to a location within a segment is made, the offset within the segment will be added to address of the first location in the segment to give the address in memory of the referred-to item; in the second case, the offset of the segment is translated to a memory address using the page table.

The main functions of paging are performed when a program tries to access pages that are not currently mapped to physical memory (RAM). This situation is known as a page fault. The operating system must then take control and handle the page fault, in a manner invisible to the program.

Therefore, the operating system must: Determine the location of the data in auxiliary storage. Obtain an empty page frame in RAM to use as a container for the data. Load the requested data into the available page frame. Update the page table to show the new data. Return control to the program, transparently retrying the instruction that caused the page fault.

DYNAMIC ADDRESS TRANSLATION Dynamic address translation, or DAT, is the process of translating a virtual address during a storage reference into the corresponding real address. If the virtual address is already in central storage, the DAT process may be accelerated through the use of a translation look aside buffer. If the virtual address is not in central storage, a page fault interrupt occurs, OS is notified and brings the page in from auxiliary storage.

DAT is implemented by both hardware and software through the use of page tables, segment tables, region tables and translation look aside buffers. DAT allows different address spaces to share the same program or other data that is for read only. This is because virtual addresses in different address spaces can be made to translate to the same frame of central storage. Otherwise, there would have to be many copies of the program or data, one for each address space.

How Virtual Memory Works Virtual memory is a common part of most operating systems on desktop computers. It has become so common because it provides a big benefit for users at a very low cost. Most computers today have something like 32 or 64 megabytes of RAM available for the CPU to use. Unfortunately, that amount of RAM is not enough to run all of the programs that most users expect to run at once.

For example, if you load the operating system, an e-mail program, a Web browser and word processor into RAM simultaneously, 32 megabytes is not enough to hold it all. If there were no such thing as virtual memory, then once you filled up the available RAM your computer would have to say, "Sorry, you can not load any more applications. Please close another application to load a new one." With virtual memory, what the computer can do is look at RAM for areas that have not been used recently and copy them onto the hard disk. This frees up space in RAM to load the new application.

Because this copying happens automatically, you don't even know it is happening, and it makes your computer feel like is has unlimited RAM space even though it only has 32 megabytes installed. Because hard disk space is so much cheaper than RAM chips, it also has a nice economic benefit. The read/write speed of a hard drive is much slower than RAM, and the technology of a hard drive is not geared toward accessing small pieces of data at a time. If your system has to rely too heavily on virtual memory, you will notice a significant performance drop. The key is to have enough RAM to handle everything you tend to work on simultaneously -- then, the only time you "feel" the slowness of virtual memory is is when there's a slight pause when you're changing tasks. When that's the case, virtual memory is perfect.

When it is not the case, the operating system has to constantly swap information back and forth between RAM and the hard disk. This is called thrashing, and it can make your computer feel incredibly slow. The area of the hard disk that stores the RAM image is called a page file. It holds pages of RAM on the hard disk, and the operating system moves data back and forth between the page file and RAM. On a Windows machine, page files have a.swp extension.

MEMORY MANAGEMENT CPU CACHE RAM VIRTUAL MEMORY DISK STORAGE FIGURE 1 : MEMORY MANAGEMENT FLOW WORK