Stale data occurs in multi-CPU machines when one thread modifies shared data and a second thread accesses that data later, but sees the data value before the change took place. What is required to guarantee that the second thread sees the updated data, not stale data when access to the shared data occurs in two different methods?
A) One method needs to acquire then release the lock after modifying the data.
B) Both methods need to acquire then release the lock after modifying or reading the data.
C) Never change any shared object data in multi-CPU machines.
D) Never use locks for any shared data in multi-CPU machines.
Correct Answer:
Verified
Q26: What happens if we try to start
Q55: The _ method is called by a
Q60: Examine the SharedData class shown below. Suppose
Q60: Which phrase best describes the purpose of
Q61: Consider an old fashioned telephone booth that
Q62: Assume three threads share a BankAccount object
Q68: What happens when a thread calls the
Q68: Exactly when does a thread finish in
Q69: Under what conditions are locks unnecessary for
Q71: Class MyClass has a single ReentrantLock object,
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents