Chapter 2 Memory and process management

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Part IV: Memory Management
Chapter 6: Memory Management
Memory Management Chapter 7.
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
Allocating Memory.
Chapter 7 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2009, Prentice.
1 CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania, Fall 2002 Lecture Note: Memory Management.
Chapter 7 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 2010.
Memory Management Chapter 5.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Computer Organization and Architecture
Chapter 7 Memory Management
1 Lecture 8: Memory Mangement Operating System I Spring 2008.
SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally MEMORYMANAGEMNT.
Memory Management Chapter 7.
MEMORY MANAGEMENT Presented By:- Lect. Puneet Gupta G.P.C.G. Patiala.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
Memory Management Chapter 7.
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
6 Memory Management and Processor Management Management of Resources Measure of Effectiveness – On most modern computers, the operating system serves.
Subject: Operating System.
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.
Basic Memory Management 1. Readings r Silbershatz et al: chapters
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual memory.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
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.
Memory management The main purpose of a computer system is to execute programs. These programs, together with the data they access, must be in main memory.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Virtual Memory (Section 9.3). The Need For Virtual Memory Many computers don’t have enough memory in RAM to accommodate all the programs a user wants.
Chapter 7 Memory Management
Memory Management Chapter 7.
Memory Management.
ITEC 202 Operating Systems
Chapter 8: Main Memory.
Memory Allocation The main memory must accommodate both:
Chapter 9 – Real Memory Organization and Management
CSI 400/500 Operating Systems Spring 2009
Main Memory Management
Chapter 8: Main Memory.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy 11/12/2018.
Operating System Concepts
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Multistep Processing of a User Program
Unit 6: Real Memory organization management
Memory Management.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
So far… Text RO …. printf() RW link printf Linking, loading
Memory Management-I 1.
Main Memory Background Swapping Contiguous Allocation Paging
Chapter 8: Memory management
Outline Module 1 and 2 dealt with processes, scheduling and synchronization Next two modules will deal with memory and storage Processes require data to.
Lecture 3: Main Memory.
Operating System Chapter 7. Memory Management
Chapter 8: Memory Management strategies
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
Management From the memory view, we can list four important tasks that the OS is responsible for ; To know the used and unused memory partitions To allocate.
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
CSE 542: Operating Systems
Page Main Memory.
Presentation transcript:

Chapter 2 Memory and process management Part 1: Memory Management of OS

Topic : Define the function of memory manager. Describe the characteristics of the different levels in the hierarchy of memory organization. Explain memory management strategies: Fetch, Placement and Replacement strategies. Identify between resident and transient routines.

- Explain the following terminology: - Fixed-partition memory management - Memory swapping technique - Explain how virtual memory works Segmentation Paging

Memory Management Memory management is the act of managing computer memory. This involves providing ways to allocate portions of memory to programs at their request and freeing it for reuse when no longer needed.

Function of Memory Manager Memory management is done by memory manager. Function of memory manager : Keep track of which parts of memory are in use and which parts are not in use Allocate memory to processes when they need it and deallocate it when they are done Manage swapping between main memory and disk when main memory is too small to hold all the processes

Characteristics of the Different Levels in the Hierarchy of Memory Organization A 'memory hierarchy' in computer storage distinguishes each level in the 'hierarchy' by response time. Since response time, complexity, and capacity are related, the levels may also be distinguished by the controlling technology. There are four major storage levels. Internal – Processor registers and cache. Main – the system RAM and controller cards. On-line mass storage – Secondary storage. Off-line bulk storage – Tertiary and Off-line storage.

REGISTER MAIN MEMORY SECONDARY STORAGE TERTIARY STORAGE CACHE Memory Hierarchy

Memory Management Strategies fetch strategy The method used to determine which block is to be obtained next. Determine when to load and how much to load at a time. E.g., demand fetching, anticipated fetching (pre-fetching). placement strategy The method used to determine where to put a new block To determine where information is to be placed. E.g., Best-Fit, First-Fit, Worst-Fit replacement strategy The method used to determine which resident block is to be displaced. Determine which memory area is to be removed under contention conditions. E.g., FIFO

3 algorithm for searching free block for a specific amount of memory: 1) First fit Allocate the first free block that is large enough for the new process. This a fast algorithm. 2) Best fit Allocate the smallest block among those that are large enough for the new process. OS search entire list, or it can keep it sorted and stop it when it has an entry which has a size larger than the size of process. This algorithm produces the smallest left over block.

3) Worst fit Allocate the largest block among those that are large enough for the new process. Search or sorting of the entire list is needed. This algorithm produces the largest left over block.

Memory Swapping Technique Swapping is a simple memory/process management technique used by the operating system to increase the utilization of the processor by moving some blocked process from the main memory to the secondary memory(hard disk); Thus forming a queue of temporarily suspended process and the execution continues with the newly arrived process. After performing the swapping process, the operating system has two options in selecting a process for execution : Operating System can admit newly created process (OR) Operating system can activate suspended process from the swap memory.

Process A enters the main memory for execution Process B is waiting for execution since the main memory is full Process B has higher priority since it must be executed the soonest Process A is swapped out from the main memory to the disk The main memory now has empty spaces for other process Process B is swapped in from the disk to main memory Process B has finished execution and is swapped out to disk Process A enters the main memory again to continue execution

Resident Routines OS is a collection of software routines Resident routines (Rutin Tetap) The part of a program that must remain in memory at all times. Instructions and data that remain in memory can be accessed instantly. A routine that stays in the memory eg routines that control physical I/O and directly support application programs as they run One such program might be an anti-virus program. This has given rise to the term resident protection.

Transient Routines Transient routines (Rutin Sementara) A routine that is stored on disk loaded as needed routines that format disks

Resident & transient routines The operating system is a collection of software routines. Resident routines Transient routines Routines that directly support application programs as they run Stored on disk and read into memory only when needed Example: routine that control physical I/O Example: routine that formats disks

Fixed-partition memory management The simplest approach to managing memory for multiple, concurrent programs. On many systems, multiple programs are loaded into memory and executed concurrently.

Fixed-partition memory management Divides the available space into fixed-length partitions, each of which holds one program. Partition sizes are generally set when the system is initially started, so the memory allocation decision is made before the actual amount of space needed by a given program is known. Advantages: - Its major advantage is simplicity Disadvantages: Because the size of a partition must be big enough to hold the largest program that is likely to be loaded, fixed-partition memory management wastes space

Fixed-partition memory management management divides the available space into fixed length partitions each of which holds one program. Fixed-partition memory management structure diagram

Virtual memory The word virtual means “not in actual fact.” To the programmer or user, virtual memory acts just like real memory, but it isn’t real memory. Virtual memory is a model that holds space for the operating system and several application programs. The operating system and selected pages occupy real memory. Application programs are stored on an external paging device.

Segmentation With segmentation, programs are divided into variable size segments, instead of fixed size pages. Every logical address is formed of a segment name and an offset within that segment. In practice, segments are numbered. Programs are segmented automatically by compiler or assembler.

Segmentation For logical to physical address mapping, a segment table is used. When a logical address <s, d> is generated by processor: Base and limit values corresponding to segment s are determined using the segment table. The OS checks whether d is in the limit. ( 0=<limit) If so, then the physical address is calculated as ( based + d), and the memory is accessed.

Dynamic address translation. Segmentation Dynamic address translation. To dynamically translate a segment address to an absolute address: 1) Break the address into segment and displacement portions 2) Use the segment number to find the segment’s absolute entry point address in a program segment table 3) Add the displacement to the entry point address.

Paging A program’s segments can vary in length. Under paging, a program is broken into fixed-length pages. Page size is generally small (perhaps 2K to 4K), and chosen with hardware efficiency in mind. Like segments, a program’s pages are loaded into noncontiguous memory. Addresses consist of two parts , a page number in the high-order positions and a displacement in the low-order bits. Addresses are dynamically translated as the program runs. When an instruction is fetched, its base-plus displacement addresses are expanded to absolute addresses by hardware. Then the page’s base address is looked up in a program page table (like the segment table, maintained by the operating system) and added to the displacement.

Paging Advantages: 1. Address translation: each task has the same virtual address 2. Address translation: turns fragmented physical addresses into contiguous virtual addresses 3. Memory protection 4. Demand loading (prevents big load on CPU when a task first starts running, conserves memory) 5. Memory mapped files 6. Virtual memory swapping (lets system degrade gracefully when memory required exceeds RAM size)

Segmentation and Paging 1) With segmentation and paging, addresses are divided into a segment number, a page number within that segment, and a displacement within that page. 2) After the instruction control unit expands the relative address, dynamic address translation begins. 3) First, the program’s segment table is searched for the segment number, which yields the address of the segment’s page table. 4) The page table is then searched for the page’s base address, which is added to the displacement to get an absolute address.

Segmentation and Paging