=========================preview======================
(comp252)[2008](f)final~PPSpider^_10187.pdf
Back to COMP252 Login to download
======================================================
COMP 252 Operating Systems
Fall Semester 2008
Final Examination Solution
Time/Date: 8:30 C 10:30 am Dec 17, 2008 (Wednesday)
Venues: G017 for L1 and LG4204 for L2
Name: ____________________ Student ID: __________________
Email: ____________________ Lecture Section: ______________
Instructions:
1. Please write your name, student ID, and section number on this page. E-mail is optional.
2. This is a CLOSED book exam!
3. This examination paper consists of 7 questions and 10 pages (including this page).
4. You have 120 minutes to complete this exam.
5. Please answer all questions within the space provided on the paper. Be concise!
6. Please read each question very carefully and answer the question clearly to the point. Make sure that your answers are neatly written, legible, and readable.
Question
Points
Score
1
13
2
23
3
24
4
10
5
20
6
5
7
5
Total
100
1. (13 pts) Please answer the following questions in 2-3 sentences
1.1 (2 pts) What are the four necessary conditions for deadlocks?
Answer: Mutual exclusion, hold and wait, no preemption, and circular wait. (0.5 pt each)
1.2 (2 pts) What is an atomic operation?
Answer: an operation that runs to completion (2 pts), or without interrupts or being interleaved
1.3 (2 pts) Many CPU scheduling algorithms such as SJF and SRTF rely on the next CPU burst length. In reality, the next CPU burst length might not be known prior. How do we resolve this issue?
Answer: Using historic information (1 pt) to estimate (1 pt) the next CPU burst length. No need to mention the Exponential Averaging algorithm explicitly.
1.4 (2 pts) In a priority based scheduling algorithm, such as SJF (shorter job has higher priority) scheduling, potential starvation can occur for lower priority jobs. What is the common mechanism to deal with potential starvation for lower priority jobs? Please briefly explain your answer.
1.5 (2 pts) Can you list at least three elements that are unique to each thread in a multi-thread process system?
Answer: program counter, registers, TCB, stack, private data (1 pt for the first, 0.5 pt for the additional)
Answer: This is generally undesirable because the CPU could be doing useful work otherwise (1 pts). This behavior may be desirable under conditions when we know that the process (usually a kernel process) will not be waiting for a long time for the I/O operation to complete and that the process must respond to the completion quickly (within a few processor instructions) (2 pt). Or it can be argued that when I/O can be completed shortly, thus no need to do context switch.
2.1 (3 pts) Consider a single-level paging scheme with a tr