Subject: Operating System.

Slides:



Advertisements
Similar presentations
Part IV: Memory Management
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.
OS Fall’02 Memory Management Operating Systems Fall 2002.
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. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
CS 104 Introduction to Computer Science and Graphics Problems
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 Chapter 5.
Computer Organization and Architecture
Chapter 7 Memory Management
1 Lecture 8: Memory Mangement Operating System I Spring 2008.
Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.
1 Memory Management Chapter 7. 2 Roadmap n Memory management u Objectives u Requirements n Simple memory management u Memory partitioning F Fixed partitioning.
Chapter 7 Memory Management Seventh Edition William Stallings Operating Systems: Internals and Design Principles.
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
Operating System 7 MEMORY MANAGEMENT. MEMORY MANAGEMENT REQUIREMENTS.
Memory Management Chapter 7.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
MEMORY MANAGEMENT Presented By:- Lect. Puneet Gupta G.P.C.G. Patiala.
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
Chapter 7 Memory Management Seventh Edition William Stallings Operating Systems: Internals and Design Principles.
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.
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.
Memory Management. Why memory management? n Processes need to be loaded in memory to execute n Multiprogramming n The task of subdividing the user area.
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual memory.
Memory management Ref: Stallings G.Anuradha. What is memory management? The task of subdivision of user portion of memory to accommodate multiple processes.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
Memory Management Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are only storage.
CSNB224 – AAG 2007 Memory Management Chapter 7. CSNB224 – AAG 2007 Memory Management In uniprogramming system, memory is divided into two parts: for the.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
Memory Management Chapter 5 Advanced Operating System.
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. 
COMP 3500 Introduction to Operating Systems Memory Management: Part 2 Dr. Xiao Qin Auburn University Slides.
Memory Management Chapter 7.
Chapter 7 Memory Management
Memory Management Chapter 7.
Memory Management.
ITEC 202 Operating Systems
Chapter 2 Memory and process management
Requirements, Partitioning, paging, and segmentation
UNIT–IV: Memory Management
Chapter 8 Main Memory.
Module IV Memory Organization.
Economics, Administration & Information system
Memory Management Chapter 7.
Lecture 3: Main Memory.
Operating System Chapter 7. Memory Management
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
Chapter 7 Memory Management
CSE 542: Operating Systems
Presentation transcript:

Subject: Operating System. Memory Management. Subject: Operating System.

Memory management. In a multiprogramming system, memory must be subdivided to accommodate multiple processes. This task of subdivision is carried out dynamically by the OS and is called MEMORY MANAGEMENT.

REQUIREMENTS. Memory management should satisfy these five requirements: RELOCATION PROTECTION SHARING LOCAL ORGANIZATION PHYSICAL ORGANIZATION

RELOCATION. The processes are swapped in and swapped out. It is very limiting to place the swapped out process in its original place. It is then relocated in a different area in the memory.

PROTECTION. The relocated process must be protected against the unwanted interference. Protection should be given by the processor rather than the OS.

SHARING. Any protection mechanism must allow several processor to access the same portion for main memory. Keeping protection in mind; Sharing should be restricted.

LOGICAL ORGANISATION Does not correspond to the way in which programs are constructed. Programs organized in modules.

PHYSICAL ORGANIZATION. It is divided into two parts: Main Memory Secondary Memory Main Memory: fast, costly, volatile. Secondary Memory: cheap, slow but non volatile. Overlaying.

FIXED PARTITIONING. Divides main memory into a set of non-overlapping regions called partitions. Partitions can be of equal or unequal sizes.

EQUAL SIZE PARTITIONS Partitions are of equal size. Process whose size is less than or equal to the partition size can be loaded into any available partition. If all partitions are full, the OS can swap a process out of any partition and load the new process

DIFFICULTIES. Process may be too big to fit into a partition. Any program, no matter how small, occupies an entire partition causing INTERNAL FRAGMENTATION

UNEQUAL SIZE PARTITIONS Partitions are not of equal size In Programs with large bytes, processes can be accommodated without OVERLAYS. Smaller partitions allow smaller programs to be accommodated with less internal fragmentation.

PLACEMENT ALGORITHM. Equal size partitions Unequal size partitions

EQUAL SIZE PARTITIONS. Process placement is trivial. Process can be loaded in any partition available. If no partition is available, then one of the processes must be swapped out.

UNEQUAL SIZE PARTITIONS. Two ways to assign processes to partition. Simplest way is to assign a single queue to each partition. Each process is assign to the smallest partition in which it will fit.

Internal fragmentation is minimized. ADVANTAGES. Internal fragmentation is minimized.

Unequal size partitions Another approach would be to employ a single queue for all partitions.

Provides a degree of flexibility. Advantage: Provides a degree of flexibility.

Advantages of fixed partitioning. Simple. Requires minimal operating system software.

Disadvantage of fixed partitioning Limits the number of active processes Small jobs will not utilize partition space efficiently

Example IBM mainframe operating system, OS/MFT (multiprogramming with a fixed number of tasks)

Dynamic Partitioning. Developed to overcome difficulties of fixed partitioning. Partitions are of variable length and number. Allocated exactly as much memory as it requires and no more.

Drawbacks. Method starts well, but eventually leads to holes. Memory becomes fragmented. Thus, memory utilization declines. This is referred to as ‘external fragmentation’.

Ways to overcome…. Technique known as ‘compaction’. OS shifts process so that all free memory is together in one block. Thus, an additional process can be loaded. Time consuming and waste of processor time.

Placement Algorithm. OS must decide which free block to allocate. Three placements algorithms:- BEST FIT: Chooses block closest in size to request. FIRST FIT: First available block i.e. large enough. NEXT FIT: Next available block i.e. large enough.

FIRST FIT. Simplest but usually best and fast. Litters the front end with small partition.

NEXT FIT. Frequently fragments a free block at the end. Thus, compaction required.

Worst performance. Fragment left as small as possible. BEST FIT. Worst performance. Fragment left as small as possible.

Replacement Algorithm. When processes are blocked and no memory even after compaction. Replacement algorithm is used to avoid wasting processor time. OS will swap are process to make room for new process. OS must choose which process to replace.

BUDDY SYSTEM. It is a compromise to overcome the drawbacks of fixed and variable partitioning.

RELOCATION. A process may occupy different partitions during course of its life. Different regions in memory are allocated at different occasions. Thus, locations referred by the process is not fixed.

ADDRESSES. LOGICAL ADDRES. Reference to a memory location independent of the assignment of the data to memory. RELATIVE ADDRESS. Address expressed as a location relative to some known point. PHYSICAL ADDRESS. Actual location in main memory.

PAGING. Partition memory into small fixed-size chunks and divide each process into the same size chunks. The chunks of a process are called pages and chunks of memory are called frames OS maintains a page table for each process.

Page Tables for Example

ADVANTAGES. Paging is similar to fixed partitioning, only difference is that the partitions here are smaller and a program might occupy more than one partition and they need not be contiguous. This approach solves many problems inherent partitioning.

DISADVANTAGES. Waste of space in memory due to internal fragmentation. No external fragmentation.

SEGMENTATION. A User program and associated data can be subdivided into a number of segments. There is a maximum segment length. Since, segments are not equal, segmentation is similar to dynamic partitioning.

…contd… Addressing consists of two parts: a segment number and an offset. It makes use of segment table, for each process and for the list of free blocks of main memory.

ADVANTAGES. Segmentation provides a convenient way for organizing programs and data. Segmentation eliminates internal fragmentation.

DISADVANTAGES. Limitation of maximum segment size. Segmentation suffers from external fragmentation.

VIRTUAL MEMORY MANAGEMENT. Allows execution of processes that are not completely in memory. Separation of logical memory from physical memory.

VIRTUAL ADDRESS SPACE Refers to the logical (or virtual) view of how a process is stored in memory. Include holes known as SPARSE ADDRESS SPACE. Allows files and memory to be shared through page sharing.

VIRTUAL ADDRESS SPACE DIAGRAM: Max Heap Stack Data Code

DEMAND PAGING Virtual memory is implemented through demand paging. A strategy to load pages only as they are needed. Here we make use of Lazy Swapper.

BASIC CONCEPT. The VALID-INVALID bit scheme is used. Access to a page marked invalid causes a PAGE-FAULT TRAP.

PAGE REPLACEMENT The operating system, swaps out a process, freeing all its frames and reducing the level of multiprogramming. Page replacement can be done by: BASIC PAGE REPLACEMENT. FIFO PAGE REPLACEMENT. OPTIMAL PAGE REPLACEMENT. LRU PAGE REPLACEMENT

BASIC PAGE REPLACEMENT Here, if no frame is free, we find one that is not currently being used and free it. It doubles the page-fault service time and increases the effective access time accordingly

FIFO PAGE REPLACEMENT First-in, First-out (FIFO) Algorithm. Replace the page at the head of the queue. A bad replacement choice, increases the page-fault rate and slows process execution.

OPTIMAL PAGE REPLACEMENT Replace the page that wil not be used for the longest period of time. It has the lowest page fault rate.

LRU PAGE REPLACEMENT Least-Recently-Used (LRU) algorithm. It replaces the page that has been least recently used for the longest time.