paging in os
TRANSCRIPT
-
7/24/2019 Paging In OS
1/26
Paging
To, By
Dr. Varsha Garg Sanjeeb Nayak
-
7/24/2019 Paging In OS
2/26
1. Basic defnition o paging.
2. Address mapping.
3. Page translation.
4. Paging hardware.
5. Paging example. 6. Implementing paging.
. Associati!e memor".
#. Ad!antages and disad!antages o paging.
$opics to %e co!ered
-
7/24/2019 Paging In OS
3/26
Physical memory is divided into fed si!e"
blocks called FRAMES #ogical memory is divided into blocks o$
the same si!e called PAGES
% $rame has the same si!e as a &age is a &lace 'here a (logical) &age can be
(&hysically) &laced
Basic &efnition o Paging
Memory-management technique that
permits thephysicaladdress space of aprocess to be non-contiguous
-
7/24/2019 Paging In OS
4/26
Address 'apping
-
7/24/2019 Paging In OS
5/26
-
7/24/2019 Paging In OS
6/26
*very address generated by the +P is
divided into t'o &arts- Page n(m%er )p*and Page o+set )d*
Paging ,ardware
-
7/24/2019 Paging In OS
7/26
The &age nmber is sed as an inde into a
Page $a%leThe &age si!e is defned by the hard'areThe si!e o$ a &age is ty&ically a &o'er o$ /,
varying bet'een 01/ bytes and 123B &er
&age 4eason- 5$ the si!e o$ logical address is
/6m and &age si!e is /6n, then the high"
orderm"n bits o$ a logical address designate the&age nmber
Paging ,ardware
-
7/24/2019 Paging In OS
8/26
Paging ,ardware
-
7/24/2019 Paging In OS
9/26
Implementing Page $a%le
To im&lement &aging, the sim&lest methodis to im&lement the &age table as a set o$registers
7o'ever, the si!e o$ register is limited andthe si!e o$ &age table is sally large
There$ore, the &age table is ke&t in mainmemory
-
7/24/2019 Paging In OS
10/26
8hen 'e se a &aging scheme, 'e have noeternal $ragmentation- %N9 $ree $rame canbe allocated to a &rocess that needs it.
7o'ever, 'e may have internal
$ragmentation 5$ the &rocess re:ires n &ages, at least n$rames are re:ired
The frst &age o$ the &rocess is loaded into the
frst $rame listed on $ree"$rame list, and the$rame nmber is &t into &age table
Paging -xample
-
7/24/2019 Paging In OS
11/26
-
7/24/2019 Paging In OS
12/26
-
7/24/2019 Paging In OS
13/26
-
7/24/2019 Paging In OS
14/26
-
7/24/2019 Paging In OS
15/26
-
7/24/2019 Paging In OS
16/26
-
7/24/2019 Paging In OS
17/26
-
7/24/2019 Paging In OS
18/26
-
7/24/2019 Paging In OS
19/26
-
7/24/2019 Paging In OS
20/26
-
7/24/2019 Paging In OS
21/26
'' Address $ranslation
-
7/24/2019 Paging In OS
22/26
$/B Assisted $ranslation
5$ 'e 'ant to access any location, 'emst frst inde into the &age table
This re:ires at least one memory
accessThe standard soltion is to se a
s&ecial, small, $ast cache, called
$ranslation loo0aside %(+er )$/B*or associati!e memor"
-
7/24/2019 Paging In OS
23/26
$/B Assisted $ranslation
-
7/24/2019 Paging In OS
24/26
$/B
5$ the &age nmber is not in the T#B (T#B
miss) a memory re$erence to the &age tablemst be made.
5n addition, 'e add the &age nmber and$rame nmber into T#B
5$ the T#B already $ll, the ;S have to mstselect one $or re&lacement
Some T#Bs allo' entries to be wire down,meaning that they cannot be removed $romthe T#B, $or eam&le kernel codes
The &ercentage o$ times that a &articlar&age nmber is $ond in the T#N is calledhit ratio
5$ it takes /< nanosecond to search the T#Band 1
-
7/24/2019 Paging In OS
25/26
%DV%NT%G*S
Noeternal =ragmentation
Sim&le memory management algorithm S'a&&ing is easy (*:al si!ed Pages and
Page =rames) Share common code es&ecially in a time"sharing
environment
D5S%DV%NT%G*S
5nternal $ragmentation
Page tables may consme more memory. 3lti level &aging leads to memory
re$erence overhead.
-
7/24/2019 Paging In OS
26/26
Thank You