Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Chapter 3.1 : Memory Management Storage hierarchy Storage hierarchy Important memory terms Important memory terms Earlier memory allocation schemes Earlier.

Similar presentations


Presentation on theme: "1 Chapter 3.1 : Memory Management Storage hierarchy Storage hierarchy Important memory terms Important memory terms Earlier memory allocation schemes Earlier."— Presentation transcript:

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

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

3 3 Important Memory Terms

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

5 5 Dos Memory Layout

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

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

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

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

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

11 11 Question:

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

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

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

15 15 Performance Issues Best Fit usually performs the worst, since it leaves behind the smallest possible hole 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 First Fit is simplest to implement and usually fastest and best Next fit is usually a little worse than First Fit Next fit is usually a little worse than First Fit

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

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

18 18 Problems with Memory Management Techniques so far Unused memory due to fragmentation 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) 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 size is limited with the size of physical memory Process needs contiguous space in real memory for execution Process needs contiguous space in real memory for execution

19 19 Can We Get Rid of These Problems? YES! YES!


Download ppt "1 Chapter 3.1 : Memory Management Storage hierarchy Storage hierarchy Important memory terms Important memory terms Earlier memory allocation schemes Earlier."

Similar presentations


Ads by Google