InterviewSolution
| 1. |
What Is Busy Spinning? When Will You Use Busy Spinning As Waiting Strategy? |
|
Answer» An algorithm is CALLED non-blocking if it doesn't block threads in such a WAY that only one thread has access to the data structure and all the other threads are waiting. Same way failure of any thread in a non-blocking algorithm doesn't mean failure or suspension of other threads. IMPLEMENTATION of non-blocking data structures in Java LIKE atomic variables or ConcurrentLinkedQueue use an atomic read-modify-write kind of instruction based on compare-and-swap. An algorithm is called non-blocking if it doesn't block threads in such a way that only one thread has access to the data structure and all the other threads are waiting. Same way failure of any thread in a non-blocking algorithm doesn't mean failure or suspension of other threads. Implementation of non-blocking data structures in Java like atomic variables or ConcurrentLinkedQueue use an atomic read-modify-write kind of instruction based on compare-and-swap. |
|