Why Programs Crash

Why Programs Crash
Why Programs Crash

Video: Why Programs Crash

Video: Why Programs Crash
Video: Why Programs Crash | Google IT Automation with Python Certificate 2024, April
Anonim

The variety of tasks solved today with the help of personal computers is provided by the existence of a huge set of application programs. The convenience of working with the software largely depends on its reliability, which is expressed in the absence of emergency situations. However, many programs crash at the most inopportune moment. Why?

Why
Why

The exception mechanism is used to track and handle special, abnormal or erroneous situations that arise during the operation of computer programs under the control of modern operating systems. Exceptions can be hardware-based (raised by the processor) and software-initiated (initiated by the application itself or some plug-in external component).

Regardless of the type, the exception can be caught and handled correctly. Uncaught exceptions go to the root runtime library handler or an operating system-installed handler. If this happens, the program crashes with a message or an abnormal termination window (in Windows). If the operating system handler did not work (for example, it was deliberately removed), the program "silently crashes". Thus, programs crash due to exceptions that cannot be handled. The reasons for the occurrence of exceptions are different.

In the overwhelming majority of cases, programs "crash" due to the execution of their own code containing explicit or implicit implementation errors. The list of possible causes of emergencies is very long. These are both classic errors of operations on floating point numbers (for example, division by 0), and errors of working with memory (reading or writing outside the process address space, access to protected pages, writing to a read-only memory area), overflow stack due to infinite recursion, etc. In these cases, hardware exceptions or operating system exceptions are thrown.

Implicit errors include various cases of insufficient filtering of input data, lack of validation of pointer values, and much more. Such shortcomings lead to exceptional situations only in certain cases.

Implementation errors can also be found in external components used by the application. For example, in dynamic libraries that provide the necessary functionality or add-on modules. Program code that is implicitly loaded into the address space of a process (for example, in order to intercept certain API functions) can also cause the program to crash.

Many components and libraries (for example, ADO on Windows) use the programmatic exception mechanism as a priority for reporting errors. The absence or insufficient handling of exceptions by this kind of application can lead to its crash even in completely harmless situations (such as loss of connection to the database).

Recommended: