Preview. Memory Management

Size: px
Start display at page:

Download "Preview. Memory Management"

Transcription

1 Preview Memory Management With Mono-Process With Multi-Processes Multi-process with Fixed Partitions Modeling Multiprogramming Swapping Memory Management with Bitmaps Memory Management with Free-List Virtual Memory Virtual Memory with Paging Page Table Multilevel Page Table CS 431 Operating Systems 1

2 Memory Management Ideal Memory Infinitely Large Infinitely Fast Non-volatile Inexpensive No such a memory, most computers has a memory hierarchy Memory hierarchy Small, fast, very expensive registers Volatile, expensive cache memory Megabyte medium-speed, medium-speed RAM Tens or hundreds of gigabits of slow cheap, non-volatile disk storage (Hard Disks) Memory management is a part of the operating system which manages the memory hierarchy CS 431 Operating Systems 2

3 Memory Management (mono-process) Mono-programming without Swapping or Paging There is only memory sharing between a user program and the operating system in this system. Only one program could be loaded in the memory. When the program finishes its job, a scheduler (long term scheduler) chooses one job from the pool of jobs and loads it into the memory and starts to run. CS 431 Operating Systems 3

4 Memory Management (mono-process) CS 431 Operating Systems 4

5 Memory Management (multi-process) Multiprogramming with Fixed Partition - Memory is divided into n (possibly unequal size) partitions can be done manually when the system started. 1. Fixed memory partitions with separate input queues for each partition 2. Fixed memory partitions with a single input queue. CS 431 Operating Systems 5

6 Memory Management (multi-process with fixed partition) CS 431 Operating Systems 6

7 Memory Management (multi-process with fixed partition) Fixed memory partitions with separate input queues for each partition When a job arrives, it can be put into the queue for the smallest partition that is large enough to hold it. Disadvantage Large partition queue is empty but many small jobs are waiting on the small partition queue. CS 431 Operating Systems 7

8 Memory Management (multi-process with fixed partition) Fixed memory partitions with a single input queue. Whenever a partition becomes free, the closest to the queue that fits in it, is chosen and loaded into the empty partition and run wasting memory. Or Search the whole queue to find out a job which is the best fit to the free partition. discriminate against small jobs. One partition for small jobs Count the time skipped by scheduler. If a job was skipped more than k time, it is automatically granted next time. CS 431 Operating Systems 8

9 Modeling Multiprogramming Simple Unrealistic Model Assumption: all five processes will never be waiting for I/O at the same time If the average processes use 20% computing time and 80% use for waiting I/O. With five processes in the memory at once, the CPU should be busy 100% CS 431 Operating Systems 9

10 Modeling Multiprogramming Probabilistic model p - a fraction of time a process is waiting for I/O. If there are n processes in the memory at once, the probability that all n processes are waiting for I/O is p n. Then, the CPU utilization is given by CPU utilization = 1 p n (the probability that at least one of processes is using CPU) CS 431 Operating Systems 10

11 Modeling Multiprogramming CS 431 Operating Systems 11

12 Modeling Multiprogramming Ex) A computer has 32MB of memory, with operating system taking up 16 MB and each program taking up 4MB. 4 programs to be in memory at once (4 X 4 = 16MB). With an 80 % average I/O wait, we can have about 60 % of CPU utilization. Adding 16MB memory, (4 more programs: a total of 8 programs to be in the memory) we can get about 83% of CPU utilization. Adding yet another 16MB memory, (a total of 12 programs to be in the memory) we can get about 93% of CPU utilization CS 431 Operating Systems 12

13 Memory Management There is not enough main memory to hold all the currently active processes, so excess processes must be kept on disk and brought in to run dynamically. Two general approaches for memory management (depending on the available hardware) 1. Swapping bringing in each process in its entirety, running it for a while, then putting it back on the disk. 2. Virtual Memory allows programs to run while partially loaded in the memory. CS 431 Operating Systems 13

14 Swapping with Variable Partition CS 431 Operating Systems 14

15 Swapping Main difference between fixed partition and variable partition Variable partition The number, location, and size of the partitions vary dynamically Need to keep track of partition information dynamically for memory allocation and de-allocation Might create multiple holes Combine them all into one big hole (memory compaction: expensive cycle) Fixed partition The number, location, and size of the partitions fixed. OS knows the address of each process. Simple to manage the memory. CS 431 Operating Systems 15

16 Swapping How much memory should be allocated for a process when it is created or swapped? If processes are created with a fixed size simple But processes are usually changing their sizes by dynamically allocating memory Dynamic memory allocation (heap), recursion Allocate extra memory space for each process Use adjacent hole for managing the growing size If there is not enough memory space for a process based on the dynamically changing size, the process might be swapped out or killed. CS 431 Operating Systems 16

17 Swapping CS 431 Operating Systems 17

18 Memory Management with Bitmaps Memory is divided up into allocation units (words ~ k bytes) Corresponding to each allocation unit is a bit in the bitmap If the unit is free, corresponding bit = 0 and If unit is occupied, corresponding bit = 1. CS 431 Operating Systems 18

19 Memory Management with Bitmaps CS 431 Operating Systems 19

20 Memory Management with Bitmaps Size of the allocation unit is an important design issue The smaller the allocation unit, the larger the bitmap. The larger the allocation unit, the smaller the bitmap But memory may be wasted in the last unit of the process if the process size is not an exact multiple of the allocation unit. CS 431 Operating Systems 20

21 Memory Management with Bitmaps Advantage with Bitmaps Simple way to keep track of memory words in a fixed amount of memory since the size of bitmap depends only on the size of memory and size of the allocation units. Disadvantage with Bitmaps To allocate memory for the process with k unit size, first, the memory manager needs to search the bitmap to find out k consecutive 0 bits in the map. CS 431 Operating Systems 21

22 Memory Management with Free-List With free-list, maintain a linked list of allocated and free memory segments. Each entry in the list keeps information: hole or process, starting address, length and a pointer to the next entry P 0 5 H 5 3 CS 431 Operating Systems 22

23 Memory Management with Free-List CS 431 Operating Systems 23

24 Memory Management with Free-List If the list of segments is kept sorted by address value, it is simple to update the list when a process terminates or is swapped out from memory. CS 431 Operating Systems 24

25 Memory Management with Free-List CS 431 Operating Systems 25

26 Memory Management with Free-List CS 431 Operating Systems 26

27 Memory Management with Free-List Algorithms for allocating memory for a process (Assume that the list of segments is kept sorted by address value). First Fit The memory manager scans the list of segments from the beginning until it finds a hole that is big enough. Next Fit It works the same way as first fit. But next time it is called, it starts searching the list from the place where it left off last time. Best Fit It searches the entire list and takes the smallest hole that fit for the process. Worst Fit It always takes the largest free hole CS 431 Operating Systems 27

28 Memory Management with Free-List Four algorithms can be more efficient by maintaining two lists: one for holes and another for processes. The list of holes can be maintained sorted by size. Best fit does not need to search entire list. But still need extra effort for updating two lists based on the allocation and deallocation of memory. CS 431 Operating Systems 28

29 Memory Management with Free-List Quick Fit Maintains separate lists for holes based on the size. It might have a table with n entries. Each entry is a pointer to the head of a certain size of holes list. Ex) First entry point to the head of list of 4-KB holes, second entry point to the head of list of 8-KB holes,. Quick to finding a hole of required size Expensive to maintain the separate lists for hole based on the deallocation of memory CS 431 Operating Systems 29

30 Virtual Memory Motivation Initial idea of executing a program is that the entire logical address space of a process must be in physical memory before the process can access (swapping). But since size of a program grows tremendously based on the complexity of modern software, and limited size of physical memory, initial idea is not possible. CS 431 Operating Systems 30

31 Virtual Memory Overlay Split a program into pieces (overlays) Overlay 0 starts running first; when it finishes its job, it will call another overlay. Overlays were kept on the disk and swapped in and out of memory by OS. The work of splitting the program into pieces had to be done by programmer. Splitting up large program into small pieces is time consuming. CS 431 Operating Systems 31

32 Virtual Memory Virtual Memory Virtual memory is a technique that allows the execution of processes that may not be entirely in memory The OS needs to keep track of the parts of the program currently located in main memory and the rest on the disk. Virtual memory idea can be used in a multiprogramming system. CS 431 Operating Systems 32

33 Virtual Memory with Paging Paging Virtual address space is divided into units called pages. The corresponding units in the physical memory is called page frames. the size of a page = the size of a page frame Size of page is usually between 512 byte and 64KB CS 431 Operating Systems 33

34 Virtual Memory with Paging Mapping from Virtual Memory Address to Physical Memory Address When virtual memory is used, a virtual address (which is generated by a program) does not go directly onto the memory bus. Instead, they goes to an MMU (Memory Management Unit) that maps the virtual addresses onto the physical memory addresses based on the memory map (page table). CS 431 Operating Systems 34

35 Virtual Memory with Paging CS 431 Operating Systems 35

36 Virtual Memory with Paging Example) A computer that can generate 16-bit address 64KB virtual space (0 ~ = 0 ~ ) A system is using the virtual memory with page size 4KB A computer has 32 KB memory There are 16 virtual pages and 8 (32/4) page frames. CS 431 Operating Systems 36

37 Virtual Memory with Paging CS 431 Operating Systems 37

38 Virtual Memory with Paging MOV REG, 0 ;; (move content of address 0 to register.) virtual address 0 is sent to MMU. MMU checks virtual address, 0 belongs to virtual page 0 (0 ~ 4095 (= ). MMU checks memory map such that page 0 is mapped to page frame 2 (8K ~ 12K) MMU sends 8192 (= 2 13 ) physical address to address bus. CS 431 Operating Systems 38

39 Virtual Memory with Paging MOV REG, 8900 ;; Virtual address 8900 is send to MMU MMU calculates the virtual address 8900 that belongs to virtual page 2 (=between 8 KB ~ 12 KB) (8192~12287) MMU checks memory map such that virtual page 2 is mapped to physical frame 6 (24KB ~ 28 KB) (24576 ~28671) MMU sends the address ( ) = (physical address) to address CS 431 Operating Systems 39

40 Virtual Memory with Paging MOV REG Virtual address is sent to MMU MMU calculates the virtual address belongs to virtual page 6 (=between 24 KB ~ 28 KB: ~28671 ) MMU checks memory map such that virtual page 6 is not in physical space yet. (page fault) When a page fault occurs, operating system picks one of physical frame write back to disk fetch the page to the frame just freed change the memory map CS 431 Operating Systems 40

41 Virtual Memory with Paging CS 431 Operating Systems 41

42 Virtual Memory with Paging How to map virtual address into physical address by MMU with Previous Example The incoming 16-bit address is split into 4-bit page number and 12bit offset. With 4-bit page number, 2 4 = 16 page number is available. The 4-bit page number is used as an index in the page table, With 12-bits offset, we can address 2 12 = 4KB within a page. CS 431 Operating Systems 42

43 Virtual Memory with Paging CS 431 Operating Systems 43

44 Page Table The purpose of the page table is to map virtual pages onto page frames. Two major issues of using page table The page table can be extremely large The mapping must be fast CS 431 Operating Systems 44

45 Page Table The page table can be extremely large Ex) A modern computer with 32-bit virtual address and 4 KB page size 2 32 = 2 22 KB virtual space 2 22 / 4 = pages Need entries in the page table Since each process has its own virtual space, each process needs its own page table.!!! CS 431 Operating Systems 45

46 Page Table The mapping must be fast Build a single table consisting of an array of fast hardware registers, with one entry for each virtual page, indexed by virtual page number. --- very expensive!! The page table can be entirely in main memory all the hardware needs is a single register that points to the start of the page table --- needs one or more memory references to read page table entries. CS 431 Operating Systems 46

47 Multilevel Page Table The basic idea of multilevel page table method is to avoid keeping the complete page tables in memory all the time!!! Ex) A system is using second level page tables The system generates 32-bit virtual address with a page size of 4KB. We have a 32-bit virtual address which is partitioned into 10-bit PT1 field 10-bit PT2 field 12-bit offset field (for page size 4KB) PT1 PT2 Offset Since offset is 12 bits, pages are 4KB and there are totally 2 20 of them. CS 431 Operating Systems 47

48 2 10 entries for top level page table 2 10 entries for each of second level page table Address space for second level page table is 4 KB 2 10 = 4 MB CS 431 Operating Systems 48

49 Multilevel Page Table Ex) virtual address (= = ) PT1 = = 1 10 PT2 = = 3 10 Offset = = 4 10 CS 431 Operating Systems 49

50 Multilevel Page Table The MMU uses PT1 to index into the top-level page table and obtain entry 1 ( ) (physical address between 4M ~ 8M). Then the MMU uses PT2 to index into the secondlevel page table and obtain entry 3 ( ) (Corresponds to address 12 K ~ 16 K within 4M chunk = ~ 16383) = (address between 4M + 12K ~ 4M + 16K 1 = ~ ) If the page is in the memory, the page frame number taken from the second-level page table is combined with the offset (4) to construct a physical address. CS 431 Operating Systems 50

12: Memory Management

12: Memory Management 12: Memory Management Mark Handley Address Binding Program goes through multiple steps from compilation to execution. At some stage, addresses in the program must be bound to physical memory addresses:

More information

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

Processes and Tasks What comprises the state of a running program (a process or task)? Processes and Tasks What comprises the state of a running program (a process or task)? Microprocessor Address bus Control DRAM OS code and data special caches code/data cache EAXEBP EIP DS EBXESP EFlags

More information

4 MEMORY MANAGEMENT 4.1 BASIC MEMORY MANAGEMENT

4 MEMORY MANAGEMENT 4.1 BASIC MEMORY MANAGEMENT 4 MEMORY MANAGEMENT Memory is an important resource that must be carefully managed. While the average home computer nowadays has a thousand times as much memory as the IBM 7094, the largest computer in

More information

Memory management: outline

Memory management: outline Memory management: outline Concepts Swapping Paging o Multi-level paging o TLB & inverted page tables 1 Memory size/requirements are growing 1951: the UNIVAC computer: 1000 72-bit words! 1971: the Cray

More information

Memory management: outline

Memory management: outline Memory management: outline Concepts Swapping Paging o Multi-level paging o TLB & inverted page tables 1 Memory size/requirements are growing 1951: the UNIVAC computer: 1000 72-bit words! 1971: the Cray

More information

UNIT III MEMORY MANAGEMENT

UNIT III MEMORY MANAGEMENT UNIT III MEMORY MANAGEMENT TOPICS TO BE COVERED 3.1 Memory management 3.2 Contiguous allocation i Partitioned memory allocation ii Fixed & variable partitioning iii Swapping iv Relocation v Protection

More information

Chapter 3 - Memory Management

Chapter 3 - Memory Management Chapter 3 - Memory Management Luis Tarrataca luis.tarrataca@gmail.com CEFET-RJ L. Tarrataca Chapter 3 - Memory Management 1 / 222 1 A Memory Abstraction: Address Spaces The Notion of an Address Space Swapping

More information

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

Operating Systems and Computer Networks. Memory Management. Dr.-Ing. Pascal A. Klein Operating Systems and Computer Networks Memory Management pascal.klein@uni-due.de Alexander Maxeiner, M.Sc. Faculty of Engineering Agenda 1 Swapping 2 Segmentation Algorithms 3 Memory Allocation 4 Virtual

More information

Memory Management. CSE 2431: Introduction to Operating Systems Reading: , [OSC]

Memory Management. CSE 2431: Introduction to Operating Systems Reading: , [OSC] Memory Management CSE 2431: Introduction to Operating Systems Reading: 8.1 8.3, [OSC] 1 Outline Basic Memory Management Swapping Variable Partitions Memory Management Problems 2 Basic Memory Management

More information

8: Memory Management

8: Memory Management CSC400 - Operating Systems 8: Memory Management J. Sumey Physical Memory as important as the CPU, a computer's physical memory is another important resource that must be carefully & efficiently managed

More information

CS399 New Beginnings. Jonathan Walpole

CS399 New Beginnings. Jonathan Walpole CS399 New Beginnings Jonathan Walpole Memory Management Memory Management Memory a linear array of bytes - Holds O.S. and programs (processes) - Each cell (byte) is named by a unique memory address Recall,

More information

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

Memory Management. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory Memory Management q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory Memory management Ideal memory for a programmer large, fast, nonvolatile and cheap not an option

More information

Memory management OS

Memory management OS Memory management 1 Memory (ideally) 2 Ideally Extremely fast (faster than the CPU in executing an instruction) Abundantly large Dirt cheap Memory (for real) 3 Typical access time 1 nsec Registers 2 nsec

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 L17 Main Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Was Great Dijkstra a magician?

More information

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

Operating Systems Memory Management. Mathieu Delalandre University of Tours, Tours city, France Operating Systems Memory Management Mathieu Delalandre University of Tours, Tours city, France mathieu.delalandre@univ-tours.fr 1 Operating Systems Memory Management 1. Introduction 2. Contiguous memory

More information

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

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358 Memory Management Reading: Silberschatz chapter 9 Reading: Stallings chapter 7 1 Outline Background Issues in Memory Management Logical Vs Physical address, MMU Dynamic Loading Memory Partitioning Placement

More information

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

Performance of Various Levels of Storage. Movement between levels of storage hierarchy can be explicit or implicit Memory Management All data in memory before and after processing All instructions in memory in order to execute Memory management determines what is to be in memory Memory management activities Keeping

More information

Memory Management. Memory Management. G53OPS: Operating Systems. Memory Management Monoprogramming 11/27/2008. Graham Kendall.

Memory Management. Memory Management. G53OPS: Operating Systems. Memory Management Monoprogramming 11/27/2008. Graham Kendall. Memory Management Memory Management Introduction Graham Kendall Memory Management consists of many tasks, including Being aware of what parts of the memory are in use and which parts are not Allocating

More information

Operating Systems, Fall

Operating Systems, Fall Operating Systems: Memory management Fall 2008 Basic Memory Management: One program Monoprogramming without Swapping or Paging Tiina Niklander No memory abstraction, no address space, just an operating

More information

Operating Systems, Fall

Operating Systems, Fall Operating Systems: Memory management Fall 2008 Tiina Niklander Memory Management Programmer wants memory to be Indefinitely large Indefinitely fast Non volatile Memory hierarchy Memory manager handles

More information

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

Memory Management. To do. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory Memory Management To do q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory Memory management Ideal memory for a programmer large, fast, nonvolatile and cheap not

More information

Memory Management Prof. James L. Frankel Harvard University

Memory Management Prof. James L. Frankel Harvard University Memory Management Prof. James L. Frankel Harvard University Version of 5:42 PM 25-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Memory Management Ideal memory Large Fast Non-volatile

More information

Course: Operating Systems Instructor: M Umair. M Umair

Course: Operating Systems Instructor: M Umair. M Umair Course: Operating Systems Instructor: M Umair Memory Management Introduction { Ref: Operating System Concepts 8th Edition Abraham Silberschatz, Greg Gagne, Peter B. Galvin } Address Binding Addresses in

More information

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

Memory Management. Today. Next Time. Basic memory management Swapping Kernel memory allocation. Virtual memory Memory Management Today Basic memory management Swapping Kernel memory allocation Next Time Virtual memory Midterm results Average 68.9705882 Median 70.5 Std dev 13.9576965 12 10 8 6 4 2 0 [0,10) [10,20)

More information

Last class: Today: Deadlocks. Memory Management

Last class: Today: Deadlocks. Memory Management Last class: Deadlocks Today: Memory Management CPU il1 L2 Memory Bus (e.g. PC133) Main Memory dl1 On-chip I/O Bus (e.g. PCI) Disk Ctrller Net. Int. Ctrller Network Binding of Programs to Addresses Address

More information

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD OPERATING SYSTEMS #8 After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD MEMORY MANAGEMENT MEMORY MANAGEMENT The memory is one of

More information

Operating Systems Unit 6. Memory Management

Operating Systems Unit 6. Memory Management Unit 6 Memory Management Structure 6.1 Introduction Objectives 6.2 Logical versus Physical Address Space 6.3 Swapping 6.4 Contiguous Allocation Single partition Allocation Multiple Partition Allocation

More information

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

Chapter 4: Memory Management. Part 1: Mechanisms for Managing Memory Chapter 4: Memory Management Part 1: Mechanisms for Managing Memory Memory management Basic memory management Swapping Virtual memory Page replacement algorithms Modeling page replacement algorithms Design

More information

Memory Management. Dr. Yingwu Zhu

Memory Management. Dr. Yingwu Zhu Memory Management Dr. Yingwu Zhu Big picture Main memory is a resource A process/thread is being executing, the instructions & data must be in memory Assumption: Main memory is infinite Allocation of memory

More information

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

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization Requirements Relocation Memory management ability to change process image position Protection ability to avoid unwanted memory accesses Sharing ability to share memory portions among processes Logical

More information

ECE 598 Advanced Operating Systems Lecture 10

ECE 598 Advanced Operating Systems Lecture 10 ECE 598 Advanced Operating Systems Lecture 10 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 17 February 2015 Announcements Homework #1 and #2 grades, HW#3 Coming soon 1 Various

More information

CS Operating Systems

CS Operating Systems CS 4500 - Operating Systems Module 9: Memory Management - Part 1 Stanley Wileman Department of Computer Science University of Nebraska at Omaha Omaha, NE 68182-0500, USA June 9, 2017 In This Module...

More information

CS Operating Systems

CS Operating Systems CS 4500 - Operating Systems Module 9: Memory Management - Part 1 Stanley Wileman Department of Computer Science University of Nebraska at Omaha Omaha, NE 68182-0500, USA June 9, 2017 In This Module...

More information

Requirements, Partitioning, paging, and segmentation

Requirements, Partitioning, paging, and segmentation Requirements, Partitioning, paging, and segmentation Main Memory: The Big Picture kernel memory proc struct kernel stack/u area Stack kernel stack/u area Stack kernel stack/u area Stack Data Text (shared)

More information

Memory Management. Jo, Heeseung

Memory Management. Jo, Heeseung Memory Management Jo, Heeseung Today's Topics Why is memory management difficult? Old memory management techniques: Fixed partitions Variable partitions Swapping Introduction to virtual memory 2 Memory

More information

Virtual Memory 1. To do. q Segmentation q Paging q A hybrid system

Virtual Memory 1. To do. q Segmentation q Paging q A hybrid system Virtual Memory 1 To do q Segmentation q Paging q A hybrid system Address spaces and multiple processes IBM OS/360 Split memory in n parts (possible!= sizes) A process per partition Program Code Heap Operating

More information

Memory management. Knut Omang Ifi/Oracle 10 Oct, 2012

Memory management. Knut Omang Ifi/Oracle 10 Oct, 2012 Memory management Knut Omang Ifi/Oracle 1 Oct, 212 (with slides from V. Goebel, C. Griwodz (Ifi/UiO), P. Halvorsen (Ifi/UiO), K. Li (Princeton), A. Tanenbaum (VU Amsterdam), and M. van Steen (VU Amsterdam))

More information

CS450/550 Operating Systems

CS450/550 Operating Systems CS450/550 Operating Systems Lecture 4 memory Palden Lama Department of Computer Science CS450/550 Memory.1 Review: Summary of Chapter 3 Deadlocks and its modeling Deadlock detection Deadlock recovery Deadlock

More information

MEMORY MANAGEMENT. Jo, Heeseung

MEMORY MANAGEMENT. Jo, Heeseung MEMORY MANAGEMENT Jo, Heeseung TODAY'S TOPICS Why is memory management difficult? Old memory management techniques: Fixed partitions Variable partitions Swapping Introduction to virtual memory 2 MEMORY

More information

Registers Cache Main memory Magnetic disk Magnetic tape

Registers Cache Main memory Magnetic disk Magnetic tape Operating Systems: Memory management Mon 14.9.2009 Tiina Niklander Memory Management Programmer wants memory to be Indefinitely large Indefinitely fast Non volatile Memory hierarchy small amount of fast,

More information

COMPUTER SCIENCE 4500 OPERATING SYSTEMS

COMPUTER SCIENCE 4500 OPERATING SYSTEMS Last update: 3/28/2017 COMPUTER SCIENCE 4500 OPERATING SYSTEMS 2017 Stanley Wileman Module 9: Memory Management Part 1 In This Module 2! Memory management functions! Types of memory and typical uses! Simple

More information

Memory Management. Chapter 4 Memory Management. Multiprogramming with Fixed Partitions. Ideally programmers want memory that is.

Memory Management. Chapter 4 Memory Management. Multiprogramming with Fixed Partitions. Ideally programmers want memory that is. Chapter 4 Memory Management Ideally programmers want memory that is Memory Management large fast non volatile 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms

More information

Outlook. File-System Interface Allocation-Methods Free Space Management

Outlook. File-System Interface Allocation-Methods Free Space Management File System Outlook File-System Interface Allocation-Methods Free Space Management 2 File System Interface File Concept File system is the most visible part of an OS Files storing related data Directory

More information

Chapter 9 Memory Management

Chapter 9 Memory Management Contents 1. Introduction 2. Computer-System Structures 3. Operating-System Structures 4. Processes 5. Threads 6. CPU Scheduling 7. Process Synchronization 8. Deadlocks 9. Memory Management 10. Virtual

More information

Chapter 4 Memory Management. Memory Management

Chapter 4 Memory Management. Memory Management Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms 4.6 Design issues for paging systems 4.7

More information

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

Memory Management. Frédéric Haziza Spring Department of Computer Systems Uppsala University Memory Management Frédéric Haziza Department of Computer Systems Uppsala University Spring 2008 Operating Systems Process Management Memory Management Storage Management Compilers Compiling

More information

C06: Memory Management

C06: Memory Management CISC 7310X C06: Memory Management Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/8/2018 CUNY Brooklyn College 1 Outline Recap & issues Project 1 feedback Memory management:

More information

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

Memory: Overview. CS439: Principles of Computer Systems February 26, 2018 Memory: Overview CS439: Principles of Computer Systems February 26, 2018 Where We Are In the Course Just finished: Processes & Threads CPU Scheduling Synchronization Next: Memory Management Virtual Memory

More information

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Chapter 8 & Chapter 9 Main Memory & Virtual Memory Chapter 8 & Chapter 9 Main Memory & Virtual Memory 1. Various ways of organizing memory hardware. 2. Memory-management techniques: 1. Paging 2. Segmentation. Introduction Memory consists of a large array

More information

CIS Operating Systems Contiguous Memory Allocation. Professor Qiang Zeng Spring 2018

CIS Operating Systems Contiguous Memory Allocation. Professor Qiang Zeng Spring 2018 CIS 3207 - Operating Systems Contiguous Memory Allocation Professor Qiang Zeng Spring 2018 Previous class Uniprocessor policies FCFS, Shortest Job First Round Robin Multilevel Feedback Queue Multiprocessor

More information

Main Memory (Part I)

Main Memory (Part I) Main Memory (Part I) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Main Memory 1393/8/5 1 / 47 Motivation and Background Amir

More information

Heap Management portion of the store lives indefinitely until the program explicitly deletes it C++ and Java new Such objects are stored on a heap

Heap Management portion of the store lives indefinitely until the program explicitly deletes it C++ and Java new Such objects are stored on a heap Heap Management The heap is the portion of the store that is used for data that lives indefinitely, or until the program explicitly deletes it. While local variables typically become inaccessible when

More information

Memory Management. Memory Management

Memory Management. Memory Management Memory Management Chapter 7 1 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as many processes into memory as possible 2 1 Memory

More information

Memory Management william stallings, maurizio pizzonia - sistemi operativi

Memory Management william stallings, maurizio pizzonia - sistemi operativi Memory Management 1 summary goals and requirements techniques that do not involve virtual memory 2 memory management tracking used and free memory primitives allocation of a certain amount of memory de-allocation

More information

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

Operating systems. Part 1. Module 11 Main memory introduction. Tami Sorgente 1 Operating systems Module 11 Main memory introduction Part 1 Tami Sorgente 1 MODULE 11 MAIN MEMORY INTRODUCTION Background Swapping Contiguous Memory Allocation Noncontiguous Memory Allocation o Segmentation

More information

CS 550 Operating Systems Spring Memory Management: Paging

CS 550 Operating Systems Spring Memory Management: Paging CS 550 Operating Systems Spring 2018 Memory Management: Paging 1 Recap: Memory Management Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive

More information

Operating Systems (2INC0) 2017/18

Operating Systems (2INC0) 2017/18 Operating Systems (2INC0) 2017/18 Memory Management (09) Dr. Courtesy of Dr. I. Radovanovic, Dr. R. Mak (figures from Bic & Shaw) System Architecture and Networking Group Agenda Reminder: OS & resources

More information

Lecture 7. Memory Management

Lecture 7. Memory Management Lecture 7 Memory Management 1 Lecture Contents 1. Memory Management Requirements 2. Memory Partitioning 3. Paging 4. Segmentation 2 Memory Memory is an array of words or bytes, each with its own address.

More information

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

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference

More information

Chapter 4 Memory Management

Chapter 4 Memory Management Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms 4.6 Design issues for paging systems 4.7

More information

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

File Systems. OS Overview I/O. Swap. Management. Operations CPU. Hard Drive. Management. Memory. Hard Drive. CSI3131 Topics. Structure. File Systems I/O Management Hard Drive Management Virtual Memory Swap Memory Management Storage and I/O Introduction CSI3131 Topics Process Management Computing Systems Memory CPU Peripherals Processes

More information

Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register

Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register Memory Management 1. Describe the sequence of instruction-execution life cycle? A typical instruction-execution life cycle: Fetches (load) an instruction from specific memory address. Decode the instruction

More information

SMD149 - Operating Systems - Memory

SMD149 - Operating Systems - Memory SMD149 - Operating Systems - Memory Roland Parviainen November 8, 2005 1/57 Outline Overview Mostly historical management Paging 2/57 Overview 3/57 Memory hierarchy Memory divided into tiers Main memory

More information

Requirements, Partitioning, paging, and segmentation

Requirements, Partitioning, paging, and segmentation Requirements, Partitioning, paging, and segmentation Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as many processes into memory

More information

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

Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1 Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1 Chapter 9: Memory Management Background Swapping Contiguous Memory Allocation Segmentation

More information

Virtual Memory. Today. Segmentation Paging A good, if common example

Virtual Memory. Today. Segmentation Paging A good, if common example Virtual Memory Today Segmentation Paging A good, if common example Virtual memory system Goals Transparency Programs should not know that memory is virtualized; the OS +HW multiplex memory among processes

More information

Goals of Memory Management

Goals of Memory Management Memory Management Goals of Memory Management Allocate available memory efficiently to multiple processes Main functions Allocate memory to processes when needed Keep track of what memory is used and what

More information

Chapter 9 Real Memory Organization and Management

Chapter 9 Real Memory Organization and Management Chapter 9 Real Memory Organization and Management Outline 9.1 Introduction 9.2 Memory Organization 9.3 Memory Management 9.4 Memory Hierarchy 9.5 Memory Management Strategies 9.6 Contiguous vs. Noncontiguous

More information

Chapter 9 Real Memory Organization and Management

Chapter 9 Real Memory Organization and Management Chapter 9 Real Memory Organization and Management Outline 9.1 Introduction 9.2 Memory Organization 9.3 Memory Management 9.4 Memory Hierarchy 9.5 Memory Management Strategies 9.6 Contiguous vs. Noncontiguous

More information

Administrivia. Deadlock Prevention Techniques. Handling Deadlock. Deadlock Avoidance

Administrivia. Deadlock Prevention Techniques. Handling Deadlock. Deadlock Avoidance Administrivia Project discussion? Last time Wrapped up deadlock Today: Start memory management SUNY-BINGHAMTON CS35 SPRING 8 LEC. #13 1 Handling Deadlock Deadlock Prevention Techniques Prevent hold and

More information

With regard to operating systems the kernel consists of the most frequently used functions in the operating system and it kept in main 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. CS 320 Ch 8 Operating Systems An operating system controls execution of applications and acts as an interface between the user and the computer. A typical OS provides the following services: Program Creation

More information

MEMORY MANAGEMENT/1 CS 409, FALL 2013

MEMORY MANAGEMENT/1 CS 409, FALL 2013 MEMORY MANAGEMENT Requirements: Relocation (to different memory areas) Protection (run time, usually implemented together with relocation) Sharing (and also protection) Logical organization Physical organization

More information

Background. Contiguous Memory Allocation

Background. Contiguous Memory Allocation Operating System Lecture 8 2017.5.9 Chapter 8 (Main Memory) Background Swapping Contiguous Memory Allocation Segmentation - Paging Memory Management Selection of a memory-management method for a specific

More information

In multiprogramming systems, processes share a common store. Processes need space for:

In multiprogramming systems, processes share a common store. Processes need space for: Memory Management In multiprogramming systems, processes share a common store. Processes need space for: code (instructions) static data (compiler initialized variables, strings, etc.) global data (global

More information

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

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses. 1 Memory Management Address Binding The normal procedures is to select one of the processes in the input queue and to load that process into memory. As the process executed, it accesses instructions and

More information

CHAPTER 3 RESOURCE MANAGEMENT

CHAPTER 3 RESOURCE MANAGEMENT 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

More information

Motivation. Memory Management. Memory Management. Computer Hardware Review

Motivation. Memory Management. Memory Management. Computer Hardware Review Memory Management Motivation Vera Goebel Department of Informatics, University of Oslo with slides from: C. Griwodz (Ifi/UiO), P. Halvorsen (Ifi/UiO), K. Li (Princeton), A. Tanenbaum (VU Amsterdam), and

More information

Process. Memory Management

Process. Memory Management Process Memory Management One or more threads of execution Resources required for execution Memory (RAM) Program code ( text ) Data (initialised, uninitialised, stack) Buffers held in the kernel on behalf

More information

Last Class: Deadlocks. Where we are in the course

Last Class: Deadlocks. Where we are in the course Last Class: Deadlocks Necessary conditions for deadlock: Mutual exclusion Hold and wait No preemption Circular wait Ways of handling deadlock Deadlock detection and recovery Deadlock prevention Deadlock

More information

Process. One or more threads of execution Resources required for execution. Memory (RAM) Others

Process. One or more threads of execution Resources required for execution. Memory (RAM) Others Memory Management 1 Process One or more threads of execution Resources required for execution Memory (RAM) Program code ( text ) Data (initialised, uninitialised, stack) Buffers held in the kernel on behalf

More information

CS307 Operating Systems Main Memory

CS307 Operating Systems Main Memory CS307 Main Memory Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2018 Background Program must be brought (from disk) into memory and placed within a process

More information

Memory Management (1) Memory Management

Memory Management (1) Memory Management EECS 3221 Operating System Fundamentals No.8 Memory Management (1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Memory Management A program usually resides on a

More information

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

Memory Management (1) Memory Management. CPU vs. memory. No.8. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University EECS 3221 Operating System Fundamentals No.8 Memory Management (1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Memory Management A program usually resides on a

More information

Process. One or more threads of execution Resources required for execution. Memory (RAM) Others

Process. One or more threads of execution Resources required for execution. Memory (RAM) Others Memory Management 1 Learning Outcomes Appreciate the need for memory management in operating systems, understand the limits of fixed memory allocation schemes. Understand fragmentation in dynamic memory

More information

Operating Systems. Memory Management. Lecture 9 Michael O Boyle

Operating Systems. Memory Management. Lecture 9 Michael O Boyle Operating Systems Memory Management Lecture 9 Michael O Boyle 1 Memory Management Background Logical/Virtual Address Space vs Physical Address Space Swapping Contiguous Memory Allocation Segmentation Goals

More information

Memory and multiprogramming

Memory and multiprogramming Memory and multiprogramming COMP342 27 Week 5 Dr Len Hamey Reading TW: Tanenbaum and Woodhull, Operating Systems, Third Edition, chapter 4. References (computer architecture): HP: Hennessy and Patterson

More information

Chapter 8 Memory Management

Chapter 8 Memory Management 1 Chapter 8 Memory Management The technique we will describe are: 1. Single continuous memory management 2. Partitioned memory management 3. Relocatable partitioned memory management 4. Paged memory management

More information

Memory Allocation. Static Allocation. Dynamic Allocation. Dynamic Storage Allocation. CS 414: Operating Systems Spring 2008

Memory Allocation. Static Allocation. Dynamic Allocation. Dynamic Storage Allocation. CS 414: Operating Systems Spring 2008 Dynamic Storage Allocation CS 44: Operating Systems Spring 2 Memory Allocation Static Allocation (fixed in size) Sometimes we create data structures that are fixed and don t need to grow or shrink. Dynamic

More information

Memory Management. Memory Management Requirements

Memory Management. Memory Management Requirements Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable supply of ready processes to consume available processor time 1 Memory Management

More information

Memory management. Last modified: Adaptation of Silberschatz, Galvin, Gagne slides for the textbook Applied Operating Systems Concepts

Memory management. Last modified: Adaptation of Silberschatz, Galvin, Gagne slides for the textbook Applied Operating Systems Concepts Memory management Last modified: 26.04.2016 1 Contents Background Logical and physical address spaces; address binding Overlaying, swapping Contiguous Memory Allocation Segmentation Paging Structure of

More information

Objectives and Functions Convenience. William Stallings Computer Organization and Architecture 7 th Edition. Efficiency

Objectives and Functions Convenience. William Stallings Computer Organization and Architecture 7 th Edition. Efficiency William Stallings Computer Organization and Architecture 7 th Edition Chapter 8 Operating System Support Objectives and Functions Convenience Making the computer easier to use Efficiency Allowing better

More information

CS 3733 Operating Systems:

CS 3733 Operating Systems: CS 3733 Operating Systems: Topics: Memory Management (SGG, Chapter 08) Instructor: Dr Dakai Zhu Department of Computer Science @ UTSA 1 Reminders Assignment 2: extended to Monday (March 5th) midnight:

More information

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

CISC 7310X. C08: Virtual Memory. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/22/2018 CUNY Brooklyn College CISC 7310X C08: Virtual Memory Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/22/2018 CUNY Brooklyn College 1 Outline Concepts of virtual address space, paging, virtual page,

More information

ECE 598 Advanced Operating Systems Lecture 12

ECE 598 Advanced Operating Systems Lecture 12 ECE 598 Advanced Operating Systems Lecture 12 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 1 March 2018 Announcements Next homework will be due after break. Midterm next Thursday

More information

CS420: Operating Systems

CS420: Operating Systems Main Memory James Moscola Department of Engineering & Computer Science York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne Background Program must

More information

Chapter 5. File and Memory Management

Chapter 5. File and Memory Management K. K. Wagh Polytechnic, Nashik Department: Information Technology Class: TYIF Sem: 5G System Subject: Operating Name of Staff: Suyog S.Dhoot Chapter 5. File and Memory Management A. Define file and explain

More information

Operating System Support

Operating System Support Operating System Support Objectives and Functions Convenience Making the computer easier to use Efficiency Allowing better use of computer resources Layers and Views of a Computer System Operating System

More information

Chapter 7 Memory Management

Chapter 7 Memory Management Operating Systems: Internals and Design Principles Chapter 7 Memory Management Ninth Edition William Stallings Frame Page Segment A fixed-length block of main memory. A fixed-length block of data that

More information

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

General Objective:To understand the basic memory management of operating system. Specific Objectives: At the end of the unit you should be able to: F2007/Unit6/1 UNIT 6 OBJECTIVES General Objective:To understand the basic memory management of operating system Specific Objectives: At the end of the unit you should be able to: define the memory management

More information

Operating Systems Lecture 5: Memory Management I

Operating Systems Lecture 5: Memory Management I CSCI-GA.2250-001 Operating Systems Lecture 5: Memory Management I Hubertus Franke frankeh@cims.nyu.edu Programmer s dream Memory Private Infinitely large Infinitely fast Non-volatile Inexpensive Programmer

More information