Memory management


Published on

This presentation slides you to the essential knowledge of memory management and an idea to create attractive slides

Published in: Education
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Memory management

  1. 1. Presentation Title
  2. 2. Serial No. Topics 1 Introduction to Memory & Memory hierarchy 2 Introduction to MMU & its working 3 Techniques of Memory Management( Paging and segmentation) 4 segmentation 5 Mono programming without Swapping or Paging (M. Fayyaz) 6 Multiprogramming with fixed partitions. (M.Bilal) 7 Swapping 8 Managing Free Memory (Hiba Abdul Rauf) 9 Memory Management with Bitmaps 10 Dynamic Partitioning Placement Algorithm (Imran Bin Ramzan)
  3. 3. Memory is the internal storage area of the computer. Memory identifiesthe data storage. The physical memory usually referred to us mainmemory or RAM.
  4. 4. Memory Management Unit of the operating system handles thememory hierarchy.1. Keep track of what parts of memory are in use.2. Allocate memory to processes when needed.3. Deallocate when processes are done.4. Swapping, or paging, between main memory and disk, when disk istoo small to hold all current processes.
  5. 5. It’s a term used to describe how operating systems handles the available RAM, it ismanaged by multiple levels. Techniques of M.M
  6. 6. In segmentation the virtual address space is divided into a number of variable-sizepieces called segments. One can view the designs we have studied so far as havingjust one segment, the entire address space of the process.Memory Management Scheme that supports user view of memory.A program is a collection of segments.A segment is a logical unit such as main program, procedure, function local variables, global variables, common block stack, arrays Protect each entity independently Allow each segment to grow independently Share each segment independently
  7. 7. 1 2 1 4 2 43 3User Space Physical Memory
  8. 8. – Logical address consists of a two tuple <segment-number, offset>– Segment Table • Maps two-dimensional user-defined addresses into one-dimensional physical addresses. Each table entry has – Base - contains the starting physical address where the segments reside in memory. – Limit - specifies the length of the segment. • Segment-table base register (STBR) points to the segment table’s location in memory. • Segment-table length register (STLR) indicates the number of segments used by a program; segment number is legal if s < STLR.
  9. 9. Segmentation Architecture (cont.)– Relocation is dynamic - by segment table– Sharing • Code sharing occurs at the segment level. • Shared segments must have same segment number.– Allocation - dynamic storage allocation problem • use best fit/first fit, may cause external fragmentation.– Protection • protection bits associated with segments – read/write/execute privileges – array in a separate segment - hardware can check for illegal array indexes.
  10. 10. Shared segments Limit Base editor 25286 43602 0 4425 68348 segment 0 1 43062 data 1 Segment Table editor process P1 68348 data 1 segment 1 72773Logical Memory process P1 editor Limit Base 25286 43602 900 data 2 0 data 2 segment 0 1 8850 90003 03 985 Segment Table 53 Logical Memory process P2 process P2 segment 1
  11. 11. Segmented Paged Memory– Segment-table entry contains not the base address of the segment, but the base address of a page table for this segment. • Overcomes external fragmentation problem of segmented memory. • Paging also makes allocation simpler; time to search for a suitable segment (using best-fit etc.) reduced. • Introduces some internal fragmentation and table space overhead.– Multics - single level page table– IBM OS/2 - OS on top of Intel 386 • uses a two level paging scheme
  12. 12. Entire process remains in memory from start to finish.The sum of the memory requirements of all jobs in the systemcannot exceed the size of physical memory. These are three simple ways of organizing memory an operating system with one user process
  13. 13. •Allocating space for growing data segment•Allocating space for growing stack & data segment
  14. 14. Managing Free MemoryWhen memory is assigned dynamically, the operating system must manageit. In general terms, there are two ways to keep track of memory usage:bitmaps and free lists. In this section and the next one we will look at thesetwo methods.
  15. 15. Operating system must decide which free block to allocate to a processBest-fit algorithm Chooses the block that is closest in size to the request Worst performer overall Since smallest block is found for process, the smallest amount of fragmentation is left Memory compaction must be done more often
  16. 16. First-fit algorithm Scans memory form the beginning and chooses the first available block that is large enough Fastest May have many process loaded in the front end of memory that must be searched over when trying to find a free block
  17. 17. Next-fit-Algorithm Scans memory from the location of the last placement More often allocate a block of memory at the end of memory where the largest block is found The largest block of memory is broken up into smaller blocks Compaction is required to obtain a large block at the end of memory
  18. 18. Worst Fit Algorithm: Search entire list. Produces the largest left over hole. Allocate the largest hole.