Anyone who has used Windows has seen the occasional system message stating that a program is not responding, but how exactly does Windows know that? Today’s SuperUser Q&A post has the answer to a baffled reader’s question.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

Photo courtesy of Matthias Ripp (Flickr).

The Question

SuperUser reader ArunPrasanth wants to know how Windows knows that a program is not responding:

How does Windows know if a program is not responding? Does it constantly poll all running applications?

How does Windows know if programs are not responding?

The Answer

SuperUser contributor ratchet freak has the answer for us:

An application gets events from a queue provided by Windows. If the application does not poll the event queue for a while (5 seconds), such as doing a long calculation for example, then Windows assumes that the application is hung and alerts the user.

To avoid that, applications should push expensive calculations to worker threads or split up processing and make sure the queue gets polled regularly.

Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

Akemi Iwaya
Akemi Iwaya has been part of the How-To Geek/LifeSavvy Media team since 2009. She has previously written under the pen name "Asian Angel" and was a Lifehacker intern before joining How-To Geek/LifeSavvy Media. She has been quoted as an authoritative source by ZDNet Worldwide.
Read Full Bio »