1 / 19

Chapter 3.1 : Memory Management

Chapter 3.1 : Memory Management. Storage hierarchy Important memory terms Earlier memory allocation schemes Contiguous memory allocation Fixed partitions Dynamic partitions Managing free & allocated Memory Space. Storage Hierarchy. Main Memory Cache on Chip (internal cache)

velma-combs
Download Presentation

Chapter 3.1 : Memory Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 3.1 : Memory Management • Storage hierarchy • Important memory terms • Earlier memory allocation schemes • Contiguous memory allocation • Fixed partitions • Dynamic partitions • Managing free & allocated Memory Space

  2. Storage Hierarchy • Main Memory • Cache on Chip (internal cache) • External Cache memory • RAM Access time decreases Capacity decreases • Secondary Storage • Hard Disk • Tertiary Storage • CD ROM • Floppy • Tape Cost increases

  3. Important Memory Terms

  4. OS & drivers User Program Contiguous Memory Allocation • After loading OS, the rest of the memory is available for user program • Size of user program is fixed by available memory • Use of overlays for larger programs

  5. Dos Memory Layout

  6. Basic Memory Management (Monoprogramming) Three simple ways of organizing memory - an operating system with one user process

  7. Process 1 F r a g m e n t F r a g m e n t Process 3 F r a g m e n t Process 2 OS Partition 1 Partition 2 Partition 3 Multiprogramming with Fixed Partitions • Partition numbers and sizes (equal or unequal) are set by operator at system start up based on workload statistics • Used by IBM’s MFT (Multiprogramming with a Fixed Number of Tasks) OS for IBM 360 systems long time ago

  8. Modeling Multiprogramming CPU utilization as a function of number of processes in memory Degree of multiprogramming

  9. OS Memory at system start up OS Process 1 Process 2 Process 3 Three processes started OS Process 1 Process 3 Second processes is finished OS Process 1 Process 3 Process 4 A large fourth process arrives. Process 3 is relocated Multiprogramming with Dynamic Partitions • Partitions are created at load times

  10. Problems with Dynamic Partitions • Fragmentation occurs due to creation and deletion of memory space at load time • Fragmentation is eliminated by relocation • Relocation has to be fast to reduce overhead • Free (unused) memory has to be managed • Allocation of free memory is done by a placement algorithm

  11. Question: HOW DO YOU RELOCATE A PROCESS?

  12. Memory allocation units: Green - used, Yellow - unused 1 1 0 1 0 1 0 0 1 1 0 1 0 1 Bit map of the above memory How to Keep Track of Unused Memory • Bit Maps • Memory is divided into allocation units of fixed size. A bit map with “0” bits for free and “1” bits for allocated units

  13. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Memory allocation units: Green - used, Yellow - unused U U 1 9 5 2 Linked list memory map F F 11 6 4 3 How to Keep Track of Unused Memory (Cont.) • Linked Lists

  14. Placement Algorithms • First fit • Process is placed in the first hole it can fit in • Next fit • Start searching from the point where the last search has ended and perform first fit • Best fit • Process is placed in a hole which is closest to the process size

  15. Performance Issues • Best Fit usually performs the worst, since it leaves behind the smallest possible hole • First Fit is simplest to implement and usually fastest and best • Next fit is usually a little worse than First Fit

  16. 90KB 128KB 256KB 512KB 90KB 128KB 256KB 300KB 512KB 300KB Another Allocation scheme:Buddy System • Memory is allocated in powers of 2 sized units during load time Initially 1 MB 90 KB request 300 KB request 90 KB returned

  17. Buddy System (Cont.) • This method makes de-allocation fast. If a block of size 2k is released then the memory manager checks only the list of 2k holes to merge them into a 2k+1 sized partition • Internal fragmentation is caused since memory requests are fitted in 2k sized partitions

  18. Problems with Memory Management Techniques so far • Unused memory due to fragmentation • Memory may contain parts of program which are not used during a run (ie., some routines may not be accessed in that particular run) • Process size is limited with the size of physical memory • Process needs contiguous space in real memory for execution

  19. Can We Get Rid of These Problems? • YES! VIRTUAL MEMORY

More Related