An unresponsive computer is never fun to deal with. There are different terms to describe the experience: Hang, Freeze, Stuck, Unresponsive, and an assortment of other, less cordial terms. Regardless of how it is described, it is never a pleasant user experience. From an engineering perspective, we should try to eliminate these experiences and keep the user in control. Unfortunately, there is no one solution because interpretations of "unresponsive" range from minor inconvenience to major roadblock:
- Clicking a button does nothing
- Website does not respond
- Progress bar not making any progress
- Window has become frozen
- Control+Alt+Delete is not working
- Mouse does not move
- Computer does not turn on
The Windows team is consistently looking for ways to keep your computer responsive. Unfortunately, some things are beyond our control. For example, we can't ensure your computer can reach a website through the wild world of the internet and we can't make a burned out power supply turn on. In third party applications, we can't make the application do something every time a button is clicked: it may very well be the intent of the application to do nothing.
On the other hand, for tasks that the OS is responsible for, we do try to keep systems responsive. However, third party applications are eventually given CPU time to do their work, and not all applications are well-behaved. Although guidelines are generally available for how to keep applications responsive, they are not always followed, whether intentional or not. For example, here are some generic guidelines for various frameworks:
- Network servers should be listening for new connections
- Threads that create a window should immediately respond to messages put in its message queue
- ISRs (interrupt service routines) should complete quickly, and defer longer work to DPCs
Microsoft has done a great deal of research into various types of unresponsiveness, but it is simply too much to dive into the details of each. Instead, the first few entries of this blog will focus on one of the most prevalent types of unresponsiveness: Window hangs. These are hangs where the thread responsible for servicing a window fails to do so in a timely manner.
Whether you are writing driver software, network servers, or GUI applications, keep the user in control!