cs4410-fall2010-prelim2 - CS 4410 Operating Systems Prelim...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 4410 Operating Systems Prelim II, Fall 2010 Prof. Sirer Name:___________________________________ NETID:_________________ This is a closed book examination. It is 7 pages long. You have 120 minutes. No electronic devices may be used during the exam. If you are taking this exam during the makeup period, you may not leave the exam room prior to the end of the exam, and you may not take an exam booklet with you. You may use Python, C, or low-level pseudo-code in answer to any coding question. Descriptions written mostly in English will get no credit as responses to coding questions. Show your work for partial credit. Brevity is key. [15 points] 1. Synchronization Recall the dining philosophers problem, where every philosopher is modeled by a thread with a unique philosopher identifier between 0 and N. The correctness criteria for this problem are two-fold: SAFETY: Every philosopher must have exclusive access to a left and right chopstick prior to eating (i.e. executing the eat() routine below). PROGRESS: The philosophers make progress whenever it is possible to do so, without running into a deadlock condition. A semaphore-based solution for the dining philosophers problem is shown below. Recall that Python semaphores provide acquire() and release(), which are synonyms for P() and V(), and are initialized with an integer at the time of their creation. Describe if the code is correct or not. If it is incorrect, describe the problem(s) and provide a new version of the code that is correct. Your solution must use only semaphores for synchronization, and must not unnecessarily limit the concurrency at the philosophers' table. #create an array of chopsticks
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/07/2011 for the course CS 4410 taught by Professor Vollset during the Spring '07 term at Cornell University (Engineering School).

Page1 / 7

cs4410-fall2010-prelim2 - CS 4410 Operating Systems Prelim...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online