Help the world stop coronavirus! Stay home!

Prev Next

Java / Java Multithreading part II

What is busy spinning in Java?

Busy spinning is a waiting strategy in which a thread just wait in a loop, without releasing the CPU just by going to sleep. By not releasing the CPU or suspending the thread, your thread retains all the cached data and instruction, which may be lost if the thread was suspended and resumed back in a different core of CPU.

This is popular in high-frequency low latency programming domain, where programmers are trying for extremely low latency in the range of micro to milliseconds.

private volatile boolean isDone = false;

public void waitUntilDone() {
while (!isDone) {
Thread.sleep(1000);
}

}

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...

final keyword

Comments & Discussions