98/59.305

ALB

Massey University

Albany


EXAMINATION FOR 59.305 OPERATING SYSTEMS

SEMESTER ONE – 1998






Time Allowed: THREE (3) hours

Answer ALL questions


THE USE OF CALCULATORS IS PERMITTED.




1. (a) Briefly describe the operation of an interrupt handler in an operating system.

[4 marks]


(b) Why is the CPU switched to supervisor mode when a user program makes a system call?

[2 marks]


(c) Briefly explain the difference between a Monolithic and Microkernel based Operating System.

[4 marks]




2. (a) Draw a diagram showing the possible states for a process.

[3 marks]


(b) If a process is not allowed to move directly from the running state to the ready state, what can you say about the operating system?

[2 marks]


(c) Show on your diagram from part (a) which transitions would cause scheduling decisions to be made for an OS using SRTF scheduling.

[2 marks]



3. (a) Threads do not share a common stack, why is this?

[2 marks]


(b) Suggest a simple mechanism for communication between threads that does not use a system call give a simple example.

[3 marks]


(c) The following processes are to be scheduled


Process

Arrival Time(ms)

Burst Time(ms)

p1

0

20

p2

5

25

p3

10

5


What is the average waiting time for these processes when using the following scheduling algorithms?


(i) FCFS

(ii) SJF

(iii) SRTF (preemptive SJF)

(iv) RR with a time quantum of 10ms

[8 marks]




4. (a) What is a race condition?

[2 marks]


(b) The following algorithm is an attempt at solving the critical section problem for two processes. Briefly explain why this is not a good solution.


bool flag[2];
flag[0]=flag[1]=FALSE;

void p(i) { /* i is the process no (0 or 1) */
  int j=1-i; /* j is no of the other process */
  while(TRUE) {
    flag[i]=TRUE;
    while(flag[j])do_nothing;
    critical section
    flag[i]=FALSE;
    remainder section
  }
}

[4 marks]


(c) How is a semaphore initialised if it is to be used for mutual exclusion?

[2 marks]


(d) If a semaphore has a value of -5, what does this mean?

[2 marks]




5. Choose three of the following topics. Write brief descriptions of the topics you have chosen. Assume you are explaining the topic to a computer science graduate who has not heard of the topic but has a good understanding of general Operating System principles.


(i) Livelock

(ix) The UNIX 'select' system call

(ii) Win32 Threads

(x) Programming with sockets

(iii) NTFS

(xi) ANDF

(iv) RAID

(xii) The POSIX standard

(v) Pentium Memory Management

(xiii) QNX

(vi) Amoeba

(xiv) The OSF DCE

(vii) Plan 9

(xv) The NOW Project

(viii) Linux Scheduling

(xvi) Load Balancing

[12 marks]



6. (a) Consider the following system which has three resource types A,B and C. There are 2 instances of A, 6 instances of B and 4 instances of C.



Allocation

Maximum

Process

A B C

A B C

p1

0 2 1

1 3 1

p2

1 0 0

1 3 1

p3

0 2 1

0 4 3

p4

1 1 2

1 2 4

(i) Is this system in a safe state? Use the safety algorithm to prove your answer.

[4 marks]


(ii) If p3 now releases 1 instance of resource C is the system safe? Use the Resource-Request algorithm to prove your answer.

[4 marks]



7. (a) Give brief definitions of the following terms:


(i) Thread Safe

(ii) Dynamic Linking

(iii) Atomic Transaction

(iv) Belady's anomaly

(v) Condition Variable

(vi) Critical Section

(vii) Multilevel Queue Scheduling

(viii) Disk Scheduling

(ix) Capability

(x) Demand Paging

[10 marks]


+ + + + + + + + + +