MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes,...
-
date post
21-Dec-2015 -
Category
Documents
-
view
218 -
download
0
Transcript of MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes,...
![Page 1: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/1.jpg)
MEMORY MANAGEMENT
By
KUNAL KADAKIA
RISHIT SHAH
![Page 2: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/2.jpg)
Memory • Memory is a large array of words or bytes, each with
its own address. It is a repository of quickly accessible data shared by the CPU and I/O devices.
• Operating system’s task is to allow accommodation of multiple processes in the memory.
• Memory needs to be allocated efficiently in order to allow as many processes into memory as possible.
• If not enough process are in memory, multiprogramming will not be effective and CPU will be idle for a large part of the time.
• In most OS, the kernel occupies some part of main memory and the rest is shared by multiple process.
![Page 3: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/3.jpg)
Basics • Memory is divided into primary memory and secondary
memory.• Primary memory holds information while it is being used by
the CPU. The primary memory are:• Faster to Access• Relatively High storage cost per bit• Volatile• Stores only running program and data currently in use
• Secondary memory refers to the collection of storage devices. They are
• Slower• Cheaper than primary Memory• Usually not volatile• Large capacity for Long term storage of programs and
data
![Page 4: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/4.jpg)
Storage Hierarchy
![Page 5: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/5.jpg)
Storage Hierarchy • A von Neumann computer’s memory is also
organized as a storage hierarchy.
![Page 6: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/6.jpg)
Storage Device Hierarchy
![Page 7: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/7.jpg)
Memory Manager
• The part of the OS that manages the memory hierarchy is called the memory manager.
• Its job is to keep track of which parts of the memory are in use and which are not in use.
• It is the resource manager for the primary memory
![Page 8: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/8.jpg)
Memory Manager• The classic Memory Manager addresses primary
memory management by implementing
a) Abstraction : The primary memory is abstracted so that software perceives the memory allocated to it as a large array of contiguously addressed bytes.
b) Allocation: A process may request exclusive use of block of memory.
c) Isolation: When a block of memory is allocated to a process, the process is assured of exclusive use of those memory cells.
d) Sharing: The memory manager may permit a block of primary memory to be shared among two or more processes.
![Page 9: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/9.jpg)
The Address Space Abstraction
• For multiprogramming OS, each process is provided with a set of logical primary memory address that it can use to read or write locations in the physical primary memory.
• The accessible addresses are the one that have been assigned to the process by the memory manager.
• This set of logical primary memory addresses is referred as process address space.
• When a thread executes in the process, it can use any of the logical primary memory addresses to reference a specific block of physical primary memory.
![Page 10: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/10.jpg)
The Address Space Abstraction
Fig The relationship between the address space and primary memory.
When a block of primary memory is associated to a process, the process's address space is bound to the block of the corresponding physical memory address.
![Page 11: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/11.jpg)
Managing The Address Space
• When a program is prepared for execution, it is translated into a machine executable format as shown below
![Page 12: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/12.jpg)
Managing The Address Space
• The source program is translated at compile time to produce a relocatable object module.
• A collection of relocatable modules is combined using a linkage editor to produce an absolute module.
• The absolute program is stored in a file until a process is ready to use.
• The organization of the absolute module defines the address space that the process will use to reference the program’s instructions, data, and stack.
• After a process has obtained a block of primary memory from the memory manager, it calls the system loader to place the absolute program into that block of primary memory.
![Page 13: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/13.jpg)
Modern memory Binding• Generally each process is created with a large, empty
address space: say a 4 GB address space. • In OS such as Linux and Windows, the address space
is partitioned into a segment that is used by a user space program, and another segment that is used when the process is used in supervisor mode.
• A typical partition allows the process to use 3 GB of the address when it is in user mode and 1 GB when it is in supervisor mode.
![Page 14: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/14.jpg)
Modern memory Binding
![Page 15: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/15.jpg)
Memory Allocation
Fixed partition memory strategies
Variable partition memory strategies
![Page 16: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/16.jpg)
Memory Allocation
![Page 17: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/17.jpg)
Memory Allocation
![Page 18: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/18.jpg)
Memory Allocation
![Page 19: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/19.jpg)
Memory Allocation
![Page 20: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/20.jpg)
Memory Allocation
• Multiple Queues
• Assigns each processto the smallest partition within which it fits.
• Minimizes internal fragmentation.
• Memory not used efficiently if many process in one class and few in another
![Page 21: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/21.jpg)
Memory Allocation
• Single Queue• Assign each process to the
smallest available partition within which it fits.
• Increases the level of multiprogramming o the expense of internal fragmentation.
• Small processes can use up a big partition, again memory not used efficiently.
![Page 22: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/22.jpg)
Memory Allocation
![Page 23: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/23.jpg)
Memory Allocation
![Page 24: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/24.jpg)
Memory Allocation
![Page 25: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/25.jpg)
Memory Allocation
• External fragmentation
![Page 26: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/26.jpg)
Memory Allocation
![Page 27: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/27.jpg)
Memory Allocation
• Compaction leads to increase in the cost of moving process.
• Hence evolved the dynamic address space binding approach.
![Page 28: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/28.jpg)
Dynamic address space binding
• We need a tool for binding address at runtime.
• Hence we use a method called dynamic address relocation.
![Page 29: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/29.jpg)
Hardware dynamic address relocation
![Page 30: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/30.jpg)
Multiple segment relocation registers
![Page 31: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/31.jpg)
Bound checking with a limit register
![Page 32: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/32.jpg)
Modern memory management strategies
• Virtual memory
• Swapping
![Page 33: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/33.jpg)
Swapping
![Page 34: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/34.jpg)
Other important issue
• Cache memory CPU
Cache memory
Memory Device
![Page 35: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/35.jpg)
References
• Operating systems, Garry Nutt
• WWW
![Page 36: MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.](https://reader035.fdocuments.us/reader035/viewer/2022062320/56649d605503460f94a41523/html5/thumbnails/36.jpg)
THANK YOU