Professional Documents
Culture Documents
LECTURE 4
places the incoming segment in the
smallest hole large enough to
accommodate the segment
requires scanning the entire physical
memory thus slowing down the entire
Best Fit operation
also suffers badly from external
fragmentation because of holes of small
sizes scattered throughout the physical
memory
places the incoming segment in the
largest hole available
creates relatively larger holes that can
be used to satisfy future segment
Worst Fit requests without frequent garbage
collection
has drawback of scanning entire
memory to make a final decision
starts scanning physical memory from
beginning and places the segment in
the first available hole large enough to
First Fit hold the segment
Fast
Outperforms all other policies
A variation of first fit except that it scans
Next Fit memory from the address where the
most recently placed segment ends.
Address
Translation
Combines advantages of both the worlds
Virtual address space is divided into
segments by programmers
An example
Paging Segmentation Paged-Segments
Virtual Address Space is divided into fixed-size Virtual Address Space is divided into Virtual Address Space is divided into variable-
pages by the system. variable-sized segments by programmer. sized segments by programmer. These segments
are further divided into fixed-size pages by the
system.
Physical Memory is divided into fixed-size page No division of physical memory Physical Memory is divided into fixed-size page
frames by the system. frames by the system.
A page of a process can occupy any available The segments of a process can be The pages of a segment can occupy any
frames in any order. The only restriction is that placed anywhere. However, a segment available frames in any order. This simplifies the
one page needs to be contiguous in physical needs to be contiguous in physical job of placing a segment in physical memory.
memory. memory. The only restriction is that one page needs to be
contiguous in physical memory
Placing a page into a page frame is quite An intelligent placement algorithm Placing a page into a page frame is quite
straight forward as all pages and page frames needs to be in place because of straight forward as all pages and page frames
are of same size. variable-size segments. are of same size.
No external fragmentation but suffers from No internal fragmentation but suffers No external fragmentation but suffers from
internal fragmentation. from external fragmentation. internal fragmentation.
Paging and Segmentation
Both pages and segments are stored on Fixed sized Variable sized
disk Made to fit frames Complete
Both pages and segments are transferred of main memory sections of a
to main memory when needed program
Problem with both: Physical divisions Logical division
Thrashing
VM Problems
Problem 1
Determine the page size, number of pages
in VAS and PAS, size of VAS and PAS from
the figure.
12 bit page offset field
Page # field =
20 b
Frame # field =
18 b
VAS = 232 B
PAS = 230 B
VM Problems
Solution
Page Size
= 4KB
#Frames
= 218
#Pages
= 220
Size of Main Memory (PAS)
= 1 GB
Size of VAS
= 4 GB