Arrival Times - Operating Systems and System Programming - Exams, Exams for Operating Systems. Central University of Jammu and Kashmir
shaina_44kin2 April 2013

Arrival Times - Operating Systems and System Programming - Exams, Exams for Operating Systems. Central University of Jammu and Kashmir

PDF (183 KB)
3 pages
1000+Number of visits
Main points of this exam paper are: Arrival Times, Substantially More, More Time Consuming, Interpretation, Fifo, Deadlock Problem, Deadlock Detection, Banker'S Algorithm, Semaphore Fullsem, Numcoke Number
Download points needed to download
this document
Download the document
Preview3 pages / 3
Download the document
CS 162, MIDTERM 1, FALL 1996

CS 162


FALL 1996

Prof. Alan Jay Smith

You have until the end of class for this exam. The exam is closed book. All answers should be written on the exam paper. Anything that we can't read or understand won't get credit. Any question for which you give no answer at all will receive 25% partial credit. Please answer in standard English; illiterate or illegible answers to essay questions will lose credit. Please watch the front board for corrections and other informations. This exam has 6 questions on 7 pages and is in two parts.

Problem #1 The state of a system is as shown. (There are 3 processes, A, B and C. There are two resources.)

process Allocated Max_need

A 10 15 30 20

B 0 30 40 75

C 20 10 30 35

available: 15 30

Determine if this system is in a safe state. Show your work (12)

Problem #2 Assume that the arrival times and run times of jobs are as follows:

job arrival-time run-time

CS 162, MIDTERM 1, FALL 1996

CS 162MIDTERM 1FALL 1996 Prof. Alan Jay Smith 1

A 0 5

B 0.5 3

C 1.5 0.5

a. Show the sequence of executions and compute the mean flow time for the following scheduling algorithms (15):


ii. SET (Q--->0; i.e. processor sharing)

iii. SRPT

b. Now assume that the system is non-preemptive. You have future knowlege. What the schedule (of all possible schedules, not just the algorithms from part (a) that minimizes the mean flow time? (5)

c. Still assuming that the system is non-preemptive, and you have future knowlege, let there be two CPUs (processors). What is the schedule that minimizes the mean flow time now? Compute the mean flow time. (5)

d. Now assume that preemption is permitted, and that there are two processors. Show the schedule that minimizes the time to completion (i.e. until all jobs are done) (5)

Problem #3 Suppose C is augmented with P,V, and Conditional-P. Conditional P tries to decrement the semaphore, if it is not legal (i.e. Sem = 0), then it returns FALSE, if it is legal, it does it and returns TRUE.

a) What is useful about Conditional-P? (6)

b) Can it be used to avoid deadlocks in all cases? (Why/Why not, be careful to state your assumption). (6)

Problem #4 Assume a Coca-Cola machine exists. Assume there are many people who drink Coca-Cola and many people who stock the machine with Coca-Cola (21). Write functions for the 'Stockers' and the 'Drinkers', using P() and V(). Properly synchronize your code so that only *one* stocker or drinker can have access to the coke machine at

CS 162, MIDTERM 1, FALL 1996

Problem #2 2

a given time.

Correctness constraints: 1) Drinkers can only drink if there is a coke in the machine. 2) Stockers only stock the machine when it is completely empty.

Assume there are NUMCOKE number of coke slots in the machine.

Semaphore mutex = 1; Semaphore emptySem = 0; Semaphore fullSem = NUMCOKES;

Problem #5 Under what circumstances is FIFO a better scheduling algorithm than SET? Explain (10).

Problem #6 The following "solutions" to the deadlock problem were described in class. Explain the disadvantages to each (15): a. deadlock detection and recovery

b. make all processes obtain their resources in the same order

c. banker's algorithm

Posted by HKN (Electrical Engineering and Computer Science Honor Society) University of California at Berkeley

If you have any questions about these online exams please contact [email protected]

CS 162, MIDTERM 1, FALL 1996

Problem #4 3

comments (0)
no comments were posted
be the one to write the first!
Download the document