Download presentation
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 Ceng Operating Systems
2
Ceng 334 - Operating Systems
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 Ceng Operating Systems
3
Important Memory Terms
Ceng Operating Systems
4
Contiguous Memory Allocation
OS & drivers User Program 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 Ceng Operating Systems
5
Ceng 334 - Operating Systems
Dos Memory Layout Ceng Operating Systems
6
Basic Memory Management (Monoprogramming)
Three simple ways of organizing memory - an operating system with one user process Ceng Operating Systems
7
Multiprogramming with Fixed Partitions
OS Partition 1 Partition 2 Partition 3 Process 1 Process 2 Process 3 F r a g m e n t 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 Ceng Operating Systems
8
Modeling Multiprogramming
Degree of multiprogramming CPU utilization as a function of number of processes in memory Ceng Operating Systems
9
Multiprogramming with Dynamic Partitions
Partitions are created at load times Memory at system start up OS Three processes started OS Process 1 Process 2 Process 3 Second processes is finished OS Process 1 Process 3 A large fourth process arrives. Process 3 is relocated OS Process 1 Process 3 Process 4 Ceng Operating Systems
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 Ceng Operating Systems
11
Ceng 334 - Operating Systems
Question: HOW DO YOU RELOCATE A PROCESS? Ceng Operating Systems
12
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 Memory allocation units: Green - used, Yellow - unused 1 Bit map of the above memory Ceng Operating Systems
13
How to Keep Track of Unused Memory (Cont.)
Linked Lists Memory allocation units: Green - used, Yellow - unused U 1 5 F 6 3 9 2 11 4 Linked list memory map Ceng Operating Systems
14
Ceng 334 - Operating Systems
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 Ceng Operating Systems
15
Ceng 334 - Operating Systems
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 Ceng Operating Systems
16
Another Allocation scheme: Buddy System
Memory is allocated in powers of 2 sized units during load time Initially 1 MB 90 KB request 512KB 256KB 90KB 128KB 300 KB request 300KB 256KB 90KB 128KB 90 KB returned 300KB 512KB Ceng Operating Systems
17
Ceng 334 - Operating Systems
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 Ceng Operating Systems
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 Ceng Operating Systems
19
Can We Get Rid of These Problems?
YES! VIRTUAL MEMORY Ceng Operating Systems
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.