Memory Management in OS
Memory Management in OS
Memory
Memory
Computer has 2 types of memory:
a) Main Memory: temporarily stores data and instructions
executed by the computer. CPU retrieve instructions from
main memory and executes it.
Free
P3 finishes its execution P5 require 25Mb space
So space is free
Partition Allocation
One method of allocating contiguous memory is to divide all available
memory into equal sized partitions, and to assign each process
to their own partition.
Partition Allocation
Algorithms:
a) First Fit:
– Checks all partitions
serially
– When partition with size
= or > encounters, it is
allocated for storage.
Partition Allocation Algorithms
b) Best Fit: This approach will check all the free partitions and
will allocate that free partition to a process which leads to
minimum internal fragmentation.
Disadvantage:
1) Complexity is more
2) Overhead to check all the partitions to find best suitable
space
• Complex to implement.
Paging / Paged Memory Management
– Paging is a memory management scheme that allows
processe’s physical memory to be discontinuous, and
eliminates problems with fragmentation by allocating
memory in equal sized blocks known as pages.
Paging
Paging / Paged Memory Management
2^2 x 2^20 = 4M
4M x 2Byte= 8MB
Translation of Address to memory
Translate n bit address to memory
Ans: 64KB/1B
= 64K
26 x 210= 216
Ans: 32KB/1B
= 32K
25 x 210= 215
Ans:
Total 28 bits are required to rep. memory of 256MB
Address Translation
How to break logical address into page number and page
offset?