Discussion
Which one of the following statements about two threads writing the same non-volatile int is true?
Answer: A
Atomicity of a single write is not the issue: each write lands whole, but without ordering or visibility guarantees one thread can overwrite the other's value or read a stale one, so an update disappears. The write being atomic is exactly why this looks safe and is not.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development