Advanced
Rust
Q95 / 100
What is the difference between Arc<Mutex<T>> and Arc<RwLock<T>>?
Correct! Well done.
Incorrect.
The correct answer is B) Arc<Mutex<T>> allows only one accessor at a time; Arc<RwLock<T>> allows concurrent reads but exclusive writes — better when reads are frequent
B
Correct Answer
Arc<Mutex<T>> allows only one accessor at a time; Arc<RwLock<T>> allows concurrent reads but exclusive writes — better when reads are frequent
Explanation
RwLock has higher acquisition overhead than Mutex. For write-heavy or short-duration access, Mutex may outperform. Measure before switching.
Progress
95/100