Mathematics for Computer Engineering

advertisement

Operating Systems

MSc. (CS) Dept. of Computer Science

Khon Kaen University

Semester 2, 2003-2004

Exercises 3

Due in : Monday, February 16th, 10:00am , by e-mail to dandrew@ratree.psu.ac.th

Worth : 10% of final grade. Marked out of 50. Each question is worth 10 marks.

If there is a problem with e-mail then your answers should be printed out and handed into the CS main office by 9.00am

. Make sure that the office secretary writes the time on your answer paper.

Write in English. Include your name, student number, and “Operating Systems.

Exercises 3” at the top of the answers. Do not write out the questions as part of your answers.

Late submissions will lose half marks immediately, and a further 10 marks for each hour after that. Cheating will result in 0 marks for all those involved .

If you have any questions, please send me e-mail. Good luck  .

- Andrew Davison

1.

(Similar to Question 9.5, p.331, S&G, 5th ed.)

Suppose we have a demand-paged memory. The page table is held in registers. It takes 6 milliseconds to service a page fault if an empty page is available or the replaced page is not modified, and 16 milliseconds if the replaced page is modified.

Memory access time is 95 nanoseconds.

Assume that the page to be replaced is modified 90 percent of the time.

What is the maximum acceptable page-fault rate for an effective access time of no more than 150 nanoseconds? Show your working.

2. (Similar to Question 9.11, p.333, S&G, 5th ed.)

Consider the following page reference string:

6, 3, 2, 1, 2, 3, 6, 7, 3, 2, 1, 2, 6, 5, 1, 2, 4, 3, 2, 1.

How many page faults would occur for the following replacement algorithms, assuming one, two, three, four, five, six, or seven frames? Remember that all frames are initially empty, so your first unique pages will all cost one fault each. a) LRU replacement b) FIFO replacement c) Optimal replacement

Note: show your working. Remember there are 7 different cases to consider for each part.

Operating Systems. Exercises 3

3. (Similar to Question 11.1, p.392, S&G, 5th ed.)

Consider a file currently consisting of 52 blocks. Assume that the file control block

(and the index block, in the case of indexed allocation) is already in memory.

Calculate how many disk I/O operations are required for contiguous, linked, and indexed (single-level) allocation strategies, if, for one block, the following conditions hold.

In the contiguous allocation case, assume that there is no room to grow in the beginning, but there is room to grow in the end. Assume that the block information to be added is stored in memory. a) The block is added at the beginning. b) The block is added in the middle. c) The block is added at the end. d) The block is removed from the beginning. e) The block is removed from the middle. f) The block is removed from the end.

4. (Question 12.7, p.429, S&G, 5th ed.)

UNIX coordinates the activities of the kernel I/O components by manipulating shared in-kernel data structures, whereas Windows NT uses object-oriented message passing between kernel I/O components.

Discuss three pros and three cons of each approach.

5. (Similar to Question 13.2, p.448, S&G, 5th ed.)

Suppose that a disk drive has 5000 cylinders, numbered 0 to 4999. The drive is currently serving a request at cylinder 143, and the previous request was at cylinder

125. The queue of pending requests, in FIFO order, is

509, 186, 470, 1213, 774, 922, 150, 130, 998.

Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy all the pending requests, for each of the following disk scheduling algorithms? a) FCFS b) SSTF c) SCAN d) LOOK e) C-SCAN

Note: show your working.

2

Download