Hang (computing)
Encyclopedia
In computing
, a hang or freeze occurs when either a single computer program
, or the whole system ceases to respond to inputs
. In the most commonly encountered scenario, a workstation
with a graphical user interface
, all windows belonging to the frozen program become static, and though the mouse cursor still moves on the screen, neither typing on the keyboard nor clicking the mouse produces any effect in the program's windows. The mouse cursor may also be stuck in a form indicating that it is waiting for some operation to complete, such as an hourglass
or a spinning wait cursor
. Many modern operating systems provide the user with a means to terminate a hung program without rebooting
or logging out. In more severe hangs affecting the whole system, no window belonging to any program will respond to keyboard or mouse input, and often the mouse cursor will freeze in place on the screen. Almost always, the only way to recover from a system freeze is to reboot the machine, usually by power cycling
with an on/off or reset button. In the Windows 7 and Windows Vista
operating systems, hangs almost always precedes a Blue Screen of Death
or are a sign to the user that one is on its way. On Windows systems, if clicked on, a hanging program will gain "Not Responding" in parentheses on its top bar.
A hang differs from a crash
, in which a program exits abnormally or the operating system shuts down.
Hangs are not limited to client
personal computers with a graphical user interface
, as in the example above. Servers
can hang as well. In those cases, the server ceases to respond to requests. These sorts of hangs are typically addressed by a solution far more complex than an on/off or reset button.
Pre-emptive multitasking operating systems, such as Microsoft
Windows 2000
/XP
/Vista
/7, Apple Computer
's Mac OS X
and Linux
hang less often as the multi-tasking system is not affected by non-terminating loops and further does not require tasks to yield control to the operating system. If a
task does hang, the scheduler may switch to another group of interdependent tasks so that all processes will not hang.
). Hardware can also become defective over time due to dirt or heat damage.
A hang can also occur due to the fact that the programmer has incorrect termination conditions for a loop, or, in a co-operative multitasking operating system
, forgetting to yield to other tasks. Said differently, many software-related hangs are caused by threads
waiting for an event to occur which will never occur. This is also known as an infinite loop
.
Another cause of hangs is a race condition in communication between processes. One process may send a signal
to a second process then stop execution until it receives a response. If the second process is busy the signal will be forced to wait until the process can get to it. However, if the second process was busy sending a signal to the first process then both processes would wait forever for the other to respond to signals and never see the other’s signal (this event is known as a deadlock
). If the processes are uninterruptible they will hang and have to be shut down. If at least one of the processes is a critical kernel process the whole system may hang and have to be restarted.
A computer may seem to hang when in fact it is simply processing very slowly. This can be caused by too many programs running at once, not enough memory (RAM
), or memory fragmentation, slow hardware access (especially to remote devices), slow system APIs, etc. It can also be caused by hidden programs which were installed surreptitiously, such as spyware
.
Usually, in systems with a modern operating system
, the user is able to terminate the programs running (for instance, with the kill command, or through the "end task" button on the task list in recent versions of Microsoft Windows
), and, if they wish, restart it in the hope that the anomalous condition that caused the hang does not recur. Older systems, such as those using MS-DOS
or Windows 3.1x
, often needed to be completely restarted in the event of a hang.
A watchdog timer
can reboot the computer in the event of a hang (this is commonly used in embedded devices).
Computing
Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...
, a hang or freeze occurs when either a single computer program
Computer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...
, or the whole system ceases to respond to inputs
Input/output
In computing, input/output, or I/O, refers to the communication between an information processing system , and the outside world, possibly a human, or another information processing system. Inputs are the signals or data received by the system, and outputs are the signals or data sent from it...
. In the most commonly encountered scenario, a workstation
Personal computer
A personal computer is any general-purpose computer whose size, capabilities, and original sales price make it useful for individuals, and which is intended to be operated directly by an end-user with no intervening computer operator...
with a graphical user interface
Graphical user interface
In computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...
, all windows belonging to the frozen program become static, and though the mouse cursor still moves on the screen, neither typing on the keyboard nor clicking the mouse produces any effect in the program's windows. The mouse cursor may also be stuck in a form indicating that it is waiting for some operation to complete, such as an hourglass
Hourglass
An hourglass measures the passage of a few minutes or an hour of time. It has two connected vertical glass bulbs allowing a regulated trickle of material from the top to the bottom. Once the top bulb is empty, it can be inverted to begin timing again. The name hourglass comes from historically...
or a spinning wait cursor
Spinning wait cursor
The spinning wait cursor is a cursor in Apple's Mac OS X that indicates an application is not responding to system events.The Apple Human Interface Guidelines officially refers to it as the "spinning wait cursor"...
. Many modern operating systems provide the user with a means to terminate a hung program without rebooting
Rebooting (computing)
In computing, rebooting is the process by which a running computer system is restarted.Reboots can be either "hard", whereby the power to the system is physically turned off, or "soft" where the system restarts without the need to interrupt the power or trigger a reset line.- Hard reboot :A hard...
or logging out. In more severe hangs affecting the whole system, no window belonging to any program will respond to keyboard or mouse input, and often the mouse cursor will freeze in place on the screen. Almost always, the only way to recover from a system freeze is to reboot the machine, usually by power cycling
Power cycling
Power cycling is the act of turning a piece of equipment, usually a computer, off and then on again. Reasons for power cycling include having an electronic device reinitialize its configuration or recover from an unresponsive state of its mission critical functionality, such as in a crash or hang...
with an on/off or reset button. In the Windows 7 and Windows Vista
Windows Vista
Windows Vista is an operating system released in several variations developed by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs, and media center PCs...
operating systems, hangs almost always precedes a Blue Screen of Death
Blue Screen of Death
To forse a BSOD Open regedit.exe,Then search: HKLM\SYSTEM\CurrentControlSet\services\i8042prt\ParametersThen make a new DWORD called "CrashOnCtrlScroll" And set the value to 1....
or are a sign to the user that one is on its way. On Windows systems, if clicked on, a hanging program will gain "Not Responding" in parentheses on its top bar.
A hang differs from a crash
Crash (computing)
A crash in computing is a condition where a computer or a program, either an application or part of the operating system, ceases to function properly, often exiting after encountering errors. Often the offending program may appear to freeze or hang until a crash reporting service documents...
, in which a program exits abnormally or the operating system shuts down.
Hangs are not limited to client
Client (computing)
A client is an application or system that accesses a service made available by a server. The server is often on another computer system, in which case the client accesses the service by way of a network....
personal computers with a graphical user interface
Graphical user interface
In computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...
, as in the example above. Servers
Server (computing)
In the context of client-server architecture, a server is a computer program running to serve the requests of other programs, the "clients". Thus, the "server" performs some computational task on behalf of "clients"...
can hang as well. In those cases, the server ceases to respond to requests. These sorts of hangs are typically addressed by a solution far more complex than an on/off or reset button.
Pre-emptive multitasking operating systems, such as Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...
Windows 2000
Windows 2000
Windows 2000 is a line of operating systems produced by Microsoft for use on personal computers, business desktops, laptops, and servers. Windows 2000 was released to manufacturing on 15 December 1999 and launched to retail on 17 February 2000. It is the successor to Windows NT 4.0, and is the...
/XP
Windows XP
Windows XP is an operating system produced by Microsoft for use on personal computers, including home and business desktops, laptops and media centers. First released to computer manufacturers on August 24, 2001, it is the second most popular version of Windows, based on installed user base...
/Vista
Windows Vista
Windows Vista is an operating system released in several variations developed by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs, and media center PCs...
/7, Apple Computer
Apple Computer
Apple Inc. is an American multinational corporation that designs and markets consumer electronics, computer software, and personal computers. The company's best-known hardware products include the Macintosh line of computers, the iPod, the iPhone and the iPad...
's Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...
and Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
hang less often as the multi-tasking system is not affected by non-terminating loops and further does not require tasks to yield control to the operating system. If a
task does hang, the scheduler may switch to another group of interdependent tasks so that all processes will not hang.
Causes
Hardware can cause a computer to hang, either because it is intermittent or because it is mismatched with other hardware in the computer (this can occur when one makes an upgradeUpgrade
The term upgrade refers to the replacement of a product with a newer version of the same product. It is most often used in computing and consumer electronics, generally meaning a replacement of hardware, software or firmware with a newer or better version, in order to bring the system up to date...
). Hardware can also become defective over time due to dirt or heat damage.
A hang can also occur due to the fact that the programmer has incorrect termination conditions for a loop, or, in a co-operative multitasking operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
, forgetting to yield to other tasks. Said differently, many software-related hangs are caused by threads
Thread (computer science)
In computer science, a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process...
waiting for an event to occur which will never occur. This is also known as an infinite loop
Infinite loop
An infinite loop is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never be met, or one that causes the loop to start over...
.
Another cause of hangs is a race condition in communication between processes. One process may send a signal
Signal (computing)
A signal is a limited form of inter-process communication used in Unix, Unix-like, and other POSIX-compliant operating systems. Essentially it is an asynchronous notification sent to a process in order to notify it of an event that occurred. When a signal is sent to a process, the operating system...
to a second process then stop execution until it receives a response. If the second process is busy the signal will be forced to wait until the process can get to it. However, if the second process was busy sending a signal to the first process then both processes would wait forever for the other to respond to signals and never see the other’s signal (this event is known as a deadlock
Deadlock
A deadlock is a situation where in two or more competing actions are each waiting for the other to finish, and thus neither ever does. It is often seen in a paradox like the "chicken or the egg"...
). If the processes are uninterruptible they will hang and have to be shut down. If at least one of the processes is a critical kernel process the whole system may hang and have to be restarted.
A computer may seem to hang when in fact it is simply processing very slowly. This can be caused by too many programs running at once, not enough memory (RAM
Ram
-Animals:*Ram, an uncastrated male sheep*Ram cichlid, a species of freshwater fish endemic to Colombia and Venezuela-Military:*Battering ram*Ramming, a military tactic in which one vehicle runs into another...
), or memory fragmentation, slow hardware access (especially to remote devices), slow system APIs, etc. It can also be caused by hidden programs which were installed surreptitiously, such as spyware
Spyware
Spyware is a type of malware that can be installed on computers, and which collects small pieces of information about users without their knowledge. The presence of spyware is typically hidden from the user, and can be difficult to detect. Typically, spyware is secretly installed on the user's...
.
Solutions
In many cases programs may appear to be hung, but are making slow progress, and waiting a few minutes will allow the task to complete.Usually, in systems with a modern operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
, the user is able to terminate the programs running (for instance, with the kill command, or through the "end task" button on the task list in recent versions of Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
), and, if they wish, restart it in the hope that the anomalous condition that caused the hang does not recur. Older systems, such as those using MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...
or Windows 3.1x
Windows 3.1x
Windows 3.1x is a series of 16-bit operating systems produced by Microsoft for use on personal computers. The series began with Windows 3.1, which was first sold during March 1992 as a successor to Windows 3.0...
, often needed to be completely restarted in the event of a hang.
A watchdog timer
Watchdog timer
A watchdog timer is a computer hardware or software timer that triggers a system reset or other corrective action if the main program, due to some fault condition, such as a hang, neglects to regularly service the watchdog A watchdog timer (or computer operating properly (COP) timer) is a computer...
can reboot the computer in the event of a hang (this is commonly used in embedded devices).
See also
- Abort (computing)Abort (computing)In a computer or data transmission system, to abort means to terminate, usually in a controlled manner, a processing activity because it is impossible or undesirable for the activity to proceed. Such an action may be accompanied by diagnostic information on the aborted process.In addition to being...
- Anomaly in softwareAnomaly in softwareIn software testing, a software anomaly is anything that differs from expectation. This expectation can result from many things like from a document or from a person's view or experiences In software testing, a software anomaly is anything that differs from expectation. This expectation can...
- Blue screen of deathBlue Screen of DeathTo forse a BSOD Open regedit.exe,Then search: HKLM\SYSTEM\CurrentControlSet\services\i8042prt\ParametersThen make a new DWORD called "CrashOnCtrlScroll" And set the value to 1....
- Crash (computing)Crash (computing)A crash in computing is a condition where a computer or a program, either an application or part of the operating system, ceases to function properly, often exiting after encountering errors. Often the offending program may appear to freeze or hang until a crash reporting service documents...
- DeadlockDeadlockA deadlock is a situation where in two or more competing actions are each waiting for the other to finish, and thus neither ever does. It is often seen in a paradox like the "chicken or the egg"...
- Livelock
- Infinite loopInfinite loopAn infinite loop is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never be met, or one that causes the loop to start over...
- Uninterruptible sleep