Can the flockfile and funlockfile functions introduced in Section 12.5 be used to solve the race found in the program from Figure8.12? Explain.
What will be an ideal response?
No, they can’t help with this race, because they can only be used to synchronize threads within a single address space. In Figure8.12, the two racing contexts areprocesses, not threads, and each process has its own address space, even though the child starts out as a copy of the parent. This means that when the child’s stream is locked, it doesn’t affect the parent’s copy of the stream.
You might also like to view...
Which of the following is used to create a variable in a class-level method?
a. Create new parameter button in the Method Editor b. Create new variable button in the Method Editor c. Create new variable button in the Details Panel d. Create new method button in the Details Panel e. None of these
Stacks are useful data structures for algorithms that work with lists of items in a
A) first in, first out order. B) first in, last out order. C) last in, last out order. D) garbage in, garbage out order. E) None of the above
Can static methods access object data?
What will be an ideal response?
A page ________ indicates where data starts on a new printed page
Fill in the blank(s) with correct word