Question: Louis writes a multithreaded program, which produces an incorrect answer some of the time, but always completes. He suspects a race condition. Which of the
Louis writes a multithreaded program, which produces an incorrect answer some of the time, but always completes. He suspects a race condition. Which of the following are strategies that can reduce, and with luck eliminate, race conditions in Louis’s program?
A. Separate a multithreaded program into multiple single-threaded programs, run each thread in its own address space, and share data between them via a communication link that uses send and receive.
B. Apply the one-writer rule.
C. Ensure that for each shared variable v, it is protected by some lock lv.
D. Ensure that all locks are acquired in the same order.
Step by Step Solution
3.52 Rating (152 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
