2003fall-sol

# 2003fall-sol - CS414 Prelim 1 In Class no notes 10:15 to...

This preview shows pages 1–3. Sign up to view the full content.

CS414 Prelim 1: In Class, no notes. 10:15 to 11:25. Four problems, 25 points each Your name: ___________________Your ID : _______________________ 1. You, your mom, and your dad, all like to do the crossword puzzle. Which form of concurrency control would be best, if the goal is that this be a family activity, that the solution not require talking about the puzzle among yourselves, and that the puzzle be completed as rapidly as possible? For each option comment very briefly on whether it would work, how well it would work, and why. Assume that everyone is using pencil and that not every guess for a word is correct – some of the words people write down are guesses that will turn out to be wrong, and will later need to be erased. For example, maybe your mother guesses that 1-down in the example below is “stone” at the same moment that you guess that the word should be “apple”. A sample crossword puzzle: Across: 1. Witch’s pet 2. Blueberry _________ Down: 1. Newton’s inspiration a) Obtain mutual exclusion, using a semaphore, prior to writing (or erasing) each letter. Release the mutex after doing so. One semaphore per square on the puzzle. This solution won’t work: if two people try to write the same word at the same time, their letters can intermingle, creating chaos. For example, if you want to write “stone” and I want to write “apple” in 1-down, we could end up with a mixture of letters from the two words.

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

View Full Document
b) Same as (a), but with one semaphore for the entire puzzle. This has exactly the same problem as (a) and for exactly the same reason. c)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

2003fall-sol - CS414 Prelim 1 In Class no notes 10:15 to...

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

View Full Document
Ask a homework question - tutors are online