2. Involve swapping block of data from second
memory
Memory needs to be allocated to ensure a reasonable
supply of ready processes to consume available
processor time
Memory management requirements:
Relocation
Protection
Sharing
Logical organisation
Physical organisation
Memory management
3. Paging is a partition memory into small equal fixed-
size chunks and divide each process into the same
size chunks
Pages-The chunks of a process
Frame or pages frame-The chunks of a memory
Page table:
Contains the frame location for each page in the
process
Memory address consist of a page number and offset
within the page
PAGING
4.
Process Pages to
free frames
Some of the frames in memory are use and some are free.
A list of frames is maintained by the OS.
Process A stored on disk and it consist of four pages.
OS will find the four free frames and loads the
four pages of process A into four frames.
5.
…
Process B consisting of three pages and Process C consisting of four
pages are subsequently loaded.
Process B is suspended and swapped out to main memory.
All the process in main memory will blocked
OS need to bring a new process, which is process D that contain five
pages.
6.
The five pages of process D are loaded into frames
5,6,11, and 12.
7.
A pages tables contain one entry for each pages of the process.
The table easily indexed by the pages number (starting at 0)
Each pages table entry contains the number of the frame in
main memory that hold the corresponding page.
A free frame list, available for pages, is maintained
Thus we will se the simple paging is similar to fixed partioning.
8.
manages the main memory by dividing the memory into
regions/fixed/variable size is called partitioning
Two types of partitions
1. Static Partition
Whole memory is divided into fixed sized frame
2. Dynamic Partition
Memory is divided into variable sized frame according to
page size
Partitioning
10.
pAGING
CPU
p d f d
Physical
memory
f
p
Logical
address
Physical
address
Page table
Visual address of a process divided into
1. page number (p) – index to page table
2. page offset (d) – offset into page/frame
12.
Paging hardware
Address space 2m
Page offset 2n
Page number 2m-n
p d
Page
number
Page
offset
m-n n
Note :
Not losing any
space !
Step : address translation
1. Extract the page number as the n nits of the logical address
2. Use the page number as an index into process page table to
find the frame number, k
3. The starting physical address of the frame is k * 2m , the
physical address of the referenced bytes is that number plus
offset.
Physical
memory
2m bytes
13.
Segmentation
Step : Address translation from virtual to physical
address
1. Extract the segment number as the n bits of the
logical address
2. Use the segment number as an index into the
process segment table to find the starting physical
address of the segment
3. Compare the offset, expressed in the m bits, to the
length of the segment. If offset is “>=“ to the
length, the address is invalid.
4. The desired physical address is the sum of the
starting physical address of the segment plus
offset.
14.
Segmentation
CPU s d
< +
limit base
s
Physical memory
Segment
table
yes
Trap, addressing error
Physica
l
address
no
Logical
address
main
stack
19.
The End..
pROjECT: oPERATing sYSTem
From:
FATIN NABILAH BT ABDUL RAMAN
CHONG LEE MAN
HAFIZOH BINTI MD ISA
SITI FATIHAH BT MOHD SOHAIMI
Lecturer :
DR NURUL AZMA ZAKARIA