CSC 4103 - Operating System

Dr. Xian-He Sun

Answer of Sample Exam #1

Name ___________________________________( Last, First )

Score _________________________ (100 pts.)

Make sure there are ten problems. Read each problem very carefully before answering it. Try to make your answer short and clear.

1. Define operating systems in terms of what they do? (5 pts.)

Their primary goal is convenience of the user; the secondary goal is efficient operation and allocation of all resources.

2. What is process? (5 pts.)

A program in execution.

3. How is an interrupt executed? (5 pts.)

The I/O driver send a signal through a special interrupt line to the CPU when it has finished with an I/O request.

4. What are the five major intellectual achievement of OS development? (5 pts.)

Process, Memory management, Information protection and security, Scheduling and resource management, System structure

5.What is multiprogramming? (5 pts.)

In multiprogramming, several programs are in memory concurrently; the system switches among the programs for efficient processing, and minimal idle time.

6. Define the difference between preemptive and nonpreemptive scheduling? (6 pts.)

Preemptive scheduling allows a process to be interrupted in the midst of its execution, taking the CPU away and allocating it to another process. Nonpreemptive scheduling ensures that a process relinquishes control of the CPU only when it finishes with its current CPU burst.

7. What is FCFS? What is SJF? What is RR? ( 9pts.)

First-Come-First-Serve, Shortest Job First, Round-Robin

8. Semaphore is a tool of process synchronization. Critical region is a high-level language construct for process synchronization. Transform the 'wait' and 'signal' operation on a semaphore 'S' into equivalent critical regions without busy waiting. (20 pts.)

This problem is a part of Homework 6.9

Wait(S): Region S when S>0 do S := S - 1

Signal(S): Region S do S := S +1;

9. Consider the following snapshot of a system answer the following questions using the banker's algorithm

( show your work, 20 pts.)

Process

Allocation

Max

Available

 

A B C D 

A B C D 

A B C D

P1

0 0 1 2

0 0 1 2

1 5 2 0

P2

1 3 5 4

2 3 5 6

 

P3

0 6 3 2

0 6 5 2

 

P4

1 0 0 0

1 7 5 0

 

P5

0 0 1 4

0 6 5 6

 

(a) Is the system in a safe state?

(b) If a request from process P4 arrives for (0, 4, 2, 0) can the request be granted immediately?

See homework 7.11

10. Mutual exclusion can be provided by using Lock and Unlock functions as follows

Lock(gate);

critical section;

Unlock(gate);

(a) Use hardware instruction Swap to implement the function Lock and Unlock. (15 pts.)

(b) Does your implementation satisfy the Bounded Waiting requirement? If it does not, give a solution which satisfies this requirement. (10 pts.)

See figure 6.7 and 6.8 of the text.