I known the implement of Busy Waiting. it's a death loop like this:
//main thread
while (true) {
msg = msgQueue.next();
msg.runnable.run();
}
//....msg queue
public Message next() {
while (true) {
if (!queue.isEmpty()) {
return queue.dequeue();
}
}
}
so, the method "next()" just looks like blocked, actually it runs all the time. this was called "busy waiting" on book.
and what's the "process blocked"? what about its implement details? is a death loop too? or some others? like signal mechanism?
For instance: cat xxx | grep "abc"
process "cat" read a file and output them.
process "grep" waiting for input from "cat".
so before the "cat" output data, "grep" should be blocked, waiting for input and go on. what details about this "blocked", a death loop read the input stream all the time? or really stop running, waiting a signal to wake up it to run?