Preventing Deadlock - Operating Systems and System Programming - Solved Exams, Exams of Operating Systems

Main points of this past exam are: Preventing Deadlock, Sentence Definition, Atomic, Deadlock, Disk Cylinder, Doubly Indirect, Contiguous Allocation, Linked Allocation, Single-Level Index, Unix Multi-Level Index

Typology: Exams

2012/2013

Uploaded on 04/02/2013

shailendra_g01d
shailendra_g01d 🇮🇳

4.7

(9)

62 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS162, Spring/1992
Midterm #2
Professor Thomas Anderson
General Information:
This is a closed book examination. You have 60 minutes to answer as many question as possible. The
number in parentheses at the beginning of each question indicates the number of points given to the question;
there are 60 points in all. Write all of your answers directly on this paper. Make your anwers as concise as
possible (you needn't cover every available nano-acre with writing).
Problem #1 (6 points)
For each of the following statements, indicate in one sentence whether the statement is true or false, and why.
(a) Binary semaphores are those that are used by no more than two threads.
Answer: False, binary semahpores contain two states 0 or 1.
(b) The Banker's algorithm is a way of preventing deadlock
Answer: True, no process is allowed into a section if deadlock is possible.
(c) A multi-level indexed file permits faster random access than a contiguously allocated file.
Answer: False, contiguous files may be easily jumped through, while the multi-level file must seek right
blocks.
Problem #2 (8 points)
For each of the following items, write a sentence definition:
(a) Atomic
Answer: An atomic function or command cannot be interrupted in between.
(b) Deadlock
Answer: A state where all threads are waiting for a resource held by another and nothing can therefore finish.
(c) Disk cylinder
Answer: The same track on all platters in a disk pack.
(d) Doubly indirect block
Answer: A block of pointers to blocks of pointers which in turn point to file blocks.
CS162, Midterm #2, Spring/1992
CS162, Spring/1992 Midterm #2 Professor Thomas Anderson 1
pf3
pf4

Partial preview of the text

Download Preventing Deadlock - Operating Systems and System Programming - Solved Exams and more Exams Operating Systems in PDF only on Docsity!

CS162, Spring/

Midterm

Professor Thomas Anderson

General Information: This is a closed book examination. You have 60 minutes to answer as many question as possible. The number in parentheses at the beginning of each question indicates the number of points given to the question; there are 60 points in all. Write all of your answers directly on this paper. Make your anwers as concise as possible (you needn't cover every available nano-acre with writing).

Problem #1 (6 points)

For each of the following statements, indicate in one sentence whether the statement is true or false, and why.

(a) Binary semaphores are those that are used by no more than two threads.

Answer: False, binary semahpores contain two states 0 or 1.

(b) The Banker's algorithm is a way of preventing deadlock

Answer: True, no process is allowed into a section if deadlock is possible.

(c) A multi-level indexed file permits faster random access than a contiguously allocated file.

Answer: False, contiguous files may be easily jumped through, while the multi-level file must seek right blocks.

Problem #2 (8 points)

For each of the following items, write a sentence definition:

(a) Atomic

Answer: An atomic function or command cannot be interrupted in between.

(b) Deadlock

Answer: A state where all threads are waiting for a resource held by another and nothing can therefore finish.

(c) Disk cylinder

Answer: The same track on all platters in a disk pack.

(d) Doubly indirect block

Answer: A block of pointers to blocks of pointers which in turn point to file blocks.

CS162, Spring/1992 Midterm #2 Professor Thomas Anderson 1

Problem #3 (8 points)

A thread can be in one of thre states: ready to run, running, or blocked. For each transition indicated below, identify under what circumstances it occurs:

(a) ready -> running

Answer: Another thread is blocked, finishes, or yields to this thread.

(b) running -> ready

Answer: Thread yields to another

(c) running -> blocked

Answer: Thread has to wait on condition or lock.

(d) blocked -> ready

Answer: Thread is signaled or lock is released. Condition is met.

Problem #4 (8 points)

The Demos system employs a clever block group indexed scheme for file allocation on disk. State the principle advantage of this scheme compared to each of the following, and justify your answer:

(a) contiguous allocation

Answer: Easier to increase size, allocate another block.

(b) linked allocation

Answer: Easier to access randomly, use indexes

(c) a single-level index

Answer: Easier to handle big files, use BIGFILE condition and indirect block.

(d) a UNIX multi-level index

Answer: Fewer seeks, use bitmap.

Problem

(a)

(b)

Answer:

void answerBegin() { speak.acquire;

Problem #3 (8 points) 2

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 mailto:[email protected]

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