






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







CS 414 Operating Systems, Spring 2007 March 8 th , 2007 Prof. Hakim Weatherspoon Name: __________________________________NetId/Email:___________________________ Read all of the following information before starting the exam: Write down your name and NetId/email NOW. This is a closed book and notes examination. You have 90 minutes to answer as many questions as possible. The number in parentheses at the beginning of each question indicates the number of points given to the question; there are 100 points in all. You should read all of the questions before starting the exam, as some of the questions are substantially more time consuming. Write all of your answers directly on this paper. Make your answers as concise as possible****. If a question is unclear, please simply answer the question and state your assumptions clearly. If you believe a question is open to interpretation, then please ask us about it!
Problem Possible Score
e. (2 points) Why would two processes want to use shared memory for communication instead of using message passing? Performance. Communicating via shared memory is often faster and more efficient since there is no kernel intervention and no copying. f. (2 points) What is internal fragmentation? External fragmentation? Give a brief example of each. Internal fragmentation: allocated space that is unused. For example, a process may have allocated a 1KB page, but uses only 10 bytes. External fragmentation: unallocated “free” space that lies between allocated space such that contiguous regions of free space is insufficient to satisfy subsequent space allocation requests even though sufficient free space exists in aggregate. g. (6 points) For each of the following thread state transitions, say whether the transition is legal and how the transition occurs or why it cannot. Assume Mesa-style monitors. i) (2 points) Change from thread state BLOCKED to thread state RUNNING Illegal. The scheduler selects threads to run from the list of ready (or runnable) threads. A blocked thread must first be placed in the ready queue before it can be selected to run. ii) (2 points) Change from thread state RUNNING to thread state BLOCKED Legal. A running thread can become blocked when it requests a resource that is not immediately available (disk I/O, lock, etc). iii) (2 points) Change from thread state RUNNABLE to thread state BLOCKED Illegal. A thread can only transition to BLOCKED from RUNNING. It cannot execute any statements when still in a queue (i.e. the ready queue). EXTRA CREDIT h. (3 points) Suppose you have a concurrent system with locks: Lock.acquire() blocks until the Lock is available and then acquires it. Lock.release() releases the Lock. There is also a Lock.isFree(), that does not block and returns true if the Lock is available; otherwise, returns false. What can you conclude about a subsequent Lock.acquire(), based on the result of a previous call to Lock.isFree()? Nothing. A separate thread could acquire the Lock in between the two calls. This is why we don't implement Lock.isFree().
We took points off for problems a, b, and c for the following reasons:
We took points off for the following reasons: