Contiguous Allocation (Cont.)

Similar documents
Memory management. Chapter 4: Memory Management. Memory hierarchy. In an ideal world. Basic memory management. Fixed partitions: multiple programs

Memory Management Outline. Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging

The Deadlock Problem. Deadlocks. Deadlocks. Bridge Crossing Example

Memory management basics (1) Requirements (1) Objectives. Operating Systems Part of E1.9 - Principles of Computers and Software Engineering

OPERATING SYSTEM - MEMORY MANAGEMENT

COS 318: Operating Systems. Virtual Memory and Address Translation

Virtual vs Physical Addresses

OPERATING SYSTEMS MEMORY MANAGEMENT

C-Bus Voltage Calculation

Application of Improved SSL in Data Security Transmission of Mobile Database System

Computer-System Architecture

& Data Processing 2. Exercise 3: Memory Management. Dipl.-Ing. Bogdan Marin. Universität Duisburg-Essen

Chapter 7 Memory Management

10.2 Systems of Linear Equations: Matrices

CS5460: Operating Systems

W4118: segmentation and paging. Instructor: Junfeng Yang

An Approach to Optimizations Links Utilization in MPLS Networks

File System & Device Drive. Overview of Mass Storage Structure. Moving head Disk Mechanism. HDD Pictures 11/13/2014. CS341: Operating System

Chapter 7 Memory Management

Virtual Memory and Address Translation

CS 61C: Great Ideas in Computer Architecture Virtual Memory Cont.

The Impact of Forecasting Methods on Bullwhip Effect in Supply Chain Management

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation

Operating Systems, 6 th ed. Test Bank Chapter 7

Concurrent Program Synthesis Based on Supervisory Control

Improving Emulation Throughput for Multi-Project SoC Designs

Chapter 2: Computer-System Structures. Computer System Operation Storage Structure Storage Hierarchy Hardware Protection General System Architecture

Memory Management CS 217. Two programs can t control all of memory simultaneously

SD05C through SD24C. Single Line TVS Diode for ESD Protection in Portable Electronics PRELIMINARY Features. PROTECTION PRODUCTS Description

An Efficient Method for Improving Backfill Job Scheduling Algorithm in Cluster Computing Systems

Storage Basics Architecting the Storage Supplemental Handout

Enterprise Resource Planning

One-Chip Linear Control IPS, F5106H

Memory unit sees only the addresses, and not how they are generated (instruction counter, indexing, direct)

Chapter 11: File System Implementation. Operating System Concepts with Java 8 th Edition

1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management

Wavefront Sculpture Technology

Sage Timberline Office

Lecture 17: Virtual Memory II. Goals of virtual memory

Energy consumption in pumps friction losses

EECS 122: Introduction to Communication Networks Homework 3 Solutions

Point Location. Preprocess a planar, polygonal subdivision for point location queries. p = (18, 11)

Text Analytics. Modeling Information Retrieval 2. Ulf Leser

A Data Placement Strategy in Scientific Cloud Workflows

These draft test specifications and sample items and other materials are just that drafts. As such, they will systematically evolve over time.

Two Parts. Filesystem Interface. Filesystem design. Interface the user sees. Implementing the interface

Sage Document Management. User's Guide Version 12.1

Sage Document Management. User's Guide Version 13.1

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

LCDA12C-8 and LCDA15C-8

State of Louisiana Office of Information Technology. Change Management Plan

17609: Continuous Data Protection Transforms the Game

Secondary Storage. Any modern computer system will incorporate (at least) two levels of storage: magnetic disk/optical devices/tape systems

Operating Systems. Virtual Memory

Lecture 11: Advanced Topics

Operating Systems CSE 410, Spring File Management. Stephen Wagner Michigan State University

Solid State Drive Architecture

FDA CFR PART 11 ELECTRONIC RECORDS, ELECTRONIC SIGNATURES

Game Theoretic Modeling of Cooperation among Service Providers in Mobile Cloud Computing Environments

Chapter 12. Paging an Virtual Memory Systems

361 Computer Architecture Lecture 14: Cache Memory

DIFFRACTION AND INTERFERENCE

This Unit: Multithreading (MT) CIS 501 Computer Architecture. Performance And Utilization. Readings

Chapter 12 File Management

Chapter 12 File Management. Roadmap

Synopsys RURAL ELECTRICATION PLANNING SOFTWARE (LAPER) Rainer Fronius Marc Gratton Electricité de France Research and Development FRANCE

Serial Communications

Memory Management 1. Memory Management. Multitasking without memory management is like having a party in a closet.

Outline: Operating Systems

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

File-System Implementation

Design of A Knowledge Based Trouble Call System with Colored Petri Net Models

Computer Architecture

Power analysis of static VAr compensators

GPU Hardware Performance. Fall 2015

Computer Organization. and Instruction Execution. August 22

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

FIArch Workshop. Towards Future Internet Architecture. Brussels 22 nd February 2012

The Linux Virtual Filesystem

Index Numbers OPTIONAL - II Mathematics for Commerce, Economics and Business INDEX NUMBERS

BOSCH. CAN Specification. Version , Robert Bosch GmbH, Postfach , D Stuttgart

Virtual machines and operating systems

Ch 10. Arithmetic Average Options and Asian Opitons

Outline. Principles of Database Management Systems. Memory Hierarchy: Capacities and access times. CPU vs. Disk Speed

ThroughputScheduler: Learning to Schedule on Heterogeneous Hadoop Clusters

Record Storage and Primary File Organization

1.1.1 Determining the Slot Number (Default)

Presentation of Diagnosing performance overheads in the Xen virtual machine environment

W4118 Operating Systems. Instructor: Junfeng Yang

Operating System Overview. Otto J. Anshus

OPERATING SYSTEM - VIRTUAL MEMORY

Software Model Checking: Theory and Practice

Calculating Viscous Flow: Velocity Profiles in Rivers and Pipes

A Novel Architecture Style: Diffused Cloud for Virtual Computing Lab

Unsteady Flow Visualization by Animating Evenly-Spaced Streamlines

ENFORCING SAFETY PROPERTIES IN WEB APPLICATIONS USING PETRI NETS

Trap Coverage: Allowing Coverage Holes of Bounded Diameter in Wireless Sensor Networks

The Classical Architecture. Storage 1 / 36

Sage HRMS I Planning Guide. The Complete Buyer s Guide for Payroll Software

Transcription:

// CS: Oerating System Lect 9: 5 th Oct Dr. A. Sahu Det of Com. Sc. & Engg. Inian Institute of Technology Guwahati ain emory an emory anagement Relocation & ultile Partition Contiguous Allocation Best fit, First Fit an Worst fit Buy System Segmentation Paging Segmentation with Paging Contiguous Allocation ain memory must suort both an user rocesses Limite resource, must allocate efficiently Contiguous allocation is one early metho ain memory usually into two artitions: Resient oerating system, usually hel in low memory with interrut vector User rocesses then hel in high memory Each rocess containe in single contiguous section of memory Contiguous Allocation (Cont.) Relocation registers use to rotect user rocesses from each other, an from changing coe an ata Base register contains value of smallest hysical aress Limit register contains range of logical aresses each logical aress must be less than the limit register U mas logical aress ynamically Base an Limit Registers 56 9 88 Oerating System base 9 limit CPU Harware Aress Protection aress Base no yes Tra to monitor Aressing Error Base + Limit < no yes E O R Y

// ultile artition allocation Degree of multirogramming limite by number of artitions Fixe size Partition (Partition Size (PS)) Num rocess to suort is limite if PS is bigger Suorting a big size rocess is limite if PS is smaller Variable artition sizes for efficiency Size to a given rocess nees Hole block of available memory Holes of various size are scattere throughout memory Buy System A comromise between fixe size an variable size allocation emory is allocate that are a ower of Initially a single allocation unit A rocess is allocate a unit memory whose size is the smallest ower of larger than the size of rocess 5K rocess woul be lace in 6K sace If no allocation unit exist of that size, the smallest available allocation larger than the rocess will be slit into two Buy unit of ½ size Examle Action emory Start K Arr A (5) A 56K 5K Arr B () A B 8K 5K Arr C (5 ) A B C 6 k 5K Rel B A 8K C 6 k 5K Arr D () A 8K C 6 k D 56K Arr E (6) A 8K C E D 56K Rel C A 8K 6 k E D 56K Rel A 56K 8K 6 k E D 56K Rel E 5K D 56K Rel D K ultile artition allocation When a rocess arrives allocate memory from a hole large enough to accommoate it exiting frees its artition, ajacent free artitions combine maintains information about a) allocate artitions b) free artitions (hole) 8 Three es Running ultile artition allocation 8 Finishe 9 9 Arrives 9 Arrives Dynamic Storage Allocation Problem How to satisfy a request of size n from a list of free holes? First fit: Allocate the first hole that is big enough Best fit: Allocate the smallest hole that is big enough; must search entire list, unless orere by size Prouces the smallest leftover hole Worst fit: Allocate the largest hole; must also search entire list Prouces the largest leftover hole First fit an best fit better than worst fit in terms of see an storage utilization

// Fragmentation External Fragmentation Total memory sace exists to satisfy a request, but it is not contiguous Internal Fragmentation allocate memory may be slightly larger than requeste memory This size ifference is memory internal to a artition, but not being use First fit analysis reveals that given N blocks allocate,.5 N blocks lost to fragmentation / may be unusable > 5 ercent rule Fragmentation (Cont.) Reuce external fragmentation by comaction Shuffle memory contents to lace all free memory together in one large block Comaction is ossible only if relocation is ynamic, an is one at execution time I/O roblem Latch job in memory while it is involve in I/O Do I/O only into buffers Now consier that backing store has same fragmentation roblems Segmentation emory management scheme that suorts user view of memory A rogram is a collection of segments A segment is a logical unit such as: main rogram, roceure/function/metho, / object, local variables, global variables common block, stack, symbol table arrays User s View of a Program Sub routine ain Program Sqrt Stack Symbol table Logical aress Segmentation : Key Rule Logical View of Segmentation Instea of allocation memory for whole rocess Divie the rogram into smaller block call segments User view : Alreay segmente Finer granularity, less fragmentation ustar in Bag Vs Brinjal in Bag Each of which is allocate to memory ineenently Segments are variable size user sace hysical memory sace

// Segmentation Architecture Logical aress consists of a two tule: <segment number, offset>, Segment table mas two imensional hysical aresses; each table entry has: base contains the starting hysical aress where the segments resie in memory limit secifies the length of the segment Segmentation Architecture Segment table base register (STBR) oints to the segment table s location in memory Segment table length register (STLR) inicates number of segments use by a rogram; segment number s is legal if s < STLR Every memory access get translate to Two accesses Segmentation Architecture (Cont.) Protection With each entry in segment table associate: valiation bit = illegal segment rea/write/execute rivileges Protection bits associate with segments; coe sharing occurs at segment level Since segments vary in length, memory allocation is a ynamic storage allocation roblem A segmentation examle is shown in the following iagram CPU s Segmentation Harware S < Limit Base Segment Table no yes Aressing Error + E O R Y Segmentation an Paging Divie the rogram into smaller block call segments : User view, alreay segmente Finer granularity, less fragmentation ustar in Bag Vs Brinjal in Bag Divie the rogram in to smaller but uniform size unit calle age A rogram may contain many ages Last age of rogram may be artially fille Divie the memory in to smaller size units calle Frame Page get mae to Frame Paging Physical aress sace of a rocess can be noncontiguous; rocess is allocate hysical memory whenever the latter is available Avois external fragmentation Avois roblem of varying size memory chunks Divie hysical memory into fixe size blocks calle frames Size is ower of, between 5 bytes an 6 bytes

// Paging Divie logical/rogram memory into blocks of same size calle ages Kee track of all free frames To run a rogram of size N ages, nee to fin N free frames an loa rogram Set u a age table to translate logical to hysical aresses Backing store likewise slit into ages Still have Internal fragmentation Aress Translation Scheme Aress generate by CPU is ivie into: Page number () use as an inex into a age table which contains base aress of each age in hysical memory Page offset () combine with base aress to efine the hysical memory aress that is sent to the memory unit Page number Page offset m n n For given logical aress sace m an age size n CPU Logical Aress Paging Harware f Page table f Physical Aress F F E O R Y ain emory Paging oel of Logical an Physical emory Page Page Page Page Logical emory 7 Frame number 5 6 7 Page Page Page Page Physical emory Paging (Cont.) Calculating internal fragmentation Page size =,8 bytes size = 7,766 bytes 5 ages +,86 bytes Internal fragmentation of,8,86 = 96 bytes Worst case fragmentation = frame byte Paging (Cont.) Calculating internal fragmentation Ct.. On average fragmentation = / frame size So small frame sizes esirable? But each age table entry takes memory to track Page sizes growing over time Page sizes growing over time Solaris suorts two age sizes 8 KB an B view an hysical memory now very ifferent By imlementation rocess can only access its own memory 5

// Page Page B Page Page A Examle 7 age number age offset m n= n= Free list,, 5, 7 5 6 7 b=7 Page A Page B Page A Page B Physical emory Free Frames Before allocation After allocation Imlementation of Page table is ket in main memory Page table base register (PTBR)oints to the age table Page table length register (PTLR) inicates size of the age table In this scheme every ata/instruction access requires two memory accesses One for the age table an one for the ata / instruction Imlementation of Page Page Logical emory PTBR Length Two memory accesses er ata/inst access. Solution? Associative Registers Page Page Physical emory Imlementation of (Cont.) The two memory access roblem can be solve by the use of a secial fast looku harware cache calle associative memory or translation look asie buffers (TLBs) Some TLBs store aress sace ientifiers (ASIDs)in each TLB entry uniquely ientifies each rocess to rovie aresssace rotection for that rocess Otherwise nee to flush at every context switch Imlementation of (Cont.) TLBs tyically small (6 to, entries) On a TLB miss, value is loae into the TLB for faster access next time Relacement olicies must be consiere Some entries can be wire own for ermanent fast access 6