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).
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?
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.