Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

As described in Section 5.7, virtual memory uses a page table to track the mappi

ID: 3560315 • Letter: A

Question

As described in Section 5.7, virtual memory uses a page table to track the mapping of virtual addresses to physical addresses. This exercise shows how this table must be updated as addresses are accessed. The following data constitutes a stream of virtual addresses as seen on a system. Assume 4 KiB pages, a 4-entry fully associative TLB, and true LRU replacement. If pages must be brought in from disk, increment the next largest page number. 4669, 2227, 13916, 34587, 48870, 12608, 49225 [10] Given the address stream shown, and the initial TLB and page table states provided above, show the final state of the system. Also list for each reference if it is a hit in the TLB, a hit in the page table, or a page fault. [15] Repeat part 5.11.1, but this time use 16 KiB pages instead of 4 KiB pages. What would be some of the advantages of having a larger page size? What are some of the disadvantages?

Explanation / Answer

The initial Translation lookaside buffer (TLB) is as follows:

Valid

Tag

Physical Page Number

1

11

12

1

7

4

1

3

6

0

4

9

The initial page table is as follows:

Valid

              Physical Page or in Disk

1

5

0

Disk

0

Disk

1

6

1

9

1

11

0

Disk

1

4

0

Disk

0

Disk

1

3

1

12

The given virtual addresses are:

4669, 2227, 13916, 34587, 48870, 12608, 49225

The question does not contain the LRU order for the existing three entries in the TLB, true LRU replacement cannot be used. Using either random replacement or selecting randomly from the three existing entries until they've all been override (an LRU approximation) were both valid options.

The Binary equivalent values of the virtual addresses should be divided as page number and page offset as shown in the below table:

virtual address (In Decimal)

virtual address (In Binary)

Page Number

Page Offset

Virtual page number

4669

0001001000111101

0001

001000111101

1

2227

0000100010110011

0000

100010110011

0

13916

0011011001011100

0011

011001011100

3

34587

1000011100011011

1000

011100011011

8

48870

1011111011100110

1011

111011100110

11

12608

0011000101000000

0011

000101000000

3

49225

1100000001001001

1100

000001001001

12

Now, the virtual page number 1 is not in the TLB in page table is on Disk. This results a page fault.

Select an available physical page number = 3

Update index 1 of the page table as follows:

            valid = 1          physical page number = 3

Update the TLB, since the final entry in the TLB has valid = 0, overwrite that line with the following:

            valid = 1          tag = 1     physical page number = 3

Then the resultant TLB and the Page table is shown below:

TLB

Valid

Tag

Physical Page Number

1

11

12

1

7

4

1

3

6

1

1

3

Page Table

Valid

              Physical Page or in Disk

1

5

1

3

0

Disk

1

6

1

9

1

11

0

Disk

1

4

0

Disk

0

Disk

1

3

1

12

The virtual page number 0 is not in the TLB, but the index 0 in page table is valid.

Select a random entry, let

Valid

Tag

Physical Page Number

1

11

12

1

7

4

1

3

6

0

4

9