Docsity

Homework 2 Problems for Operating Systems Design | CS 423, Assignments of Operating Systems

Toggle sidebar
bg1
Homework 2: CS 423, Fall 2007
Klara Nahrstedt/Sam King
Posted: November 26, 2007
Deadline: December 3, Midnight,
Delivery: Upload the HW2 to the Compass
Important: The homework effort is an Individual Effort. Any detected
group effort will be punished according the class cheating policies.
Problem 1 (20Points) : Virtual Memory
1. (6 Points) For each of the following decimal virtual addresses, compute the virtual
page number and offset for a 4-KB page and for an 8-KB page: 20000, 32768, 60000.
2. (2 Points) If an instruction takes 10 nsec and a page fault takes an additional n nsec,
give a formula for the effective instruction time if page faults occur every k instructions.
3. (2 Points) A machine has 48-bit virtual addresses and 32-bit physical addresses. Pages
are 8 KB. How many entries are needed for the page table?
4.. (6 Points) It has been observed that the number of instructions executed between page
faults is directly proportional to the number of page frames allocated to a program. If the
available memory is doubled, the mean interval between page faults is also doubled.
Suppose that a normal instruction takes 1 µsec, but if a page fault occurs, it takes 2001
µsec (i.e., 2msec to handle the fault). If a program takes 60 sec to run, during which time
it gets 15,000 page faults, how long would it take to run if twice as much memory were
available?
5. (4 Points) A computer provides each process with 65,536 bytes of address space
divided into pages of 4096 bytes. A particular program has a text size of 32,768 bytes, a
data size of 16,386 bytes, and a stack size of 15,870 bytes. Will this program fit in the
address space? If the page size were 512 bytes, would it fit? Note: a page may not contain
parts of two different segments.
pf3
pf4
pf5

Partial preview of the text

Download Homework 2 Problems for Operating Systems Design | CS 423 and more Assignments Operating Systems in PDF only on Docsity!

Homework 2: CS 423, Fall 2007

Klara Nahrstedt/Sam King

Posted: November 26, 2007

Deadline: December 3, Midnight,

Delivery: Upload the HW2 to the Compass

Important: The homework effort is an Individual Effort. Any detected

group effort will be punished according the class cheating policies.

Problem 1 (20Points) : Virtual Memory

  1. (6 Points) For each of the following decimal virtual addresses, compute the virtual page number and offset for a 4-KB page and for an 8-KB page: 20000, 32768, 60000.
  2. (2 Points) If an instruction takes 10 nsec and a page fault takes an additional n nsec, give a formula for the effective instruction time if page faults occur every k instructions.
  3. (2 Points) A machine has 48-bit virtual addresses and 32-bit physical addresses. Pages are 8 KB. How many entries are needed for the page table? 4.. (6 Points) It has been observed that the number of instructions executed between page faults is directly proportional to the number of page frames allocated to a program. If the available memory is doubled, the mean interval between page faults is also doubled. Suppose that a normal instruction takes 1 μsec, but if a page fault occurs, it takes 2001 μsec (i.e., 2msec to handle the fault). If a program takes 60 sec to run, during which time it gets 15,000 page faults, how long would it take to run if twice as much memory were available?
  4. (4 Points) A computer provides each process with 65,536 bytes of address space divided into pages of 4096 bytes. A particular program has a text size of 32,768 bytes, a data size of 16,386 bytes, and a stack size of 15,870 bytes. Will this program fit in the address space? If the page size were 512 bytes, would it fit? Note: a page may not contain parts of two different segments.

Problem 2 (20 Points) I/O

  1. (10 Points) When does it make sense that CPU checks the device’s status register repeatedly until its value signals that the I/O operation has been completed? What technique will CPU use? What are the advantages and disadvantages of this technique? Give a simple code example of the technique when CPU checks for the device’s read status.
  2. (6 Points) Disk requests come in to the disk driver for cylinders 10, 22, 20, 2, 40, 6, 38, in that order. A seek takes 6 msec per cylinder to move. How much seek time is needed for a. First-come, First-serve disk scheduling b. Shortest Seek First (SSF) c. Elevator algorithm (initially moving upward) In all cases, the arm is initially at cylinder 20.
  3. (4 Points) RAID can fail if two or more of its drives crash within a short time interval. Suppose that the probability of one drive crashing in a given hour is p. What is the probability of a k-drive RAID failing in a given hour?

Problem 4 (20 Points) Multimedia Systems

  1. (10 Points) Consider the following sequence of symbols (Note: assume that there are only 4 types of symbols ’A, ‘B’, ‘C’, ‘D’ – needed for fixed-length coding ): AAAABBBBBBBBCCCCDDAAAAAAA. What is the compression efficiency of this sequence of symbols if we use (a) Run-length coding (b) Fixed-length coding (c) Huffman coding with probabilities: P(A) = 11/25, P(B) = 8/25, P(C) = 4/25, P(D) = 2/
  2. (5 Points) Consider the two alternative file placement organization strategies for multimedia files: (a) small block model and (b) large block model. In (a) disk block is smaller than the average video frame size. In (b), disk block is larger than the average video frame and multiple video/audio/text information fit into one disk block. The small block model is also called constant time length because we store all multimedia data blocks that belong to multimedia data frames played in a constant time unit (e.g., 1 second). The large block model is called constant data length because we store all multimedia data frames into data blocks of the same size (e.g., 256 KB block size). Does the shift toward HDTV favor either of these systems over the other? Explain clearly what the trade-offs are.
  3. (5 Points) A small video server has 8 movies. What does the Zipf’s law predict as the probabilities for the most popular movie, second most popular movie and so on down to the least popular movie?

Problem 5 (20 Points) Multiprocessor Systems

  1. (5 Points) In DSM system, when a page fault occurs, the needed page has to be allocated. List two possible ways to find the page.
  2. (8 Points) Some multi-computers allow running processes to be migrated from one node to another. Is it sufficient to stop a process, freeze its memory image and just ship that off to a different mode? Name two non-trivial problems that have to be solved to make this work.
  3. (7 Points) Describe briefly the concept of MapReduce and then give one major advantage and one major disadvantage of the MapReduce system. Explain two specific applications where MapReduce provides a great benefit.