13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Exercises 29321. Find a case where it would be desirable for an activity that executes signal in amonitor to perform more work before leaving the monitor.22. Implement semaphores using monitors.23. We need mutual exclusion to implement Ticket. Do we also need mutual exclusionto implement Advance?24. Show the program for the consumers in an event count and sequencer solution tomultiple producers, multiple consumers.25. Show how to use the DoubleDown procedure to implement the dining philosophersproblem. Describe what can go wrong if we don’t use MutualExclusion in implementingDoubleDown. Would the same problem occur if the declaration of MutualExclusionwere at line 6 instead of line 2?26. Does the following path-expression solution to the readers-writers problem work?What policy does it enforce?1 path EnterRead2 path TryRead | { TryWrite }3 path { StartRead; Read } | Write4 let EnterRead = TryRead5 let TryRead = StartRead6 let TryWrite = Write7 let DoRead = EnterRead ; Read8 let DoWrite = TryWrite27. Does the following path-expression solution to the readers-writers problem work?What policy does it enforce?1 path EnterWrite2 path { TryRead } | TryWrite3 path { Read } | ( StartWrite ; Write )4 let TryWrite = StartWrite5 let EnterWrite = TryWrite6 let TryRead = Read7 let DoRead = TryRead8 let DoWrite = EnterWrite; Write28. Show how to implement path expressions with semaphores. (difficult)29. Write a path-expression solution to the multiple producer-consumer problem.30. How would you implement invariant expressions using conditional criticalregions?31. What advantage do invariant expressions have over conditional critical regions?32. Our invariant-expression solution to the producers-consumers problem serializesconcurrent producers. Rewrite the solution so that producers are serialized onlylong enough to reserve slots but may fill those slots in parallel. Make sure that theGetBuffer procedure never takes data from an empty slot.33. The Sequent Balance 21000 multicomputer has a hardware test-and-set instruction.How can this instruction be used for limited busy waiting, as suggested by the HysteresisPrinciple, but not cause long busy waits?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!