Operating Systems Unit 05
5.1 o No limits of maximum process
size
Basic Memory Management
• Disadvantages
Memory management is the process of o Difficult to implement
keeping track of the free and allocated blocks o External fragmentation
of the RAM and assigning the free memory o Overheads as compared to
blocks to processes. Fixed size
Memory Partitioning Free Space management techniques
Memory partitioning means dividing the main Free space management is a critical aspect of
memory into chunks of the same or different operating systems as it involves managing the
sizes so that they can be assigned to processes available storage space on the hard disk or
in the main memory. other secondary storage devices.
There are two types of memory partitioning Bit Vector
techniques:
• Fixed-sized memory partitioning
• Variable-sized memory partitioning
• Bit vector is also called as Bitmap
Fixed size memory partitioning • A Vector of the Memory is created
• Where each bit represents each block
• Blocks of same or different size
in the system
• Takes place before execution of
• To find free block
process or at configuration of system
Block number = (Number of bits per
• OS finds a block which is greater or
word )* (number of 0-value words) +
equal to size of the Process
(offset of first bit)
• Advantages
o number of bits per word which
o Less Overhead at runtime
varies system to system
o Easy to implement
o number of 0-value words is
• Disadvantages
words before the a non zero
o Internal Fragmentation
value word
o External Fragmentation
o offset of first bit is the offset of
o Limits degree of concurrency
1st 1 in the non-zero word
o Limits maximum size of
• Bit vector is stored somewhere in the
process
memory
Variable size memory partitioning • Advantages
o Simple to implement
• Takes place at runtime
o Efficient
• Dynamic
o Occupies less Main Memory
• Process is compared with free memory
• Disadvantages
in RAM, if available then a block is
o Entire Bit vector has to be
created for the process
searched to find desired block
• For creating block free memory is
o Special hardware support is
divided into two blocks which of one is
needed to detect 1
equal to the process size.
o For larger storage bit vector
• Advantages
will be bigger in size
o No Internal Fragmentation
Operating Systems Unit 05
Linked List Paging
Paging is a storage mechanism used in OS to
• Free Blocks are linked together retrieve processes from secondary storage to
• Head of the linked list is stored in the the main memory as pages. The primary
memory somewhere concept behind paging is to break each process
• Last free block points to the null into individual pages. Thus the primary
indicating end of list memory would also be separated into frames.
• Advantages
o External Fragmentation is • Page is part of process
prevented • Frame is part of Memory
o It helps to increase size of file • Frame size & Page size must be same
dynamically
o Less Overheads as the linked
list for file is already created
• Disadvantages
o Inefficient
o Overhead to maintain pointer
o No provision for direct access
5.2
The address generated by the CPU is divided
Virtual Memory
into the following:
Virtual memory is a memory management
• Page offset(d): It refers to the number
technique where secondary memory can be
of bits necessary to represent a certain
used as if it were a part of the main memory.
word on a page, page size in Logical
Virtual memory is a common technique used in
Address Space, or page word number
a computer's operating system (OS).
or page offset.
• Page number(p): It is the number of
bits needed to represent the pages in
the Logical Address Space or the page
number.
The Physical Address is divided into the
following:
• Frame offset(d): It refers to the
number of bits necessary to represent
a certain word in a frame, or the
Operating Systems Unit 05
Physical Address Space frame size, the Segmentation in OS
word number of a frame, or the frame
offset.
• Frame number(f): It’s the number of
bits needed to indicate a frame of the
Physical Address Space or a frame
number.
Dedicated registers can be used to implement
the page table in hardware. However, using a
register for the page table is only useful if the
page table is tiny. We can employ TLB
(translation look-aside buffer), a particular,
tiny, fast look-up hardware cache if the page
table has a significant number of entries.
• The TLB is a high-speed, associative
• Segmentation partitions the program
memory.
into variable-sized blocks or segments.
• LB entries are made up of two parts: a
• Partition size depends upon the type
value and a tag.
and length of modules.
• When this memory is accessed, an
• Segmentation is done considering that
item is compared to all tags at the
the relative data should come in a
same time.
single segment.
• If the object is located, the value
• Segments of the memory may or may
associated with it is returned.
not be stored in a continuous manner
depending upon the segmentation
technique chosen.
• Operating System maintains a segment
table for each process.