OS - Chapter 4 MM Part 1
OS - Chapter 4 MM Part 1
Chapter 4
What is Memory Management?
•Internal Fragmentation:
Main memory use is inefficient. Any program, no matter how
small, occupies an entire partition. This can cause internal
fragmentation.
•External Fragmentation:
The total unused space of various partitions cannot be used to
load the processes even though there is space available but
not in the contiguous form (as spanning is not allowed).
What is Fragmentation?
•When free blocks are quite small, so it is not able to fulfill any
request.
What is Fragmentation? Contd..
•Initially RAM is empty and partitions are made during the run-
time according to process’s need instead of partitioning during
system configure.
•The size of partition will be equal to incoming process.
•The partition size varies according to the need of the process so
that the internal fragmentation can be avoided to ensure
efficient utilization of RAM.
•Number of partitions in RAM is not fixed and depends on the
number of incoming process and Main Memory’s size.
Variable Partitioning
Advantages of Variable Partitioning
1. No Internal Fragmentation:
In variable Partitioning, space in main memory is allocated strictly according
to the need of process, hence there is no case of internal fragmentation.
There will be no unused space left in the partition.
2. No restriction on Degree of Multiprogramming:
More number of processes can be accommodated due to absence of
internal fragmentation. A process can be loaded until the memory is empty.
3. No Limitation on the size of the process:
In Fixed partitioning, the process with the size greater than the size of the
largest partition could not be loaded and process can not be divided as it is
invalid in contiguous allocation technique.
Here, In variable partitioning, the process size can’t be restricted since the
partition size is decided according to the process size.
Disadvantages of Variable Partitioning
1. Difficult Implementation:
Implementing variable Partitioning is difficult as compared to
Fixed Partitioning as it involves allocation of memory during
run-time rather than during system configure.
2. External Fragmentation:
There will be external fragmentation inspite of absence of
internal fragmentation.
Disadvantages of Variable Partitioning
Types:
•Paging [Fixed partitioning]
•Segmentation[Variable partitioning]
What is Paging?
Page table:
•A page table contains the frame number corresponding to
the page number of some specific process.
•The page table maps the page number to its actual location
(frame number) in the memory.
•So, each process will have its own page table. A register
called Page Table Base Register(PTBR) which holds the base
value of the page table.
How is the translation done?
•As the size of the frame is fixed, so it may suffer from internal
fragmentation. It may happen that the process is too small
and it may not acquire the entire frame size.
•The access time increases because of paging as the main
memory has to be now accessed two times. First, we need to
access the page table which is also stored in the main memory
and second, combine the frame number with the page offset
and then get the physical address of the page which is again
stored in the main memory.
•For every process, we have an independent page table and
maintaining the page table is extra overhead.
What is Segmentation?
Physical Address:
The physical address is obtained by adding the base
address of the segment to the segment offset.
Translation of logical Address into
physical Address contd..
Segment table:
A segment table stores the base address of each
segment in the main memory. It has two parts
i.e. Base and Limit.