

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


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)
Assume that the arrival times and run times of jobs are as follows: job arrival-time run-time
CS 162MIDTERM 1FALL 1996 Prof. Alan Jay Smith 1
a. Show the sequence of executions and compute the mean flow time for the following scheduling algorithms (15): i. FIFO 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)
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)
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
Problem #2 2