Are spin waits, spin loop and busy spin a different name for the same situation?
I read different threads and they all seem related to a loop that is "busy" checking for the availability of a resource.
JEP 285: Spin-Wait Hints in Java. Spin loop performance can be improved in some processors using a special instruction inside the spin loop code. Spin loop, or busy waiting technique, is a loop where a certain condition is repeatedly checked, such as a flag.
Busy Spinning is a wait strategy in which one thread waits for some condition to happen which is to be set by some other thread. Here the waiting thread loops continuously without releasing the CPU cycles. This leads to bad performance as the CPU cycles are wasted by a waiting thread.
Simply put: Busy waiting is a technique in which a process repeatedly checks to see if a condition is true (from Wikipedia). Spinlock uses the above technique for the purpose of checking if a lock is available.
Hello, everyone, now, I know what's differences:D, busy waiting is a loop, the cpu will execute it all the time, block is a kind of kernel/OS control, it won't waste cpu resource.
Busy Spin
A technique which is used in a way that it loop is running until other thread have to complete his work.
Spin Wait
A spin wait that you have to wait until condition for thread is true.
Spin Loop
Spin loop is also similar to both of above busy spin and wait spin. It means that threads have to wait for other thread for completing his work.
By the way I think these terms can also use interchangeably. Precisely these are the same terms.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With