=========================preview======================
(COMP252)[2009](f)midterm~724^_10189.pdf
Back to COMP252 Login to download
======================================================
HONG KONG UNIVERSITY OF SCIENCE & TECHNOLOGY
Operating System (COMP 252)
Fall Semester, 2009
Midterm Examination
October 24, 2009
Name: Student ID:
Email: Lab Section Number:
Instructions:
1.
This examination paper consists of 9 pages, with 6 questions.
2.
Please write your name, student ID, email and lab section number on this page.
3.
Please answer all the questions in the spaces provided on the examination paper.
4.
Please read each question very carefully, answer clearly and to the point. Make sure that your answers are neatly written.
5.
Keep all pages stapled together.
6.
The examination period will last for 2 hours.
7.
Stop writing immediately when the time is up.
8.
Please fill in your student ID at the top of every page.
Question
Percentage %
Scores
1
12
2
28
3
20
4
10
5
14
6
16
TOTAL
100
Question 1 OS Fundamental and Structure (12 points)
(a) Programs must be in main memory to be executed, since main memory is the only large storage area that the processor can access directly. However, most computer systems also provide secondary storage as an extension of main memory. Please compare the main memory and secondary storage in terms of storage capacity and volatility. (4 points)
Answer:
Main memory is relatively small and volatile; while secondary storage provides larger storage capacity, and nonvolatile.
(b) The Dual-mode operations design provides protection to the operating system. Please list the two modes of Dual-mode operation? Some instructions that may cause harm to operating system are defined as privileged instructions, please indicate in which mode the privileged instructions are allowed to be executed? (4 points)
Answer:
User mode & Kernel mode.
Kernel mode.
(c) What is the usage of system calls? What is the advantage to invoke system calls via high-level Application Programming Interface (API)? (4 points)
Answer:
System calls allow user-level processes to request services of the operating system.
API provides better program portability; system calls are often more detailed and difficult to work.
Question 2 Process and Thread (28 points)
(a) What are the three Multithreading Models (Hint: user-level threads and kernel threads mapping)? Which of them can provide the maximum level of concurrency? (4 points)
Answer:
1)
many-to-one, one-to-one, many-to-many (3 points)
2)
one-to-one(1 point)
(b) List all the possible states of a process. (3 point) List the four main steps which are invoked by a parent process when it spawns a child process? (3 points)
Answer:
1) new, running, waiting, ready, terminated
2) Construct a new PCB for the child process; allocate address space for the