{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

7755992830141 - 4 Consider the following program const int...

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

View Full Document Right Arrow Icon
1: Is busy waiting always less efficient (in terms of using processor time) than a blocking wait? Explain. 2: At the beginning of Section 5.1, it is stated that multiprogramming and multiprocessing present the same problems, with respect to concurrency. This is true as far as it goes. However, cite two differences in terms of concurrency between multiprogramming and multiprocessing. 3: Consider a concurrent program with two processes, p and q, defined as follows. A, B, C, D, and E are arbitrary atomic (indivisible) statements. Assume that the main program (not shown) does a parbegin of the two processes. void p() { A; B; C; } void q() { D; E; } Show all the possible interleavings of the execution of the preceding two processes (show this by giving execution “traces” in terms of the atomic statements).
Background image of page 1

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

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4: Consider the following program: const int n = 50; int tally; void total() { int count; for (count = 1; count <= n; count++) { tally++; } } void main() { tally = 0; parbegin (total (), total () ); write (tally); } A. Determine the proper lower bound and upper bound on the final value of the shared variable tally output by this concurrent program. Assume processes can execute at any relative speed and that a value can only be incremented after it has been loaded into a register by a separate machine instruction. B. Suppose that an arbitrary number of these processes are permitted to execute in parallel under the assumptions of part (a).What effect will this modification have on the range of final values of tally ?...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

7755992830141 - 4 Consider the following program const int...

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

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