Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CS 162 Midterm Exam II: Virtual Memory, Network File Server, and Disk Access, Exams of Operating Systems

A set of problems from the cs 162 midterm exam ii in 2007. The problems cover various topics including virtual memory management, network file servers, and disk access. The problems involve calculating maximum packet sizes, ideal data transfer rates, tcp window sizes, and total time to read data from disk.

Typology: Exams

2012/2013

Uploaded on 04/02/2013

shaina_44kin
shaina_44kin 🇮🇳

3.9

(9)

68 documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Page 1/17
University of California, Berkeley
College of Engineering
Computer Science Division EECS
Fall 2007
John Kubiatowicz
Midterm II
December 3rd, 2007
CS162: Operating Systems and Systems Programming
Your Name:
SID Number:
Circle the
letters of CS162
Login
First: a b c d e f g h I j k l m n o p q r s t u v w x y z
Second: a b c d e f g h I j k l m n o p q r s t u v w x y z
Discussion
Section:
General Information:
This is a closed book exam. You are allowed 1 page of hand-written notes (both sides). You
have 3 hours to complete as much of the exam as possible. Make sure to read all of the questions
first, as some of the questions are substantially more time consuming.
Write all of your answers directly on this paper. Make your answers as concise as possible. On
programming questions, we will be looking for performance as well as correctness, so think through
your answers carefully. If there is something about the questions that you believe is open to
interpretation, please ask us about it!
Problem Possible Score
1 20
2 25
3 20
4 35
Total
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download CS 162 Midterm Exam II: Virtual Memory, Network File Server, and Disk Access and more Exams Operating Systems in PDF only on Docsity!

University of California, Berkeley College of Engineering Computer Science Division ⎯ EECS Fall 2007 John Kubiatowicz

Midterm II

December 3rd^ , 2007 CS162: Operating Systems and Systems Programming

Your Name:

SID Number: Circle the letters of CS Login

First: a b c d e f g h I j k l m n o p q r s t u v w x y z Second: a b c d e f g h I j k l m n o p q r s t u v w x y z

Discussion Section:

General Information: This is a closed book exam. You are allowed 1 page of hand-written notes (both sides). You have 3 hours to complete as much of the exam as possible. Make sure to read all of the questions first, as some of the questions are substantially more time consuming.

Write all of your answers directly on this paper. Make your answers as concise as possible. On programming questions, we will be looking for performance as well as correctness, so think through your answers carefully. If there is something about the questions that you believe is open to interpretation, please ask us about it!

Problem Possible Score

Total

[ This page left for π ]

Problem 1f[2pts]: The rate of page faults in a virtual memory system can always be reduced by adding more memory.

True / False

Explain:

Problem 1g[2pts]: Compulsory misses in a cache can be reduced with prefetching.

True / False

Explain:

Problem 1h[2pts]: A “memoryless” probability distribution provides a poor model for any real sources of events.

True / False

Explain:

Problem 1i[2pts]: Nonvolatile Ram (NVRAM) can improve the durability of a file system that uses delayed writes.

True / False

Explain:

Problem 1j[2pts]: Because of the 32-bit IP-V4 address space, it is impossible for more than 2 32 computers to communicate over the internet.

True / False

Explain:

Problem 2: Virtual Memory and Paging [25pts] Consider a two-level memory management scheme on 22-bit virtual addresses using the following format for virtual addresses:

Virtual Page # (7 bits)

Virtual Page # (7 bits)

Offset (8 bits)

Virtual addresses are translated into 16-bit physical addresses of the following form:

Physical Page # (8 bits)

Offset (8 bits)

Page table entries are 16 bits in the following format, stored in big-endian form in memory (i.e. the MSB is first byte in memory).

Page Table Entry (PTE)

Physical Page # (8 bits)

Kernel OnlyUncacheable

0 0

DirtyUse WriteValid

Note that a virtual-physical translation can fail at any point if an incompatible PTE is encountered. Two types of errors can occur during translation: “invalid page” (page is not mapped at all) or “access violation” (page exists, but access was illegal).

Problem 2a[2pts]: Can you give a logical reason why the designer might have made the virtual page # fields 7 bits each?

Problem 2b[2pts]: What is the maximum amount of physical memory addressable by this system? Can you think of a way to increase the amount of available physical memory without altering the widths of the virtual addresses or PTEs?

Problem 3c[2pts]: How many total bits of storage will each entry of the TLB consume (including the tag and/or other fields)? Explain.

Virtual Address Format

Virtual Page # (7 bits)

Virtual Page # (7 bits)

Offset (8 bits)

Page Table Entry (PTE)

Physical Page # (8 bits)

Kernel Not

Cacheable 0 0

DirtyUse WriteValid

Physical Memory

Address +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F

Problem 2g[4pts]: For the following problem, assume a hypothetical machine with 4 pages of physical memory and 7 pages of virtual memory. Given the access pattern: A B C D E F C A A F F G A B G D F F Indicate in the following table which pages are mapped to which physical pages for each of the following policies. Assume that a blank box matches the element to the left. We have given the FIFO policy as an example.

Access→ A B C D E F C A A F F G A B G D F F 1 A E B 2 B F D 3 C A F

FIFO

4 D G

MIN

LRU

Problem 2i[3pts]: What is a precise exception and why would we want a software TLB fault to generate a precise exception?

Problem 3e[2pts]: The Fast File System (FFS) of Berkeley 4.2 Unix utilized “Skip Sector Positioning” to improve performance. Explain what “Skip Sector Positioning” is and why this optimization may no longer be important.

Problem 3f[3pts]: The Network File System (NFS) uses a “stateless” protocol between clients and servers. What does this mean? Name one advantage and one disadvantage of stateless filesystem protocols.

Problem 3j[6pts]: Suppose that a new disk technology provided access times that are of the same order of magnitude as memory access times. What, if anything, must be changed in the following three OS components to take advantage of the quicker access time? If something doesn’t change, be very specific why it doesn’t change. If it will change, contrast these changes with current implementation and be as specific as possible in your answers (i.e. identify what would change and why).

  1. Process Scheduler
  2. Memory Management
  3. Device Driver for the new disk

[ This page intentionally left blank ]

Problem 4a[3pts]: What is the maximum amount of data that the client or server can send in each packet while avoiding fragmentation along the way? Remember that the TCP+IP header is 40 bytes. Explain.

Problem 4b[2pts]: Explain how the client or server could automatically discover the answer to 4a:

Problem 4c[2pts]: Under ideal circumstances (and ignoring interrupt and copying overheads and window sizes), what is the maximum data bandwidth that could be sent from the server to the client without dropping packets, assuming that the server utilizes the mechanism in 4b? Explain.

Problem 4d[3pts]: Assume that a maximal sized packet (as in 4a) is sent from the TCP send buffer of the server to the TCP receive buffer of the client. Compute the total roundtrip latency from the point at which the server invokes the device driver to send the packet until it receive the ACK via an interrupt. Hint: don’t forget the interrupt at the receiving side and the DMA mechanism into and out of the network.

Problem 4e[3pts]: What TCP window size is necessary to achieve the bandwidth of 4c without dropping packets in the network? Use simple constants and values that you computed for 4a-4d. Explain. Make sure that you correct for units.

Problem 4f[6pts]: Suppose that video files are laid out in 64K (65536 bytes) chunks on the disk (i.e. 64K in successive sectors on a track). Compute the overhead for reading such a 64K chunk from a random place on the disk. Assume that the disk controller automatically DMAs the data to kernel memory in a fashion that is overlapped with reading it from the disk (so that you do not have to worry about DMA for this operation). After finishing, the controller generates an interrupt; the interrupt routine may submit another request to the controller (if one is queued on the DDRQ). Assume the disk parameters given above (repeated here):

  • 750GB in size
  • 10000 RPM, Data transfer rate of 50 Mbytes/s (50 × 10^6 bytes/sec)
  • Average seek time of 4ms
  • ATA Controller with 1ms controller initiation time
  • A block size of 4Kbytes (4096 bytes)

What is the total time to read 64K chunk from a random place on the disk into memory including the interrupt? Hint: there are 5 terms here including the interrupt!

Problem 4j[5pts]: Returning to our single-disk server, assume that 15 clients connect through network resources that are independent up to router #2. Each client has its own user-level process working on its behalf. Assume that all 15 clients send requests at a rate of (4g). If the disk response distribution can be described with C=1.5 and the aggregate network request rate can be described as exponential, what is the average length of the disk device driver request queue (DDRQ)? Hint: the service time for the disk is the time between requests to the disk controller when the DDRQ is full. Possibly useful formulas include:

Mean Service: = (^) ∑ (^) =

n server (^) n i 1 Ti

T Variance: = (^) ∑ (^) = ( − )

n n i^^1 Ti^ Tserver

M/G/1 queue: (^) ⎟ ⎠

⎟×

= ×

u

C u 2 1

Tq Tserver Little’s law: Lq =λ × Tq

[ Scratch Page (feel free to remove) ]