CSE3303 (Operating Systems) MT2 - Group A
Dec 15, 2007

Q1 (10 pts): Fix the following NYU object file. Some words/numbers may be missing, some may be extra, and some may be wrong. There are multiple ways to fix it. Rewrite the object code on your answer sheet. Cross what needs to be deleted and circle things you have added. Also show the end of Definitions part as well as Calls part.

xy 3 yz 4 1
 xz 3 -1
4 I 1004  A 5678  R 2002  I 8002 R 
2001

Answer:

2 xy 3 yz 4 / 1
 xy 3 -1 /
5 I 1004  A 5678  R 2002  E 8002 R
2001

Q2 (15 pts): Link the following and give me the memory map and symbol table of the executable.

1 baba 4
1 anne 3 -1
5 I 3014  R 7001 A 2345  
E 2002  R 8004 0 2 baba 3 1 -1 kid 2 -1
4 R 6002  E 1000  E 3002  E 3000  2 kid 1 anne
 3 1 kid 1 2 -1 
4 A 5000  E 1001  E 3010 I 2020

Q3 (20 pts): Consider the following snapshot of a system:

     Alloc    Max      Avail
P1  0 0 0 1  4 5 6 2  1 3 2 3
P2  1 1 2 0  4 5 6 2
P3  1 1 2 0  2 4 3 2
P4  1 0 0 0  3 4 3 3

Let's call the resource types R4, R3, R2, R1 from left to right. P1 is asking for one more R1. (a) Apply Banker's algorithm and show that I should not grant P1 one more R1. (b1) What is the minimum number of resources (in total) I can add to the system to make P1's request safe.

Q4 (15 pts): Consider 4 dining philosophers in a circle -- numbered 3 through 0 from left to right. We will coordinate their eating with an arbiter. Each philosopher eats for 2 mins non-stop when he eats. The arbiter uses a mix of a queue scheme and a fixed-priority (FP) scheme. 2 has the highest priority and the rest are arbitrated based on a "queue". The not-hungry times are 0102. The arbiter makes a decision in the middle of every minute. Assume that they all came to the table from a restaurant. Show the progression of events for 12 minutes. H stands for hungry and waiting. e for 1st min and E for 2nd min eating. [1-2] for not-hungry. Assume that the queue is 134 initially.

Q5 (10 pts): There are 2 processes that process packets: process A and B. Every once in a while, process A receives a burst of 8 packets from outside and it has a buffer for exactly 8 packets. Process A either receives the 8 packets as a whole or declines the transfer. For efficiency purposes, the 2 processes process packets in groups of multiple packets. Process A processes 3 packets at a time and produces 2 packets and sends them to process B. Process B processes 2 packets at a time and sends 1 result packet to process A. Process B has a considerably large buffer. Show the sequence that leads the two processes that leads to deadlock. (Hint: They get into deadlock within less than 10 steps.)

Q6 (5 pts): Which one of the below is FALSE in regards to BIOS?
(a) BIOS is an adaptation layer for a motherboard.
(b) BIOS sits on a non-volatile memory such as ROM or flash.
(c) BIOS sits on the upper part of the primary HD.
(d) BIOS is where the CPU finds some basic access routines.
(e) BIOS is a basic input/output software.

Answer: c

Q7 (5 pts): Banker's algorithm is for
(a) making deadlocks impossible under all cases
(b) making deadlocks impossible due to resource conflicts
(c) discovering deadlocks
(d) breaking deadlocks
(e) resource locking

Answer: b

Q8 (5 pts): Which one of the below is FALSE in regards to semaphores?
(a) A mutex is a type of semaphore.
(b) Semaphores are used to prevent multiple threads to enter their critical sections simultaneously.
(c) Semaphores are used to properly lock common resources in the presence of race conditions. (d) Dekker's algorithm does the same job a semaphore does for 2 or more threads and is CPU-efficient.
(e) Concurrent database server transactions that use semaphores to lock tables.

Answer: d

Q9 (5 pts): One advantage of multi-threaded server-side code development is NOT
(a) using OS to time-share the CPU between client transactions.
(b) speeding up applications through multi-tasking.
(c) speeding up applications through utilizing multiple CPU cores in parallel.
(d) to use less memory in in programs.
(e) to prevent one client from blocking others.

Answer: d

Q10 (5 pts): Which of the following is FALSE?
(a) Intel's protected-mode CPUs include a dual mode capability.
(b) Real-mode is a legacy mode included in Intel's protected-mode CPUs.
(c) A protected-mode Intel processor is simply a dual mode CPU. (d) Kernel mode is a subset of dual mode.
(e) Kernel mode is included in Intel's protected-mode.

Answer: c

Q11 (5 pts): Which of the following is FALSE for the Dining Philosophers Problem?
(a) Only one process should be able to lock a resource.
(b) Deadlock should be made impossible.
(c) Starvation should be made impossible.
(d) Simultaneous eating of two processes should be avoided.
(e) Average wait-time should be minimized.

Answer: d

Q12 (5 pts): Below for ex. A→B indicates process A is waiting for process B to release a resource. Assuming all processes are batch processes, which system below is NOT in a complete or partial deadlock?
(a) A→B, B→C, C→D, D→A.
(b) B→A, D→C, A→C, C→B.
(c) B→A, A→B, A→C.
(d) B→A, D→C, A→C, B→C.
(e) A→C, B→C, C→B, C→A.

Answer: d