Docsity

CS162 Fall 2004 Midterm 1 Exam, Exams of Operating Systems

Partial preview of the text

Download CS162 Fall 2004 Midterm 1 Exam and more Exams Operating Systems in PDF only on Docsity!

CS162 Fall 2004 Professor Alan Jay Smith

Midterm 1, Monday, October 11, 2004

(Total Points Possible: 100)

  1. What's an inverted page table? What are the relationships between the size of the inverted page table, the size of the virtual address space, and the size of the physical address space? (14)
  1. Suppose that you have an architecture with a base register (for relocation) but no bounds register. What is the advantage of this design relative to a system with no base register? What is the disadvantage of this design relative to a system with both base and bounds registers? (14)
  1. For the following two cases, please either show a complete safe sequence or prove that there isn't one: (12)

Process has-X has-Y max-needs-X max-needs-Y A 35 10 65 40 B 55 80 105 220 C 35 20 110 50 D 0 70 50 90

(a) available: X: 40 Y: 40 (b) available: X: 40 Y: 35

  1. Prove that Shortest Job First is optimal (minimum average time to completion, averaged over all of the jobs) in a system which starts with exactly N jobs, each of whose run times are known, and no which no further jobs arrive. (16)
  1. Assume that we have atomic operations: [increment value in memory, and then load the result] and [decrement value in memory].

The following "code" was given in lecture to obtain mutual exclusion for a critical section. What's wrong with it? Please explain. (13)

Init: A = 0

loop: {increment A in memory, load A}, if A~=1, then {decrement A in memory}, go to loop

critical section here

{decrement memory location A}