Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in...

12
Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

Transcript of Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in...

Page 1: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

Paging Examples

Assume a page size of 1K and a 15-bit logical address space.

How many pages are in the system?

Page 2: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

Paging Examples

Assume a page size of 1K and a 15-bit logical address space.

How many pages are in the system?

How many bits are required to address each byte within a 1024-byte page?

Page 3: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

Paging Examples

Assume a page size of 1K and a 15-bit logical address space.

How many pages are in the system?

How many bits are required to address each byte within a 1024-byte page? 10 (2^10 = 1024).

This leaves 5 bits for page number.

So, How many pages are in the system?

Page 4: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

Paging Examples

Assume a page size of 1K and a 15-bit logical address space.

How many pages are in the system?

How many bits are required to address each byte within a 1024-byte page? 10 (2^10 = 1024).

This leaves 5 bits for page number. So, How many pages are in the system?

32 (2^5 = 32)

Page 5: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

• Now consider a 15-bit address space with 8 logical pages. How large are the pages?

Page 6: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

• Assuming a 15-bit address space with 8 logical pages. How large are the pages?

• Answer: 2^12 = 4K. It takes 3 bits to reference 8 logical pages (2^3 = 8). This leaves 12 bits for the page size and thus pages are 2^12.

Page 7: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

Consider logical address 2049 and the following page table for some process P0.

Assume a 15-bit address space with a page size of 1K.

What is the physical address to which logical address 2049 will be mapped?

8

0

3

Page 8: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

Consider logical address 2049 and the following page table for some process P0.

Assume a 15-bit address space with a page size of 1K.

What is the physical address to which logical address 2049 will be mapped?

8

0

3

Step 1. Convert logical address to binary:

Logical address:

000100000000001

0

1

2

3

4

Logical Pages

Page 9: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

8

0

3

Step2. Determine the logical page number:

Since there are 5-bits allocated to the logical page, the address is broken up as follows:

00010 0000000001

Logical page number offset within page

0

1

2

3

4

Logical Pages

Page 10: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

Step 3. Use logical page number as an index into the page table to get physical page number.

Logical Address:

00010 0000000001

00010

8

0

3 00011

Page 11: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

Step 4. Concatenate offset with physical page frame number

Logical Address

00010 0000000001

00010

8

0

3 000110000000001

Page 12: Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

8

0

3

P0.1

2048

1024

0

3072 P0.2

4096

000110000000001 = 3073

0

1

2

3

4