Sunteți pe pagina 1din 11

Chapter 08

Main Memory
(Page table questions)

Operating System Concepts with Java 8th Edition

8.1

Silberschatz, Galvin and Gagne 2009

Memory Address Translation Scheme

Logical Address generated by CPU is divided into:

Page number (p) used as an index into a page table which


contains base address of each page in physical memory

Page offset (d) combined with base address to define the


physical memory address that is sent to the memory unit

page number

page offset

m-n

For given logical address space 2m and

page size 2n

Operating System Concepts with Java 8th Edition

8.2

Silberschatz, Galvin and Gagne 2009

Page table structure


So each address has both page number and offset number: as

X bits page number

Y bits offset number

Logical address would be XY

If x=2 and m =4 indicates that a page can have 24 addresses i.e. 16


addresses or 16 bytes and there are two frames only

Operating System Concepts with Java 8th Edition

8.3

Silberschatz, Galvin and Gagne 2009

Example
Example: if the logical address is 0xAEF9 having a page size of 256

bytes, what is the page number?

Page size as 256 = 28 total addresses or offset


8 bits are used for offset = F9
Left 8 bits are for page number = AE

Operating System Concepts with Java 8th Edition

8.4

Silberschatz, Galvin and Gagne 2009

Example
If 18 bits are used to represent an entry in a conventional page table,

how many entries would be there?

Answer = 2^18 = 262144

Operating System Concepts with Java 8th Edition

8.5

Silberschatz, Galvin and Gagne 2009

Example
Consider a logical address with a page size of 8 KB. How many bits

must be used to represent the page offset in the logical address?

8 KB = 8 * 1024 = 8192 bytes = 2^13


Answer = 13 bits

Operating System Concepts with Java 8th Edition

8.6

Silberschatz, Galvin and Gagne 2009

Example
Consider a 32-bit address for a two-level paging system with an 8 KB

page size. The outer page table has 1024 entries. How many bits are
used to represent the second-level page table?

32 bit is divided into

Level 1+ level 2+ offset

Level 1 = 1024 entries = 2^10 = 10

Page size = 8 kb = 2^13 bits = 13

Total 32 so remainder is 32-(10+13) = 9 bits

Operating System Concepts with Java 8th Edition

8.7

Silberschatz, Galvin and Gagne 2009

Consider a logical address space of 64 pages of 1,024 words each,

mapped onto a physical memory of 32 frames.

how many bits are there in the logical address?


How many bits are there in the physical address?

Answer:

Logical address: 16 bits

Physical address: 15 bits

Operating System Concepts with Java 8th Edition

8.8

Silberschatz, Galvin and Gagne 2009

Practice Question
Consider the following segment table:

Segment

Base

219 600

2300

90 100

1327

580

1952

96

Length

14

What are the physical addressed for the following logical addresses?
a)

0,430

-> 219 + 430 = 649

b)

1,10

-> 2300+10 = 2310

c)

2,500

-> 90+500 -> Invalid as length is 100 only

d)

3,400

-> 1327 + 300 = 1637

e)

4,112

-> 1952 + 112 -> invalid as length is 96 only

Operating System Concepts with Java 8th Edition

8.9

Silberschatz, Galvin and Gagne 2009

Example 2
Consider a paging system with the page table stored in memory.

(a) If a memory reference takes 200 nanoseconds, how long does a paged
memory reference take?
(b) If we add associative registers, and 75% of all page-table references
are found in the associative registers, what is the effective memory
reference time? (Assume that finding a page-table entry in the associative
registers takes zero time, if the entry is there.)
Solution:
a) 400 nanoseconds. 200 ns to access the page table plus 200 ns to
access the word in memory.
b) 250 nanoseconds.

Operating System Concepts with Java 8th Edition

8.10

Silberschatz, Galvin and Gagne 2009

Two level page table

Operating System Concepts with Java 8th Edition

8.11

Silberschatz, Galvin and Gagne 2009

S-ar putea să vă placă și