Operating Systems (2INC0) 2017/18

Size: px
Start display at page:

Download "Operating Systems (2INC0) 2017/18"

Transcription

1 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

2 Agenda Reminder: OS & resources Memory hierarchy Address binding Memory management techniques Examples from early systems 2

3 Agenda Reminder: OS & resources Memory hierarchy Address binding Memory management techniques Examples from early systems 3

4 REMINDER: OS as resource manager Resource: Anything that is needed for a process to run Main Memory (MM) Space on a disk CPU OS role: create resource abstractions (hide HW details) e.g. files for disk space, processes for memory use, threads for CPU use. OS role: manage resource sharing space-sharing vs time-sharing provides a mechanism to isolate (protect) resources to manage sharing. 4

5 REMINDER: Logical OS Organization OS kernel Process and thread manager Memory manager File manager Device manager Hardware Processor(s) Main memory Devices All modules interact to coordinate their activities. Examples: For virtual memory: Process Man. Memory Man. Coordinate scheduling activity with memory allocation For performance improvement: File Man. Memory Man. Information from storage device read prior to request by a thread 5

6 REMINDER: Process execution Program must be brought (from disk) into MM and be placed within a process address space (needs protection). Addresses can start from zero then (abstract). CPU can access MM and registers (storage types) directly register access in one CPU clock (or less) MM access can take many cycles 6

7 User/programmer perspective A good memory is one that is non-volatile is private for a program (protected) has infinite capacity has zero access time is simple to use is cheap Such a memory clearly does not exist, but a hierarchical hardware organization combined with virtualization can help! We discuss virtual memory in the next lecture 7

8 Agenda Reminder: OS & resources Memory hierarchy Address binding Memory management techniques Examples from early systems 8

9 Analogy: Office storage hierarchy Office storage hierarchy Desktop File folder File cabinet Warehouse Upper-layers: info more frequently used Lower layers: info less frequently used 9

10 Memory hierarchy CPU register memory fast access (1 clk cycle) but limited in size CPU Registers Primary (executable memory) direct access (a few clk cycles), relatively larger Secondary memory (storage devices) I/O operations required for access, very cheap / very large, data stored for a longer period of time, access speed is slow (3 orders of magnitude slower than CPU register memory) More Frequently Used Information Primary Memory (Main Memory) e.g. RAM Secondary Memory e.g. Disk, Tape, Solid State 10

11 Contemporary memory hierarchy & dynamic loading CPU Registers Larger storage Secondary Primary (Executable) L1 Cache Memory L2 Cache Memory \ Main Memory Solid State Memory Rotating Magnetic Memory Optical Memory Faster access Sequentially Accessed Memory 11

12 OS exploiting the hierarchy Place frequently-used info high in the hierarchy infrequently-used info low in the hierarchy Updates are first applied to upper memory. Upward moves are (usually) copy operations Image exists in both higher & lower memories Downward moves are (usually) destructive Usually to save space in upper memory. Destroy image in upper memory Update image in lower memory avoid when the copy in lower memory is still consistent! 12

13 Memory manager functional requirements Classical memory managers provide Abstraction MM (virtually) appears to be larger than the physical machine mem. Memory as a large array of contiguously addressed bytes Abstract set of logical addresses to reference physical memory Allocation Allocate primary memory to processes as requested Isolation Enable mutually exclusive use of memory by processes Memory Sharing Enable memory to be shared by many processes 13

14 Memory manager performance requirements Minimum MM access time access is very often Maximum MM size Minimum cost 14

15 Agenda Reminder: OS & resources Memory hierarchy Address binding Memory management techniques Examples from early systems 15

16 Simple approach: Bring one executing process to MM Hardware Main OS OS OS Memory P1 P2 FREE FREE Possible update to secondary memory FREE CPU time CPU time P1 P2 time 16

17 Address space abstraction Instead of a set of physical primary memory addresses, processes are allocated a set of logical primary memory addresses process address space Memory manager has to bind logical primary memory addresses to physical primary memory locations Process Address Space Hardware Main (Primary) Memory 17

18 Binding: Virtual and physical address Decouple two types of addresses addresses (names) used by a process to identify objects addresses used by memory to identify storage locations Objects in different processes can have the same name (logical address), but they must be stored at different physical locations. address (name) processor Process A Process B 0=Δ 1= 2= object 0=Δ 1= 2= memory Δ Δ 18

19 Binding at which time? Static, i.e., during translation of program source to executable load module, or upon activation of a process (loading) at programming time at compile time at link time at load time Dynamic, i.e., during execution of the instructions of a running process (as late as possible). 19

20 Static binding Compile time compiler outputs object modules with isolated addresses Link time linker resolves external object references load module (addresses) stored in a file in secondary memory Instructions Data Stack Load time latest possible static binding scheme Reloc Object code Library code Other objects Relative + symbolic address Compiler Linker L o a d e r Symbolic address Relative address Absolute address Secondary memory Source code Load module Primary memory Process address space 20

21 Static binding Compile time binding Physical addresses corresponding to program instructions and data are determined at compile time Program must run at these physical memory locations (not relocatable) Link time binding Allows external references to be resolved for larger programs with multiple object modules (resulting in a load module) Load time binding Physical address binding upon loading into MM for execution (still not dynamically relocatable) 21

22 Program transformation (static binding) f( ): function call function f function f int i i = f( ) store 20 store 120 compiler linker loader branch f branch 0 store 1120 branch 1000 source module object module load module (secondary memory) load module (main memory) 22

23 Dynamic binding immediately before executing an instruction translation using an address map physical_address = address_map (logical_address) hardware support for efficiency processor logical address address_map physical address main memory data transfer (read or write) relocation register processor logical address + physical address main memory data transfer (read or write) 23

24 Program transformation (dynamic binding) function f function f int i i = f( ) store 20 store 120 compiler linker loader branch f branch 0 store 120 branch 0 source module object module load module (secondary memory) load module (main memory) address_map execution 24

25 Agenda Reminder: OS & resources Memory hierarchy Address binding Memory management techniques Examples from early systems 25

26 Early systems Single-programmed configuration Multi-programmed configurations Fixed partitions Dynamic partitions Relocatable dynamic partitions 26

27 Single-programmed configuration Program loaded in its entirety into MM and allocated as much contiguous MM space as needed If a program does not fit in the memory, it cannot be executed. No multiprogramming support. Hardware needed OS OS OS register to store base address accumulator to track size of program as it is loaded into memory (limit) base + limit can be used to protect kernel space against the process. P1 FREE FREE P2 FREE Once in MM, program stays there until execution ends. 27

28 Early systems Single-programmed configuration Multi-programmed configurations Fixed partitions Dynamic partitions Relocatable dynamic partitions 28

29 Fixed partitions Divide the memory available for user programs into fixed partitions 1 process/partition partitions vary in size to accommodate various programs (fixed at OS initialization) Issue: protection of the task s memory space Disadvantage: Entire program is stored in MM until the end of execution Problem: Internal fragmentation Goal: Choosing the right partition size Too small long turnaround time (doesn t fit in any partition in the worst case) Too big wasted memory Partition allocation scheme needed (first-fit example on the next slide) 29

30 Fixed partition -an example- Process List : P1 30K P2 50K P3 30K P4 25K Note: Process 3 has to wait even though 70K of contiguous free space is available (actually 70K+25K available). Original State 100K Partition 1 After Process Entry Process 1 (30K) wasted memory Partition 1 25K 25K 50K Partition 2 Partition 3 Partition 4 Process 4 (25K) Partition 2 Partition 3 Process 2 (50K) Partition 4 30

31 Early systems Single-programmed configuration Multi-programmed configurations Fixed partitions Dynamic partitions allocation deallocation Relocatable dynamic partitions 31

32 Dynamic partitions Partition size not fixed but determined based on the process size. Advantage: no memory waste due to internal fragmentation Disadvantage: Memory waste not solved completely Memory utilization deteriorates as new processes enter and old processes exit the system external fragmentation Programs still have to be stored contiguously. 32

33 Dynamic partitions -an example- First-fit allocation scheme Job List J1 10k J2 15k J3 20k J4 50k Operating System Job 1(10k) Job 2(15k) Job 3(20k) 10k 20k 35k 55k Job 1 ends Operating System Job 2(15k) Job 3(20k) 10k 20k 35k 55k Job 5 (5k) arrives Operating System Job 5(5k) Job 2(15k) Job 3(20k) 10k 15k 20k 35k 55k Job 4(50k) Job 4 ends Job 6 (30k) arrives Job 6(30k) 85k 105k 105k 105k Initial job allocation (a) After Job 1 and Job 4 have finished (b) After Job 5 and Job 6 have entered (c) 33

34 Dynamic partitions -an example- First-fit allocation scheme (cont d) Operating System Job 5(5k) 10k 15k 20k Operating System Job 5(5k) 10k 15k 20k Job 3 ends Job 2(15k) 35k 55k Job 7 (10k) arrives Job 2(15k) Job 7(10k) 35k 45k 55k Job 8 has to wait Job 6(30k) 85k 105k After Job 3 has finished (d) Job 8 (30k) arrives Job 6(30k) After Job 7 has entered (e) 85k 105k Note: Job 8 has to wait even though there is 35K of free memory space available 34

35 Dynamic partition -allocation schemes- Allocation schemes issues: decrease time, increase utilization First-fit Allocate the first partition that is big enough Advantage: Faster in making the allocation Disadvantage: Waste of memory Best-fit Allocate the smallest partition fitting the requirements Advantage: Produces the smallest leftover partition Makes best use of memory when it is possible to allocate a new job Disadvantage: Takes more time Question: How to organize free/busy partition list in both cases? 35

36 First-fit allocation -an example- P1 10K location organization P2 20K P3 30K* P4 10K Memory Memory Process Process location block size number size Status Fragmentation K P1 10K Busy 20K K P4 10K Busy 5K K P2 20K Busy 30K K Free Total Available: 115K Total Used: 40K 36

37 Best-fit allocation -an example- P1 10K size organization P2 20K P3 30K P4 10K Memory Memory Process Process location block size number size Status Fragmentation K P1 10K Busy 5K K P2 20K Busy None K P3 30K Busy None K P4 10K Busy 40K Total Available: 115K Total Used: 70K 37

38 Exercise The table of free memory spaces is given below. Show how this table will look after allocating a process that occupies 200 spaces using the Best-Fit algorithm. Before request After request Beginning address Memory block size Beginning address Memory block size * Best-Fit is not the best for dynamic partitions: Excessive memory fragmentation due to smaller free space - sliver 38

39 Allocation schemes First-Fit: clusters small holes at the top Next-Fit (rotating First-Fit): start each search at the point where the previous search stopped (faster search, slightly worse memory utilization than First-Fit) Best-Fit: worst performance due to excessive fragmentation Worst-Fit: always uses the largest available partition similar performance to first-fit and next-fit Optimized schemes statistics on average process size etc. needed 39

40 Early systems Single-programmed configuration Multi-programmed configurations Fixed partitions Dynamic partitions allocation deallocation Relocatable dynamic partitions 40

41 Release of memory space -deallocation- Occurs when process terminates or becomes suspended Deallocation for fixed partitions is simple Memory Manager resets status of memory block to free. Deallocation for dynamic partitions tries to combine free areas of memory whenever possible Is the block adjacent to another free block? If yes, combine the 2 blocks Busy Free Busy Is the block between 2 free blocks? If yes, combine those 3 blocks Free Busy Free Is the block isolated from other free blocks? If yes, make a new table entry Busy Busy Busy 41

42 Deallocation -an example- Before Deallocation After Deallocation Beginning Memory address block size Status Beginning address Memory block size Status Free Free Deallocate Free Free Free Free Free Free (7600) (200) (Busy) 1 * (null) * Free Free Free Free Free Free Free 42

43 Early systems Single-programmed configuration Multi-programmed configurations Fixed partitions Dynamic partitions Relocatable dynamic partitions compaction swapping 43

44 Relocatable dynamic partitions Solves problem of both internal and external fragmentation relocation and compaction avoids memory waste makes insufficient memory problems less frequent OS memory manager relocates programs to gather all empty blocks and compacts them to make 1 big free memory block. 44

45 Compaction steps Relocate every program in memory so that they re contiguous. Adjust every address, and every reference to an address, within each program to account for programs new locations in memory. Must leave alone all other values within the program (e.g., data values). Question: When should compaction be done? When a certain percent of memory becomes busy (e.g. 75%), When there are processes pending, or After a prescribed amount of time Note: Compaction cannot be done if address binding is static. 45

46 Compaction -an example- Memory before and after compaction Job 6 (84k) arrives Operating System Job 1 (8k) Job 4 (32k) Job 2 (16k) 10k 18k 30k 62k 92k 108k Operating System Job 1 (8k) Job 4 (32k) Job 2 (16k) Job 5 (48k) 10k 18k 50k 66k 114k Now Job 6 can be accommodated Operating System Job 1 (8k) Job 4 (32k) Job 2 (16k) Job 5 (48k) 10k 18k 50k 66k 114k Job 5 (48k) Job 6 (84k) 156k 210k Initial memory layout (a) 210k Memory layout after compaction (b) 198k 210k Memory layout after Job 6 has been loaded (c) 46

47 Memory compaction (strategies) Assume that a block of size 10 is needed (a) (a) initial state; (c) partial compaction; (b) (c) (b) complete compaction (d) minimal data movement (d) 47

48 Memory compaction (remarks) Overhead: very costly requires each word of memory to be read from and written into memory May take several seconds Contemporary systems Virtual Memory techniques (paging, segmentation) instead of compaction 48

49 Relocation Q: How to keep track of where each process is with respect to its original location? A: Special-purpose registers Relocation register Contains value to be added to each address referenced in the program Bounds register Stores highest (lowest) location of memory accessible by each program 49

50 Relocation register -an example- Job 4 loaded at memory location 30K (30720) It requires memory block of 32K (32768) At memory location an instruction: LOAD 4, ANSWER Answer is the value 37 Operating System Job 1 (8k) 10k 18k Operating System Job 1 (8k) 10k 18k 30k Load 4, Load 4, Job 4 (32k) 62k Job 2 (16k) Job 4 (32k) 50k 66k Relocation register Job 2 (16k) 92k Relocation register Job 5 (48k) ( a ) Go back 30-18=12K ( b ) 50

51 Swapping When? a program must be loaded into MM and there is not enough room move something else to secondary storage to make room. How? OS selects a process to swap-out and replaces it with another process from the secondary storage swap-out only those parts of process space that are not already on disk typically code is not modified benefits from hardware support that registers (keeps track of) modification Where to (on secondary memory)? either to an arbitrary file (introduces file management overhead) or to a special partition on disk, the swap space more efficient (low-level I/O) 51

52 Summary Single-user configuration Fixed partitions Dynamic partitions Relocatable Dynamic partitions Comments: All require that the entire program be loaded into memory be stored contiguously remain in memory until a process is completed Severe restrictions to the process size 52

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

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

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

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

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition Chapter 8: Memory Management 8.1 Silberschatz, Galvin and Gagne 2009 Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are

More information

Operating Systems (2INC0) 2017/18

Operating Systems (2INC0) 2017/18 Operating Systems (2INC0) 2017/18 Virtual Memory (10) Dr Courtesy of Dr I Radovanovic, Dr R Mak System rchitecture and Networking Group genda Recap memory management in early systems Principles of virtual

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

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

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

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

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

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition Chapter 8: Memory- Management Strategies Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation

More information

The Memory Management Unit. Operating Systems. Autumn CS4023

The Memory Management Unit. Operating Systems. Autumn CS4023 Operating Systems Autumn 2017-2018 Outline The Memory Management Unit 1 The Memory Management Unit Logical vs. Physical Address Space The concept of a logical address space that is bound to a separate

More information

Chapter 7: Main Memory. Operating System Concepts Essentials 8 th Edition

Chapter 7: Main Memory. Operating System Concepts Essentials 8 th Edition Chapter 7: Main Memory Operating System Concepts Essentials 8 th Edition Silberschatz, Galvin and Gagne 2011 Chapter 7: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and 64-bit Architectures Example:

More information

CS307: Operating Systems

CS307: Operating Systems CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn

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

Chapter 8: Memory-Management Strategies

Chapter 8: Memory-Management Strategies Chapter 8: Memory-Management Strategies Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and

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

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

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

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science Virtual Memory CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture have been largely based on those from an earlier edition of the course text Operating

More information

CSE325 Principles of Operating Systems. Memory. David P. Duggan. March 6, 2010

CSE325 Principles of Operating Systems. Memory. David P. Duggan. March 6, 2010 CSE325 Principles of Operating Systems Memory David P. Duggan dduggan@sandia.gov March 6, 2010 Where is Memory? Characteristics? Issues/challenges? 3/6/12 CSE325 - Main Memory 2 Outline Memory management

More information

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

6 - Main Memory EECE 315 (101) ECE UBC 2013 W2 6 - Main Memory EECE 315 (101) ECE UBC 2013 W2 Acknowledgement: This set of slides is partly based on the PPTs provided by the Wiley s companion website (including textbook images, when not explicitly

More information

Chapter 8: Main Memory. Operating System Concepts 9 th Edition

Chapter 8: Main Memory. Operating System Concepts 9 th Edition Chapter 8: Main Memory Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel

More information

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition Chapter 8: Memory- Management Strategies Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation

More information

Chapter 8: Memory- Management Strategies

Chapter 8: Memory- Management Strategies Chapter 8: Memory Management Strategies Chapter 8: Memory- Management Strategies Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and

More information

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

Chapter 8: Memory Management. Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging Chapter 8: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 1 Background Memory management is crucial in better utilizing one of the most important

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

Part Three - Memory Management. Chapter 8: Memory-Management Strategies

Part Three - Memory Management. Chapter 8: Memory-Management Strategies Part Three - Memory Management Chapter 8: Memory-Management Strategies Chapter 8: Memory-Management Strategies 8.1 Background 8.2 Swapping 8.3 Contiguous Memory Allocation 8.4 Segmentation 8.5 Paging 8.6

More information

8.1 Background. Part Four - Memory Management. Chapter 8: Memory-Management Management Strategies. Chapter 8: Memory Management

8.1 Background. Part Four - Memory Management. Chapter 8: Memory-Management Management Strategies. Chapter 8: Memory Management Part Four - Memory Management 8.1 Background Chapter 8: Memory-Management Management Strategies Program must be brought into memory and placed within a process for it to be run Input queue collection of

More information

Classifying Information Stored in Memory! Memory Management in a Uniprogrammed System! Segments of a Process! Processing a User Program!

Classifying Information Stored in Memory! Memory Management in a Uniprogrammed System! Segments of a Process! Processing a User Program! Memory Management in a Uniprogrammed System! A! gets a fixed segment of (usually highest )"! One process executes at a time in a single segment"! Process is always loaded at "! Compiler and linker generate

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 8.2 Silberschatz, Galvin

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

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

Preview. Memory Management

Preview. Memory Management 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

More information

CSE 421/521 - Operating Systems Fall Lecture - XII Main Memory Management. Tevfik Koşar. University at Buffalo. October 18 th, 2012.

CSE 421/521 - Operating Systems Fall Lecture - XII Main Memory Management. Tevfik Koşar. University at Buffalo. October 18 th, 2012. CSE 421/521 - Operating Systems Fall 2012 Lecture - XII Main Memory Management Tevfik Koşar University at Buffalo October 18 th, 2012 1 Roadmap Main Memory Management Fixed and Dynamic Memory Allocation

More information

Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems

Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems Instructor: Dr. Turgay Korkmaz Department Computer Science The University of Texas at San Antonio Office: NPB

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

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES OBJECTIVES Detailed description of various ways of organizing memory hardware Various memory-management techniques, including paging and segmentation To provide

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

Chapters 9 & 10: Memory Management and Virtual Memory

Chapters 9 & 10: Memory Management and Virtual Memory Chapters 9 & 10: Memory Management and Virtual Memory Important concepts (for final, projects, papers) addressing: physical/absolute, logical/relative/virtual overlays swapping and paging memory protection

More information

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

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science Memory Management CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture are based on those from Operating Systems Concepts, 9th ed., by Silberschatz, Galvin,

More information

Chapter 9: Memory Management. Background

Chapter 9: Memory Management. Background 1 Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 9.1 Background Program must be brought into memory and placed within a process for

More information

Roadmap. Tevfik Koşar. CSC Operating Systems Spring Lecture - XII Main Memory - II. Louisiana State University

Roadmap. Tevfik Koşar. CSC Operating Systems Spring Lecture - XII Main Memory - II. Louisiana State University CSC 4103 - Operating Systems Spring 2007 Lecture - XII Main Memory - II Tevfik Koşar Louisiana State University March 8 th, 2007 1 Roadmap Dynamic Loading & Linking Contiguous Memory Allocation Fragmentation

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009! Chapter 8: Memory Management Background" Swapping " Contiguous Memory Allocation" Paging" Structure

More information

Memory Management. Contents: Memory Management. How to generate code? Background

Memory Management. Contents: Memory Management. How to generate code? Background TDIU11 Operating systems Contents: Memory Management Memory Management [SGG7/8/9] Chapter 8 Background Relocation Dynamic loading and linking Swapping Contiguous Allocation Paging Segmentation Copyright

More information

Chapter 8: Memory Management

Chapter 8: Memory Management Chapter 8: Memory Management Chapter 8: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 8.2 Silberschatz, Galvin and Gagne 2005 Background Program/Code

More information

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

Operating Systems. 09. Memory Management Part 1. Paul Krzyzanowski. Rutgers University. Spring 2015 Operating Systems 09. Memory Management Part 1 Paul Krzyzanowski Rutgers University Spring 2015 March 9, 2015 2014-2015 Paul Krzyzanowski 1 CPU Access to Memory The CPU reads instructions and reads/write

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

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

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

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

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

Chapter 8: Memory Management Strategies

Chapter 8: Memory Management Strategies Chapter 8: Memory- Management Strategies, Silberschatz, Galvin and Gagne 2009 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table

More information

Memory Management. Memory Management

Memory Management. Memory Management Memory Management Gordon College Stephen Brinton Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 1 Background Program must be brought into memory

More information

Module 8: Memory Management

Module 8: Memory Management Module 8: Memory Management Background Logical versus Physical Address Space Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 8.1 Background Program must be brought into memory

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

Chapter 8: Memory Management

Chapter 8: Memory Management Chapter 8: Memory Management Chapter 8: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 8.2 Background Program must be brought into memory and placed

More information

Module 9: Memory Management. Background. Binding of Instructions and Data to Memory

Module 9: Memory Management. Background. Binding of Instructions and Data to Memory Module 9: Memory Management Background Logical versus Physical Address Space Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging 9.1 Background Program must be brought into memory

More information

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

Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Basic Hardware Address Binding Logical VS Physical Address Space Dynamic Loading Dynamic Linking and Shared

More information

CS418 Operating Systems

CS418 Operating Systems CS418 Operating Systems Lecture 2 Memory Management early systems Textbook: Operating Systems by William Stallings 1 1. Early Memory Management Systems In the early days, a computer can only have one user

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

I.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 8: MEMORY

I.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 8: MEMORY I.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 8: MEMORY MANAGEMENT Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the

More information

Chapter 8 Memory Management

Chapter 8 Memory Management Chapter 8 Memory Management Da-Wei Chang CSIE.NCKU Source: Abraham Silberschatz, Peter B. Galvin, and Greg Gagne, "Operating System Concepts", 9th Edition, Wiley. 1 Outline Background Swapping Contiguous

More information

CHAPTER 8: MEMORY MANAGEMENT. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

CHAPTER 8: MEMORY MANAGEMENT. By I-Chen Lin Textbook: Operating System Concepts 9th Ed. CHAPTER 8: MEMORY MANAGEMENT By I-Chen Lin Textbook: Operating System Concepts 9th Ed. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the

More information

Basic Memory Management

Basic Memory Management Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester 10/15/14 CSC 2/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it

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

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

Chapter 8 Main Memory

Chapter 8 Main Memory COP 4610: Introduction to Operating Systems (Spring 2014) Chapter 8 Main Memory Zhi Wang Florida State University Contents Background Swapping Contiguous memory allocation Paging Segmentation OS examples

More information

I.-C. Lin, Assistant Professor. Textbook: Operating System Principles 7ed CHAPTER 8: MEMORY

I.-C. Lin, Assistant Professor. Textbook: Operating System Principles 7ed CHAPTER 8: MEMORY I.-C. Lin, Assistant Professor. Textbook: Operating System Principles 7ed CHAPTER 8: MEMORY MANAGEMENT Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of

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

PROCESS VIRTUAL MEMORY. CS124 Operating Systems Winter , Lecture 18

PROCESS VIRTUAL MEMORY. CS124 Operating Systems Winter , Lecture 18 PROCESS VIRTUAL MEMORY CS124 Operating Systems Winter 2015-2016, Lecture 18 2 Programs and Memory Programs perform many interactions with memory Accessing variables stored at specific memory locations

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

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

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it to be run Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester Mono-programming

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

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

Principles of Operating Systems

Principles of Operating Systems Principles of Operating Systems Lecture 18-20 - Main Memory Ardalan Amiri Sani (ardalan@uci.edu) [lecture slides contains some content adapted from previous slides by Prof. Nalini Venkatasubramanian, and

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

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

Main Memory. CISC3595, Spring 2015 X. Zhang Fordham University Main Memory CISC3595, Spring 2015 X. Zhang Fordham University 1 Memory Management! Background!! Contiguous Memory Allocation!! Paging!! Structure of the Page Table!! Segmentation!! Example: The Intel Pentium

More information

Main Memory. Electrical and Computer Engineering Stephen Kim ECE/IUPUI RTOS & APPS 1

Main Memory. Electrical and Computer Engineering Stephen Kim ECE/IUPUI RTOS & APPS 1 Main Memory Electrical and Computer Engineering Stephen Kim (dskim@iupui.edu) ECE/IUPUI RTOS & APPS 1 Main Memory Background Swapping Contiguous allocation Paging Segmentation Segmentation with paging

More information

Lecture 8 Memory Management Strategies (chapter 8)

Lecture 8 Memory Management Strategies (chapter 8) Bilkent University Department of Computer Engineering CS342 Operating Systems Lecture 8 Memory Management Strategies (chapter 8) Dr. İbrahim Körpeoğlu http://www.cs.bilkent.edu.tr/~korpe 1 References The

More information

Introduction to Operating Systems

Introduction to Operating Systems Introduction to Operating Systems Lecture 6: Memory Management MING GAO SE@ecnu (for course related communications) mgao@sei.ecnu.edu.cn Apr. 22, 2015 Outline 1 Issues of main memory 2 Main memory management

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: Real Storage. Unit IV

MEMORY MANAGEMENT: Real Storage. Unit IV MEMORY MANAGEMENT: Real Storage Unit IV OUTLINE Storage Organization Storage Management Storage Hierarchy Storage Management Strategies Storage Placement Strategies Segmentation Paging & Demand Paging

More information

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Memory Management

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Memory Management ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective Part I: Operating system overview: Memory Management 1 Hardware background The role of primary memory Program

More information

15 Sharing Main Memory Segmentation and Paging

15 Sharing Main Memory Segmentation and Paging Operating Systems 58 15 Sharing Main Memory Segmentation and Paging Readings for this topic: Anderson/Dahlin Chapter 8 9; Siberschatz/Galvin Chapter 8 9 Simple uniprogramming with a single segment per

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

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

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

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

Module 8: Memory Management

Module 8: Memory Management Module 8: Memory Management Background Logical versus Physical Address Space Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging Operating System Concepts 8.1 Silberschatz and Galvin

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

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

3. Memory Management

3. Memory Management Principles of Operating Systems CS 446/646 3. Memory Management René Doursat Department of Computer Science & Engineering University of Nevada, Reno Spring 2006 Principles of Operating Systems CS 446/646

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

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