0% found this document useful (0 votes)
51 views

Operating Systems Quiz 3

1. The document describes the problems and solutions for an operating systems quiz involving virtual memory translation. 2. It details the data block ranges and number of accesses for various memory references in problem 2. 3. In problem 1b, it walks through the page table and virtual to physical address translations for several read and write instructions, tracking the state of the page table as pages are loaded, written to, and replaced in memory.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Operating Systems Quiz 3

1. The document describes the problems and solutions for an operating systems quiz involving virtual memory translation. 2. It details the data block ranges and number of accesses for various memory references in problem 2. 3. In problem 1b, it walks through the page table and virtual to physical address translations for several read and write instructions, tracking the state of the page table as pages are loaded, written to, and replaced in memory.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Operating Systems Quiz 3

Daniel Guzman
CSCI 4730
12/8/14

Problems
1. a) Virtual address is 16 bits, physical is 13.
b) See Section below.
2. Data block ranges: 1-12 (direct), 13-1036 (L1 indirect), 1037-1049612 (L2 indirect), 10496131074791436 (L3 indirect).
1: 1 accesses (1 to direct block)
10: 1 accesses (1 to direct block)
200: 2 accesses (1 to L1 indirect block, 1 to direct block)
500: 2 accesses (1 to L1 indirect block, 1 to direct block)
1,000: 2 accesses (1 to L1 indirect block, 1 to direct block)
2,200: 3 accesses (1 to L2 indirect block, one to L1 indirect block, 1 to direct block)
10,000: 3 accesses (1 to L2 indirect block, one to L1 indirect block, 1 to direct block)
100,000: 3 accesses (1 to L2 indirect block, one to L1 indirect block, 1 to direct block)
1,000,000: 3 accesses (1 to L2 indirect block, one to L1 indirect block, 1 to direct block)
1,400,000: 4 accesses (1 to L3 indirect block, 1 to L2 indirect block, one to L1 indirect block, 1 to direct
block)
5,000,000: 4 accesses (1 to L3 indirect block, 1 to L2 indirect block, one to L1 indirect block, 1 to direct
block)

Problem 1b
To begin, each virtual address is split into 5 bits for virtual page and 11 bits for offset.
ppppp ooooooooooo
\---/ \---------/
page
offset

So, to begin with our translations, the initial table state is as follows:

Virtual Page

Physical Frame

Valid

Dirty

Read Only

Use

To translate the first, we look at the bits.


WRITE 00000 01010101010
Page #0, offset 01010101010b. Page 0 is in use and valid, so well write to it. A write is executed, writing to
address 0001010101010. This has the side-effect of marking that page as dirty, so itll be reflected as well.
Now, the table is this:
Virtual Page

Physical Frame

Valid

Dirty

Read Only

Use

Next:
READ 00011 11111100101
00011 is 3, so this read is from page #3. 3 is not valid, so this means it has to be put into memory. Were
using a sequential page replacement algorithm, so well start from frame 0. Frame 0 is currently occupied
by page 0, and its state is dirty, which means that the kernel will save the contents of page 0 to
disk/whatever backs the page table. After saving, the contents of page #3 will be read into frame 0, and the
page table will set page #0s valid bit to 0, page #3s frame to 0, and page #3s valid bit to 1. The read is

executed from address 0011111100101. The end result is this:


Virtual Page

Physical Frame

Valid

Dirty

Read Only

Use

Next instruction:
READ 00110 11000001001
00110 is 6, so this read is for page #6. Page 6 is not valid, so again, well be forced to go to disk. This time,
well be loading into frame 1, so we have to check the current page there. Page #4 currently occupies
frame 1, and its dirty, so again, well have to go ahead and write it out to disk/backing store to preserve its
contents. The shift then happens, loading page #6 into frame #1 and updating the table accordingly. The
read then occurs as normal, reading from physical address 0111000001001. Afterward, this is the result:
Virtual Page

Physical Frame

Valid

Dirty

Read Only

Use

Lastly:
WRITE 00010 11111111111
00010 is page #2, which is both valid and in memory! The translation will take it from page #2 to frame 3,

so the end address is 1111111111111. However, this page is read only, so the attempt to write is ultimately
doomed to fail.

You might also like