Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Operating Systems and Networking CS330 Spring 2007 Exam Questions - Prof. Saumendra Sengup, Exams of Operating Systems

A list of five questions from an operating systems and networking exam held in spring 2007 for cs330 students. The questions cover topics such as cpu scheduling, i/o utilization, mutual exclusion, and semaphore usage. Students are required to answer only five questions within the allotted time of 1 hour and 50 minutes.

Typology: Exams

Pre 2010

Uploaded on 08/09/2009

koofers-user-8r7-1
koofers-user-8r7-1 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Test 2
Operating Systems and Networking
CS330
Spring 2007
Answer only five from the following
Allotted time: 1 hr and 50 minutes
Date: March 19, 2007
Policy: Open notes, text and reference books.
1. CPU periodically receives data from devices like keyboard, mouse, network interface card, etc. To
figure out if there’s any data from a device for CPU, it must employ some method like periodic
polling from CPU or interrupt from the device to CPU. Briefly discuss when one is more efficient
than the other.
2. For a system of interest, assume the context switching time in a RR system is negligible. Each
process when it arrives at CPU gets
units of time-slice. Will I/O utilization increase or
decrease if
is increased? State your rationale.
3. Consider the same system as outlined in the previous question. If
is reduced, will the reduction
cause some programs to take longer times to finish? Why, or why not?
4. In the lecture, it was pointed out that a busy-waiting by a process to get into its critical section
should generally be avoided, if possible. Indicate why. Could there be any situation, however,
where busy-waiting might not be all that bad? Indicate how.
5. The two processes shown below access a shared printer to do their print tasks via a semaphore S
which is initialized to 0. It is conjectured that the following output strings are either individually
valid or invalid when the two processes are run concurrently. Mark the output strings either as
valid or invalid strings.
Process P: Process Q:
{ …. { ….
while (TRUE) while (TRUE)
{ {
wait(S); signal(S);
print(P); print(Q);
} }
} // end_P } // end_Q
Possible output claims are:
A) QPQPQPQP B) QQQPPQPP
C) PQPQPQPQ D) QPPPQPQQ
6. Consider the following situation. Peter, Paul and Mary are all distinguished members of Caribbean
Pirates Unconventional. Three of them share a treasure chest which contains valuable trinkets and
gold coins. Periodically, though, Peter and Paul steals from the chest (naturally without anybody’s
knowledge) to purchase rum and cigars when they run out of money without alerting anyone in the
group. Mary has an inkling of what’s going on, but she has decided not to open her mouth and
create even a bigger problem. Every time she has some valuable to store into the chest she does so
without letting any of her partners know.
pf2

Partial preview of the text

Download Operating Systems and Networking CS330 Spring 2007 Exam Questions - Prof. Saumendra Sengup and more Exams Operating Systems in PDF only on Docsity!

Test 2

Operating Systems and Networking

CS

Spring 2007

Answer only five from the following Allotted time: 1 hr and 50 minutes Date: March 19, 2007 Policy: Open notes, text and reference books.

  1. CPU periodically receives data from devices like keyboard, mouse, network interface card, etc. To figure out if there’s any data from a device for CPU, it must employ some method like periodic polling from CPU or interrupt from the device to CPU. Briefly discuss when one is more efficient than the other.
  2. For a system of interest, assume the context switching time in a RR system is negligible. Each

process when it arrives at CPU gets  units of time-slice. Will I/O utilization increase or

decrease if  is increased? State your rationale.

3. Consider the same system as outlined in the previous question. If  is reduced, will the reduction

cause some programs to take longer times to finish? Why, or why not?

  1. In the lecture, it was pointed out that a busy-waiting by a process to get into its critical section should generally be avoided, if possible. Indicate why. Could there be any situation, however, where busy-waiting might not be all that bad? Indicate how.
  2. The two processes shown below access a shared printer to do their print tasks via a semaphore S which is initialized to 0. It is conjectured that the following output strings are either individually valid or invalid when the two processes are run concurrently. Mark the output strings either as valid or invalid strings. Process P: Process Q: { …. { …. while (TRUE) while (TRUE) { { wait(S); signal(S); print(P); print(Q); } } } // end_P } // end_Q Possible output claims are: A) QPQPQPQP B) QQQPPQPP C) PQPQPQPQ D) QPPPQPQQ
  3. Consider the following situation. Peter, Paul and Mary are all distinguished members of Caribbean Pirates Unconventional. Three of them share a treasure chest which contains valuable trinkets and gold coins. Periodically, though, Peter and Paul steals from the chest (naturally without anybody’s knowledge) to purchase rum and cigars when they run out of money without alerting anyone in the group. Mary has an inkling of what’s going on, but she has decided not to open her mouth and create even a bigger problem. Every time she has some valuable to store into the chest she does so without letting any of her partners know.

The CPU is a technologically advanced organization. Consequently, their treasure chest is accessed only through a monitor. The three threads depicting our three heroes are indicated below: condition t; // trinket condition lock on chest; Peter and Paul: Get lock on chest; trinket = monitorCPU.delete(chest); Release lock; Mary: Get lock on chest; monitorCPU.insert(chest, trinket); Release lock; However, the threads are somehow not abiding by some mutual exclusion condition honored even among thieves. Correct the thread scripts (using a minimum number of corrections) so that they work.

  1. You see the following two routines advanced by a CS330 student to describe a cooperation scenario between two processes: A: {wait(x); signal(y)} and B: {wait(y); signal(x)} Comment on their correctness given that x and y are semaphores.
  2. Consider a system with three resource types A, B, and C (5 A type resources, 10 B type resources and 15 C type resources). Three processes P, Q and R are in the system. Current allocation, maximum needs and total available resources are indicated below. Indicate if this system can proceed to a safe state. Is it deadlocked? Explain your reasoning. Allocation Max Needs Currently Available A B C A B C A B C P 2 3 4 3 8 7 1 4 7 Q 1 2 3 3 4 5 R 1 1 1 1 2 9
  3. In a system of n processes, a subset m of these processes is currently suffering indefinite postponement. Is it possible for the system to determine which processes are being indefinitely postponed? If yes, state how. If no, state what reasonable safeguards should be included in the operating system to deal with indefinite postponement situations.