Memory Management (Chaper 4, Tanenbaum)

Size: px
Start display at page:

Download "Memory Management (Chaper 4, Tanenbaum)"

Transcription

1 Memory Management (Chaper 4, Tanenbaum) Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt Introduction The CPU fetches instructions and data of a program from memory; therefore, both the program and its data must reside in the main (RAM and ROM) memory. Modern multiprogramming systems are capable of storing more than one program, together with the data they access, in the main memory. A fundamental task of the memory management component of an operating system is to ensure safe execution of programs by providing: Sharing of memory Memory protection Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 1

2 Issues in sharing memory Transparency Several processes may co-exist, unaware of each other, in the main memory and run regardless of the number and location of processes. Safety (or protection) Processes must not corrupt each other (nor the OS!) Efficiency CPU utilization must be preserved and memory must be fairly allocated. Want low overheads for memory management. Relocation Ability of a program to run in different memory locations. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 2 Storage allocation Information stored in main memory can be classified in a variety of ways: Program (code) and data (variables, constants) Read-only (code, constants) and read-write (variables) Address (e.g., pointers) or data (other variables); binding (when memory is allocated for the object): static or dynamic The compiler, linker, loader and run-time libraries all cooperate to manage this information. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 3

3 Creating an executable code Before a program can be executed by the CPU, it must go through several steps: Compiling (translating) generates the object code. Linking combines the object code into a single selfsufficient executable code. Loading copies the executable code into memory. May include run-time linking with libraries. Execution dynamic memory allocation. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 4 From source to executable code translation compiler linking linker shared libraries source code object code (module) libraries (object) loading loader execution. code data executable code (load module) workspace. secondary storage main memory Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 5

4 Address binding (relocation) The process of associating program instructions and data (addresses) to physical memory addresses is called address binding, or relocation. Static new locations are determined before execution. Compile time: The compiler or assembler translates symbolic addresses (e.g., variables) to absolute addresses. Load time: The compiler translates symbolic addresses to relative (relocatable) addresses. The loader translates these to absolute addresses. Dynamic new locations are determined during execution. Run time: The program retains its relative addresses. The absolute addresses are generated by hardware. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 6 Functions of a linker A compile-time linker collects (if possible) and puts together all the required pieces to form the executable code. Issues: Relocation where to put pieces. Cross-reference where to find pieces. Re-organization new memory layout. x x main main() { int X;... printf(...); } X= = + x libc printf(...) {... }.. a.out x2 main() { int X;... printf(...); } printf(...) x21 {... } X=... x8 Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 7

5 Functions of a loader A loader places the executable code in main memory starting at a pre-determined location (base or start address). This can be done in several ways, depending on hardware architecture: Absolute loading: always loads programs into a designated memory location. Relocatable loading: allows loading programs in different memory locations. Dynamic (run-time) loading: loads functions when first called (if ever). Code Data Load Module Code Data Workspace Main Memory Memory Image Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 8 Absolute and relocatable modules main() { int x; x1 main: x main: x main:... incr(&x); jsr x12 jsr x2 jsr incr } incr(int* a) {... } x12 incr: x2 incr: x Relocatable load module incr Source code Absolute load module Relocatable (relative) load Module aka position independent code (PIC) Relocatable dynamic load module Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 9

6 Simple management schemes An important task of a memory management system is to bring (load) programs into main memory for execution. The following contiguous memory allocation techniques were commonly employed by earlier operating systems * : Direct placement Overlays Partitioning *Note: Techniques similar to those listed above are still used by some modern, dedicated special-purpose operating systems and real-time systems. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 1 Direct placement max user OS (drivers, buffers) unused User Program Operating System Memory allocation is trivial. No special relocation is needed, because the user programs are always loaded (one at a time) into the same memory location (absolute loading). The linker produces the same loading address for every user program. Examples: Early batch monitors MS-DOS Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 11

7 Overlays, 1, 2, 3, 1,1 1,2 1,1 1,, Operating System 2,1 2,3 2,2 3,1 2,1 2,, Operating System memory snapshots overlay tree 3,2 Historically, before the sharing of main memory among several programs was automated, users developed techniques to allow large programs to execute (fit) in smaller memory. A program was organized (by the user) into a tree-like structure of object modules, called overlays. The root overlay was always loaded into the memory, whereas the sub-tree were (re-)loaded as needed by simply overlaying existing code. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 12 Partitioning A simple method to accommodate several programs in memory at the same time (to support multiprogramming) is partitioning. In this scheme, the memory is divided into a number of contiguous regions, called partitions. Two forms of memory partitioning, depending on when and how partitions are created (and modified), are possible: Static partitioning Dynamic partitioning These techniques were used by the IBM OS/36 operating system MFT (Multiprogramming with Fixed Number of Tasks) and MVT (Multiprogramming with Variable Number of Tasks.) Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 13

8 Static partitioning small jobs average jobs large jobs Operating System 1 K 1 K 5 K Main memory is divided into fixed number of (fixed size) partitions during system generation or startup. Programs are queued to run in the smallest available partition. An executable prepared to run in one partition may not be able to run in another, without being re-linked. This technique uses absolute loading. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 14 Dynamic partitioning Any number of programs can be loaded to memory as long as there is room for each. When a program is loaded (relocatable loading), it is allocated memory in exact amount as it needs. Also, the addresses in the program are fixed after loaded, so it cannot move. The operating system keeps track of each partition (their size and locations in the memory.) A B A B... K Operating System Operating System Operating System Operating System Partition allocation at different times Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 15

9 Address translation In order to provide basic protection among programs sharing the memory, both of the above partitioning techniques use a hardware capability known as memory address mapping, or address translation. In its simplest form, this mapping works as follows: 2 Limits Register User program in a partition Jump 175 (175) (475) < + Memory access error 3 Base Register Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 16 Fragmentation Fragmentation refers to the unused memory that the memory management system cannot allocate. Internal fragmentation Waste of memory within a partition, caused by the difference between the size of a partition and the process loaded. Severe in static partitioning schemes. External fragmentation Waste of memory between partitions, caused by scattered noncontiguous free space. Severe in dynamic partitioning schemes. Compaction (aka relocation) is a technique that is used to overcome external fragmentation. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 17

10 Swapping The basic idea of swapping is to treat main memory as a preemptable resource. A high-speed swapping device is used as the backing storage of the preempted processes. SWAP-IN SWAP-OUT Swapping device (usually, a hard disk) Operating System Memory Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 18 Swapping cont. Swapping is a medium-term scheduling method. Memory becomes preemptable. processes on disk swap-in swap-out processes in memory dispatch suspend process running SWAPPER DISPATCHER Swapping brings flexibility even to systems with fixed partitions, because: if needed, the operating system can always make room for high-priority jobs, no matter what! Note that, although the mechanics of swapping are fairly simple in principle, its implementation requires specific support (e.g., special file system and dynamic relocation) from the OS that uses it. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 19

11 More on swapping The responsibilities of a swapper include: Selection of processes to swap out criteria: suspended/blocked state, low priority, time spent in memory Selection of processes to swap in criteria: time spent on swapping device, priority Allocation and management of swap space on a swapping device. Swap space can be: system wide dedicated (e.g., swap partition or disk) Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 2 Memory protection The second fundamental task of a memory management system is to protect programs sharing the memory from each other. This protection also covers the operating system itself. Memory protection can be provided at either of the two levels: Hardware: address translation (most common!) Software: language dependent: strong typing language independent: software fault isolation Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 21

12 Dynamic relocation With dynamic relocation, each program-generated address (logical address) is translated to hardware address (physical address) at runtime for every reference, by a hardware device known as the memory management unit (MMU). address translation CPU program (logical or virtual) address MMU hardware (physical or real) address Memory Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 22 Two views of memory Dynamic relocation leads to two different views of main memory, called address spaces. A P A-start P A-end B P B-start S B P B-end S C S A C P C-start logical view (logical address space) physical view (physical address space) P C-end Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 23

13 Base and bounds relocation Logical Address bounds > base + Physical Address fault! In principle, this is the same technique used earlier by IBM 36 mainframes. Each program is loaded into a contiguous region of memory. This region appears to be private and the bounds register limits the range of the logical address of each program. Hardware implementation is cheap and efficient: 2 registers plus an adder and a comparator. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 24 Segmentation A segment is a region of contiguous memory. The most important problem with base-and-bounds relocation is that there is only one segment for each process. Segmentation generalizes the base-and-bounds technique by allowing each process to be split over several segments (i.e., multiple base-bounds pairs). A segment table holds the base and bounds of each segment. Although the segments may be scattered in memory, each segment is mapped to a contiguous region. Additional fields (Read/Write and Shared) in the segment table adds protection and sharing capabilities to segments (i.e., permissions) Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 25

14 Relocation with segmentation Logical Address Segment # Offset Seg # Base Bounds R/W S X1 X3 X X2 X4 X112 X334 XFFF X2F X > fault! + Physical Address See next slide for memory allocation example. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 26 Segmentation an example x6 x552 Logical addresses Mapping Physical addresses x5 x4 x3f x3 x2 x134 x1 x12 x Seg 4 Seg 1 Seg 3 Seg Seg 2 x452 x4 x334 x3 x2f x2 x112 x1 x Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 27

15 More on segments When a process is created, an empty segment table is inserted into the process control block. Table entries are filled as new segments are allocated for the process. The segments are returned to the free segment pool when the process terminates. Segmentation, as well as the base and bounds approach, causes external fragmentation (because they require contiguous physical memory) and requires memory compaction. An advantage of the approach is that only a segment, instead of a whole process, may be swapped to make room for the (new) process. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 28 Paging Physical memory is divided into a number of fixed size blocks, called frames. The logical memory is also divided into chunks of the same size, called pages. The size of frame/page is determined by the hardware and can be any value between 512 bytes (VAX) and 16 megabytes (MIPS 1)! Why have such large frames? Why not? A page table defines (maps) the base address of pages for each frame in the main memory. The major goals of paging are to make memory allocation and swapping easier and to reduce fragmentation. Paging also allows allocation of noncontiguous memory (i.e., pages need not be adjacent.) Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 29

16 Relocation with paging Page # Logical Address Page offset Page table Page Table Entry (PTE) Frame # Frame offset Physical Address Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 3 Paging an example Logical Address Space Logical Address Page table Physical Address Physical Memory Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 31

17 Hardware support for paging There are different hardware implementations of page tables to support paging. A set of dedicated registers, holding base addresses of frames. In memory page table with a page table base register (PTBR). Same as above with multi-level page tables. With the latter two approaches, there is a constant overhead of accessing a memory location (What? Why?) Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 32 Multi-level paging an example Second-level Page Tables Page Number P1 P2 Page Offset Top-level Page Table To frames Frame Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 33

18 One level paging the PDP-11 The larger PDP-11 models have 16-bit logical addresses (i.e., 64 KB) and up to 4MB of memory with page size of 8 KB. Note: Physical address space larger than logical space! There are two separate logical address spaces; one for instructions and one for data. The two page tables have eight entries, each controlling one of the eight frames per process. Data i Instruction i Frames Virtual page number Logical address Offset Frame number Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 34 Two level paging the VAX The VAX is the successor of the PDP-11, with 32-bit logical addresses. The VAX has 512 byte pages. 4 GB VAX virtual address Virtual page number Offset reserved 3 GB Shared among processes Space: User program and data 1 User stack 1 System 11 Reserved 2 GB 1GB user stack user program and data system... User processes Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 35

19 Other MMU architectures Some SPARC processors used by the Sun workstations have a paging MMU with three-level page tables and 4KB pages. Motorola 683 processor uses on-chip MMU with programmable multi-level (1 to 5) page tables and 256 byte to 32KB pages. PowerPC processors support complex address translation mechanisms and, based on the implementation, provide 2 8 (64-bit) and 2 52 (32-bit) byte long logical address spaces. Intel Pentium processors support both segmented and paged memory with 4KB pages. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 36 Inverted page tables Page # Logical address Offset (Hash) Inverted Page Table Page # Frame # Chain Simplified Inverted paging used on IBM RS6 Hash Table Frame # Offset Physical address The inverted page table has one entry for each memory frame. Hashing is used to speedup table search. The inverted page table can either be per process or system-wide. In the latter case, a new entry, PID is added to the table. Adv: independent of size of address space; small table(s) if we have large logical address spaces. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 37

20 Segmentation with paging Logical Address S # P # Offset Physical Address Frame # Offset + Frame i Segment Base Register Segment Table Page Table Main Memory Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 38 Address translation on a Pentium Logical address selector offset This is a simplified summary of combined address translation on a Pentium when paging is enabled. + Descriptor table OR Linear address (4KB pages) dir table offset The physical address of the current page directory is stored in the CR3 register. 4KB entry 4M B entry Page directory Page table 4KB frame dir offset Linear address (4MB pages) 4MB frame Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 39

21 Associative memory Problem: Both paging and segmentation schemes introduce extra memory references to access translation tables. Solution? Translation buffers (like caches) Based on the notion of locality (at a given time a process is only using a few pages or segments), a very fast but small associative (content addressable) memory is used to store a few of the translation table entries. This memory is known as a translation look-aside buffer or TLB. MIPS R2/R3 TLB entry (64 bits) Virtual Physical Page Number PID Frame Number Flags Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 4 Address translation with TLB Logical address Page # Offset VPN TLB flags PFN Page Table TLB update First try TLB PTE TLB miss TLB hit TLB is finite in size! Frame # Offset Physical address Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 41

22 Memory caching CPU Main Memory Similar to storing memory addresses in TLBs, frequently used data in main memory can also be stored in fast buffers, called cache memory, or simply cache. Basically, memory access occurs as follows: Word Transfer. Cache Block Transfer Block 2 n-1 for each memory reference if data is not in cache <miss> if cache is full remove some data if read access issue memory read place data in cache return data else <hit> if read access return data else store data in cache The idea is to make frequent memory accesses faster! Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 42 Cache terminology Cache hit: item is in the cache. Cache miss: item is not in the cache; must do a full operation. Categories of cache miss: Compulsory: the first reference will always miss. Capacity: non-compulsory misses because of limited cache size. Effective access time: P(hit) * cost of hit + P(miss)* cost of miss, where P(hit) = 1 - P(miss) Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 43

23 Issues in cache design Although there are many different cache designs, all share a few common design elements: Cache size how big is the cache? The cache only contains a copy of portions of main memory. The larger the cache the slower it is. Common sizes vary between 4KB and 4MB. Mapping function how to map main memory blocks into cache lines? Common schemes are: direct, fully associative, and set associative. Replacement algorithm which line will be evicted if the cache lines are full and a new block of memory is needed. A replacement algorithm, such as LRU, FIFO, LFU, or Random is needed only for associative mapping (Why?) Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 44 Issues in cache design cont. Write policy What if CPU modifies a (cached) location? This design issue deals with store operations to cached memory locations. Two basic approaches are: write through (modify the original memory location as well as the cached data) and write back (update the memory location only when the cache line is evicted.) Block (or line) size how many words can each line hold? Studies have shown that a cache line of 4 to 8 addressable units (bytes or words) provide close to optimal number of hits. Number of caches how many levels? Unified or split cache for data and instructions? Studies have shown that a second level cache improves performance. Pentium and Power PC processors each have on-chip level-1 (L1) split caches. Pentium Pro processors have on-chip level-2 (L2) cache, as well. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 45

24 Mapping function Since there are more main memory blocks (Block i for i= to n) than cache lines (Line j for j= to m, and n >> m), an algorithm is needed for mapping main memory blocks to cache lines. Direct mapping maps each block of memory into only one possible cache line. Block i maps to Line j, where i = j modulo m. Associative mapping maps any memory block to any line of the cache. Set associative mapping cache lines are grouped into sets and a memory block can be mapped to any line of a cache set. Block i maps to Set j where i=j modulo v and v is the number of sets with k lines each. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 46 Set associative cache organization memory address Tag Set Word set B B 1 B 2 set j Compare B j Cache hit Set v-1 Main memory Cache miss Cache Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 47

25 Dynamic memory allocation Static memory allocation schemes are not sufficient at run-time because of the unpredictable nature of executing programs. For certain programs, such as recursive functions or programs that use complex data structures, the memory needs cannot be known in advance. Two basic operations are needed: allocate and free. For example, in UNIX, these are malloc() and free(). Dynamic allocation can be handled using either stack (hierarchical, restrictive) or heap (more general, but less efficient) allocation. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 48 Stack organization Memory allocation and freeing operations are partially predictable. Since the organization is hierarchical, the freeing operates in reverse (opposite) order. top top B s stack frame top top A s stack frame A s stack frame A s stack frame top Current stack After call to A After call to B After returning from B After returning from A Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 49

26 Heap organization Allocation and release of heap space is totally random. Heaps are used for allocation of arbitrary list structures and complex data organizations. As programs execute (and allocate and free structures), heap space will fill with holes (unallocated space, i.e., fragmentation) Statistically, for first-fit, even with some optimization, given N allocated blocks, another.5n blocks will be lost due to fragmentation. This result is known as the fifty percent rule. (pg. 254 in Silberschatz textbook) Free List A snapshot of heap Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 5 Free memory management Bit maps This technique divides memory into fixed-size blocks (e.g., sectors of 256-byte blocks) and keeps an array of bits (bit map), one bit for each block. Linked lists A free list keeps track of the unused memory. There are several algorithms that can be used, depending on the way the unused memory blocks are allocated: first fit, best fit, and worst fit. Buddy system This algorithm takes advantage of binary systems. As a process requests memory, it is given a block of memory with a size of power two in which the process can just fit. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 51

27 Reclaiming memory How do we know when memory can be freed? It is trivial when a memory block is used by one process. However, this task becomes difficult when a block is shared (e.g., accessed through pointers) by several processes. Two problems with reclaiming memory: Dangling pointers: occur when the original allocator frees a shared pointer. Memory leaks: occur when we forget to free storage, even when it will not or cannot be used again. This is a common and serious problem; lots of tools. Unacceptable in an OS. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 52 Reference counts Memory reclamation can be done by keeping track of reference counters (i.e., the outstanding pointers to each block of memory.) When the counter goes down to zero, the memory block is freed. This scheme works fine with hierarchical structures, but becomes tricky with circular structures. Examples: Smalltalk and Java use a similar scheme. UNIX s in-memory file descriptors And, after a system crash, fsck program runs (during rebooting) to check the integrity of on-disk file systems. Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 53

28 Garbage collection As an alternative to an explicit free operation, some systems implicitly do so (free storage) by simply deleting pointers. These systems search through all deleted pointers and reclaim the storage referenced by them. Some languages, e.g., Lisp and Java, support this kind of reclaimed (free) memory management. Garbage collection is often expensive; it could use more than 2% of the total CPU time! Also, it is difficult to code and debug garbage collectors. But, garbage collection eliminates a large class of application programmer errors (a good thing)! Copyright Eskicioglu and Marsland (and Prentice-Hall and Paul Lu) Memory Mgmt 54

Memory Management (Chaper 4, Tanenbaum)

Memory Management (Chaper 4, Tanenbaum) Memory Management (Chaper 4, Tanenbaum) Memory Mgmt Introduction The CPU fetches instructions and data of a program from memory; therefore, both the program and its data must reside in the main (RAM 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

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

16 Sharing Main Memory Segmentation and Paging

16 Sharing Main Memory Segmentation and Paging Operating Systems 64 16 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 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

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

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

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

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

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

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

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

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

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

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: 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: 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. 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

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

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

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

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

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

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

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

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

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

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

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

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 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 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

Outlook. Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium

Outlook. Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium Main Memory Outlook Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 2 Backgound Background So far we considered how to share

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/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

! What is main memory? ! What is static and dynamic allocation? ! What is segmentation? Maria Hybinette, UGA. High Address (0x7fffffff) !

! What is main memory? ! What is static and dynamic allocation? ! What is segmentation? Maria Hybinette, UGA. High Address (0x7fffffff) ! Memory Questions? CSCI [4 6]730 Operating Systems Main Memory! What is main memory?! How does multiple processes share memory space?» Key is how do they refer to memory addresses?! What is static and dynamic

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 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

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

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. 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

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

Virtual Memory 1. Virtual Memory

Virtual Memory 1. Virtual Memory Virtual Memory 1 Virtual Memory key concepts virtual memory, physical memory, address translation, MMU, TLB, relocation, paging, segmentation, executable file, swapping, page fault, locality, page replacement

More information

CS6401- Operating System UNIT-III STORAGE MANAGEMENT

CS6401- Operating System UNIT-III STORAGE MANAGEMENT UNIT-III STORAGE MANAGEMENT Memory Management: Background In general, to rum a program, it must be brought into memory. Input queue collection of processes on the disk that are waiting to be brought into

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

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

How to create a process? What does process look like?

How to create a process? What does process look like? How to create a process? On Unix systems, executable read by loader Compile time runtime Ken Birman ld loader Cache Compiler: generates one object file per source file Linker: combines all object files

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

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

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

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

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

Virtual Memory 1. Virtual Memory

Virtual Memory 1. Virtual Memory Virtual Memory 1 Virtual Memory key concepts virtual memory, physical memory, address translation, MMU, TLB, relocation, paging, segmentation, executable file, swapping, page fault, locality, page replacement

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

Memory Management. An expensive way to run multiple processes: Swapping. CPSC 410/611 : Operating Systems. Memory Management: Paging / Segmentation 1

Memory Management. An expensive way to run multiple processes: Swapping. CPSC 410/611 : Operating Systems. Memory Management: Paging / Segmentation 1 Memory Management Logical vs. physical address space Fragmentation Paging Segmentation An expensive way to run multiple processes: Swapping swap_out OS swap_in start swapping store memory ready_sw ready

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

Chapter 8 Virtual Memory

Chapter 8 Virtual Memory Chapter 8 Virtual Memory Contents Hardware and control structures Operating system software Unix and Solaris memory management Linux memory management Windows 2000 memory management Characteristics of

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

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 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

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

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

Memory Management and Protection

Memory Management and Protection Part IV Memory Management and Protection Sadeghi, Cubaleska RUB 2008-09 Course Operating System Security Memory Management and Protection Main Memory Virtual Memory Roadmap of Chapter 4 Main Memory Background

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

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

Logical versus Physical Address Space

Logical versus Physical Address Space CHAPTER 8: MEMORY MANAGEMENT Background Logical versus Physical Address Space Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging Operating System Concepts, Addison-Wesley 1994

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

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

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

Process size is independent of the main memory present in the system.

Process size is independent of the main memory present in the system. Hardware control structure Two characteristics are key to paging and segmentation: 1. All memory references are logical addresses within a process which are dynamically converted into physical at run time.

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

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

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

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 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

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

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

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 super big to hold a program

More information

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

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time Memory Management To provide a detailed description of various ways of organizing memory hardware To discuss various memory-management techniques, including paging and segmentation To provide a detailed

More information

CS5460: Operating Systems Lecture 14: Memory Management (Chapter 8)

CS5460: Operating Systems Lecture 14: Memory Management (Chapter 8) CS5460: Operating Systems Lecture 14: Memory Management (Chapter 8) Important from last time We re trying to build efficient virtual address spaces Why?? Virtual / physical translation is done by HW and

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

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

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

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

ECE519 Advanced Operating Systems

ECE519 Advanced Operating Systems IT 540 Operating Systems ECE519 Advanced Operating Systems Prof. Dr. Hasan Hüseyin BALIK (8 th Week) (Advanced) Operating Systems 8. Virtual Memory 8. Outline Hardware and Control Structures Operating

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

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

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

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [MEMORY MANAGEMENT] Matrices in Banker s algorithm Max, need, allocated Shrideep Pallickara Computer Science Colorado

More information

Multi-Process Systems: Memory (2) Memory & paging structures: free frames. Memory & paging structures. Physical memory

Multi-Process Systems: Memory (2) Memory & paging structures: free frames. Memory & paging structures. Physical memory Multi-Process Systems: Memory (2) What we will learn A detailed description of various ways of organizing memory Discuss various memory-management techniques, including paging and segmentation To provide

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

Simple idea 1: load-time linking. Our main questions. Some terminology. Simple idea 2: base + bound register. Protection mechanics.

Simple idea 1: load-time linking. Our main questions. Some terminology. Simple idea 2: base + bound register. Protection mechanics. Our main questions! How is protection enforced?! How are processes relocated?! How is ory partitioned? Simple idea 1: load-time linking! Link as usual, but keep the list of references! At load time, determine

More information

The Virtual Memory Abstraction. Memory Management. Address spaces: Physical and Virtual. Address Translation

The Virtual Memory Abstraction. Memory Management. Address spaces: Physical and Virtual. Address Translation The Virtual Memory Abstraction Memory Management Physical Memory Unprotected address space Limited size Shared physical frames Easy to share data Virtual Memory Programs are isolated Arbitrary size All

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

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

Virtual Memory. Chapter 8

Virtual Memory. Chapter 8 Virtual Memory 1 Chapter 8 Characteristics of Paging and Segmentation Memory references are dynamically translated into physical addresses at run time E.g., process may be swapped in and out of main memory

More information