What do you mean by busy waiting? Expalin with example.
Definition:
Busy waiting is where a process checks repeatedly for a condition- it is "waiting" for the condition, but it is "busy" checking for it. This will make the process eat CPU (usually).
For example, let us consider the following example,
Busy waiting is where a process checks repeatedly for a condition- it is "waiting" for the condition, but it is "busy" checking for it. This will make the process eat CPU (usually).
For example, let us consider the following example,
function stay_running_until_there_is_internet() {
while(check_internet() == 0) {
\\ wait
}
}
Polling is sometimes necessary and sometimes a good idea; Busy Waiting is very rarely necessary and is almost always a bad idea.
0 comments:
Feel free to contact the admin for any suggestions and help.