| • Science | • People | • Locations | • Timeline |
Many crashes are the result of the execution of a single machine instruction, but the causes of this are manifold. Typical causes are when the program counter loses track of the correct execution path or a buffer overflow overwrites a portion of program code, due to an earlier bug. In either case it is quite common for the processor to attempt to execute data or random memory values. Since all data are possible, but only some of these are valid instructions, this very often results in an illegal instruction exception. One might say that the original bug that upset the program counter "caused" the crash, but the actual fault was an illegal instruction, possibly some time later. The art of debugging such crashes is connecting the actual cause of the crash (easily determined) with the code that set off the chain of events. This is often very far from obvious - the original bug may in fact be perfectly valid code from the processor's perspective.
Another cause of crashes 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 have to wait until the process can get to it. What if the second process was busy sending a signal to the first process and also stops execution until it receives a response? In this case, both processes wait forever for the other to respond to its signal and never see the other’s signal. If the processes are uninterruptable 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 crash and have to be restarted.
An application typically crashes when it performs an operation which is not allowed by the operating system. The operating system then shuts down the application.
Typical errors that result in application crashes include: