Busy waiting is a computing anti-pattern that occurs when a thread or process repeatedly checks a condition until it becomes true. This can be a waste of CPU time, especially if the condition is unlikely to change quickly. There are a number of ways to avoid busy waiting, including using blocking I/O, non-blocking I/O, or a wait queue.
Blocking I/O causes the thread or process to sleep until the condition becomes true. This can be inefficient if the condition is likely to change quickly, as the thread or process will be unable to do any other work while it is waiting. Non-blocking I/O allows the thread or process to continue executing while it waits for the condition to become true. This can be more efficient than blocking I/O, but it can also be more complex to implement.