=========================preview======================
(COMP3511)[2012](f)midterm~=cfemueo^_71317.pdf
Back to COMP3511 Login to download
======================================================

COMP 3511 Operating Systems
Fall Semester 2012
Midterm Examination

Date: November 5, 2012 (Monday) Time: 7:00 - 9:00 pm

Name: ____Solutions_________ Student ID: __________________
Email: ____________________ Lecture Section: ______________



Note: Please write your name, student ID, and email address on this page. Read the following instructions carefully.
1. This is a CLOSED book exam!

2. This examination paper consists of 6 questions and 10 pages (including this page).

3. You have 120 minutes to complete this exam.

4. Answer all questions within the space provided on the examination paper. You may use back of the pages for your rough work. Be concise! This is NOT an essay contest.

5. Please read each question very carefully and answer the question clearly to the point.

6. Make sure that your answers are neatly written, legible, and readable.

7. Show all the steps used in deriving your answer, wherever appropriate.




Question
Points
Score

1
12


2
27


3
21


4
18


5
16


6
6


Total
100







Question 1: Operating System Basics (12 points)

1) What are the main purposes of an operating system? (4 points)



User convenience: to provide an environment for a computer user to execute programs on computer hardware in a convenient and efficient manner. (2pts)
Resource allocation: to allocate the separate resources of the computer in a fair and efficient manner (CPU, main memory and etc.). You can also view an OS as a control program, which controls the program execution, prevents users from misusing the resources and handling I/O. (2pts)

2) What is user mode and kernel mode? Why does OS need to distinct these two modes? (4 points)



These are types of execution modes in an operating system.
User mode: conventional operating mode for user apps, which have restricted privileges for what they can do on the system. (1pt)
Kernel mode: provides raw access to physical hardware for the OS; process has full privileges for what it can do on the system. (1pt)
Reason:
Such dual-mode operation allows OS to protect itself and other system components and prevent users from misusing the resources. (2pts)
3) When a process creates a new process using the fork() operation, which of the following state is shared between the parent process and the child process? Please briefly explain why. (4 points)



a. Stack
b. Heap
c. Shared memory segments

Only c) shared memory segments are shared between the parent process and the newly forked child process. (2pts)
a) Copies of the stack and b) heap are made for the newly created process. (2pts)





Question 2: Process and Threads (27 points)

1) As a process executes, it changes state. Fill in the blanks to finish the diagram of process state. (Fill state names in 4, 5 and transition conditions in 1,