Day 18 Memory Management.

Slides:



Advertisements
Similar presentations
Chapter 2: Memory Management, Early Systems
Advertisements

Memory Management Chapter 7.
Fixed/Variable Partitioning
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable supply of ready processes to.
Allocating Memory.
Chapter 7 Memory Management
Chapter 7 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2009, Prentice.
CS 311 – Lecture 21 Outline Memory management in UNIX
OS Fall’02 Memory Management Operating Systems Fall 2002.
Chapter 7 Memory Management
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
CSCI2413 Lecture 5 Operating Systems Memory Management 1 phones off (please)
Chapter 3.1 : Memory Management
Memory Management Chapter 7 B.Ramamurthy. Memory Management Subdividing memory to accommodate multiple processes Memory needs to allocated efficiently.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Memory Management Chapter 5.
Memory Management Five Requirements for Memory Management to satisfy: –Relocation Users generally don’t know where they will be placed in main memory May.
Chapter 7 Memory Management
1 Chapter 3.1 : Memory Management Storage hierarchy Storage hierarchy Important memory terms Important memory terms Earlier memory allocation schemes Earlier.
1 Lecture 8: Memory Mangement Operating System I Spring 2008.
Memory management. Instruction execution cycle Fetch instruction from main memory Decode instruction Fetch operands (if needed0 Execute instruction Store.
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
Review of Memory Management, Virtual Memory CS448.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Memory Management Chapter 7.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Dr.
Chapter 7 Memory Management Seventh Edition William Stallings Operating Systems: Internals and Design Principles.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Memory Management Chapter 7.
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
Subject: Operating System.
OS/SSS S:1 Memory Management. OS/SSS S:2 Background A compiler creates an executable code An executable code must be brought into main memory to run Operating.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
1 Memory Management Chapter 8. 2 Memory Management n It is the task carried out by the OS and hardware to accommodate multiple processes in main memory.
Basic Memory Management 1. Readings r Silbershatz et al: chapters
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
1 Memory Management n In most schemes, the kernel occupies some fixed portion of main memory and the rest is shared by multiple processes.
2010INT Operating Systems, School of Information Technology, Griffith University – Gold Coast Copyright © William Stallings /2 Memory Management.
MEMORY MANAGEMENT. memory management  In a multiprogramming system, in order to share the processor, a number of processes must be kept in memory. 
Memory Management Chapter 7.
Chapter 7 Memory Management
Memory Management Chapter 7.
Memory Management.
ITEC 202 Operating Systems
Requirements, Partitioning, paging, and segmentation
Day 19 Memory Management.
Day 19 Memory Management.
Memory management.
Memory Allocation The main memory must accommodate both:
Main Memory Management
Module IV Memory Organization.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy 11/12/2018.
Multistep Processing of a User Program
So far… Text RO …. printf() RW link printf Linking, loading
Main Memory Background Swapping Contiguous Allocation Paging
Memory Management Chapter 7.
Chapter 8: Memory management
Lecture 3: Main Memory.
Operating System Chapter 7. Memory Management
Chapter 7 Memory Management
Presentation transcript:

Day 18 Memory Management

Main Memory Holds user programs and operating system code Memory management involves managing how main memory is shared among the various processes. The OS performs this function with support from hardware. A program that is running or ready or blocked exists in main memory.

Requirements of memory management Relocation Protection Sharing Logical organization Physical organization

Assumptions An entire program exists in main memory. A program is stored as one contiguous block in main memory.

Hardware support for memory management How to partition memory. How to keep track of which partition belongs to which process. How to prevent a process from accessing a partition that has not been allocated to it.

Fragmentation Internal – space within an allocation block is not completely used Typical in allocation schemes that have fixed block sizes. Can be reduced by making the block size small. External – holes created between blocks that cannot be used Typical in allocation schemes where block sizes are not fixed and are determined by the request. Compaction must be performed frequently.

Fixed partitioning => fixed size blocks Equal sized All partitions are the same size. Un-equal sized Partitions are of un-equal sizes.

Fixed partitioning - disadvantages Fixed partitioning is simple and very little OS support is required. However, Since number of partitions is fixed, it limits the degree of multi-programming It is inefficient with small processes. If the sizes of processes are known beforehand then a reasonable size can be decided on.

Dynamic partitioning Partitions are created dynamically Sizes are not fixed and are determined based on the request. The number of partitions is also not fixed. Disadvantages: More external fragmentation Placement is more complicated

Could you now find space for a process of size 7M? Placement – If a process of size 3M is to be placed, where would you place it?

Placement algorithms First fit – start searching from the beginning and allocate the first available block. Next fit – start searching from the last allocation and allocate the first available block. Best fit – start searching from the beginning and allocate the available block that will result in the smallest hole Which do you think will keep the fragmentation to the minimum?

In the following memory configuration, where would a 16MB block be placed with a. First Fit algorithm b. Next Fit algorithm c. Best Fit algorithm Mark your answers on the diagram Placement Algorithm

Keeping track of memory From “Operating Systems” by Tannenbaum

Buddy System Fixed partitioning Dynamic partitioning Buddy system Limits # of active processes Uses space inefficiently if the sizes of the processes don’t match with that of the partitions. Dynamic partitioning More complex to maintain Includes overhead of compaction Buddy system Blocks available are of size 2K, L <= K <=U 2L is the smallest block allocated 2U the largest block allocated and is the size of the entire memory available for allocation. When a request is made, if the request is 2U-1 <= s <= 2U, then the entire block is allocated. Else, split into 2U-1 sized buddy blocks If 2U-2 <= s <= 2U-1, then allocate an entire 2U-1 buddy block. Else, split one of the 2U-1 blocks into 2U-2 sized buddy blocks And so… When two buddies become available (after a block is de-allocated), they are coalesced together into one hole.

Buddy system Using the Buddy algorithm, show how the memory block will partitioned after each request/release. 3. Request C=64 K 4. Request D=256K 5. Release B 6. Release A 7. Request E=75K 8. Release C 9. Release E 10. Release D Used in UNIX kernel management. Uses Lazy buddy i.e don’t coalesce imediately ato reduce the workload.

Relocation When a process is brought back to memory, it can be placed anywhere and not its original location. Address translation is therefore required. Logical address – Address irrespective of where the program is currently placed. Relative address – an example of a logical address typically relative to a value in a register or the beginning of a program. Physical address/absolute address – the actual address in memory. Dynamic run-time loading is required.