Unit 5 OS
Unit 5 OS
Unit 5 OS
M.A. Zahed
Lecturer
Unit V: Memory Management
Free space management
techniques
⚫The OS must manage the
memory when allocated
dynamically.
⚫There are two approaches to
keep track of memory usages
-Bit Map
-Linked List
Bit Map
⚫With a bit map, memory is
divided into allocation units.
⚫Corresponding to each allocation
unit there is a bit in a bitmap.
⚫Bit is 0 if unit is free and it is 1 if
unit is occupied.
⚫The size of allocation unit is an
important issue, the smaller the
size, the larger size of bitmap
Bit Map
⚫The main problem is that when it
has been decided to bring a k
unit process the memory
manager must search a bitmap
to find a run of k consecutive 0
bits in the map.
⚫Searching a bitmap for a run of
given length is a slow operation.
⚫It is tedious to keep the bitmap
in memory for large disks.
Bit Map
Linked List
⚫Another way of keeping track of
memory is to maintain a linked
list of allocated and free memory
segments, where a segment
either contains a process or is an
empty hole between two
processes.
Linked List
⚫The segment list is kept sorted
by address. Sorting this way has
the advantage that when a
process is swapped out or
terminates, updating the list is
straightforward.
⚫ Background
⚫ Swapping
⚫ Contiguous Memory Allocation
⚫ Paging
⚫ Structure of the Page Table
⚫ Segmentation
Learning Outcomes
⚫ To provide a detailed description of various
ways of organizing memory hardware
⚫ To discuss various memory-management
techniques, including paging and
segmentation
Background
⚫ Multiple-partition allocation
◦ Hole – block of available memory; holes of various
size are scattered throughout memory
◦ When a process arrives, it is allocated memory from
a hole large enough to accommodate it
◦ Operating system maintains information about:
a) allocated partitions b) free partitions (hole)
OS OS OS OS
process 8 process 10
p d
m-n n
4
1
3 2
4
1,2,3,4,1,2,5,1,2,3,4,5
⚫System maintains a
timestamp for every page
that indicates the time of last
access.
Optimal page
replacement
⚫The page which will not be
accessed permanently or for
the longest period of time
should be replaced.
⚫It gives less page fault
compared with FIFO and LRU.
⚫Difficult to implement
because of future reference.
Learning Outcome
⚫Explain FIFO, LRU, OPTIMAL page
replacement algorithms
Thank You..!!!