13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Exercises 291(1977). Event counts and sequencers were introduced by Reed and Kanodia (1979), pathexpressions by Campbell and Habermann (1974), and invariant expressions by Robertand Verjus (1977).The readers-writers problem has been discussed by many authors; Courtois andParnas presented an early discussion (1971). One good place to read more is in an articleby Lamport (1977). The dining philosophers problem seems to have been introduced byDijkstra (1971).A discussion of criteria for evaluating concurrency control mechanisms can befound in a paper by Bloom (1979). Scott’s survey of languages for distributed computing(1984) considers monitors and path expressions as a special case of the more generaltopic of tools for distributed computation.5 EXERCISES1. Consider the following program fragments for processes A and B.process Aprocess B1 for SeqA := 1 to 10 do for SeqB := 1 to 10 do2 x := x + 1; x := x + 1;Assume that the shared variable x starts at 0, that both A and B execute once, andthat SeqA and SeqB are not shared variables. The two processes may execute atany speed. What are the possible resulting values of x? Assume that x must beloaded into a register for incrementing.2. Consider Figure 8.1 again.(a) We have seen that the actions to be performed could be partitioned into threeactivities, {A,B,C}, {D,E,F}, and {G,H,I}, to achieve some constraints throughimplicit synchronization. How many ways are there to partition the actions?(b) Your answer to (a) most likely did not include any activities like {A,C}because even though C must wait for A, which is implicit in {A,C}, it must alsowait for B, which would have to be explicit. If we allow such activities, how manypartitionings can you build?(c) Your answer to (b) most likely did not include any activities like {C,D}. Whynot?3. Disabling interrupts does not work correctly for nested regions. Rewrite theBeginRegion and EndRegion routines to fix this problem.4. Generalize the switch mechanism to three processes.5. Does Dekker’s non-alternating switch use busy waiting if B is in its region,Turn = A, and A is trying to enter its region?

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

Saved successfully!

Ooh no, something went wrong!