Segmentation fault

For computers enters a protection violation ( from the English. Segmentation fault or segmentation violation, short segfault ) or access violation ( engl. access violation ) when a computer program on a resource tries (especially memory ) access to protected from such access or should not be accessible. Here, the operating system kernel sends a signal to the process that caused the mistake, resulting in its termination in the normal case. Memory protection of modern operating systems and the Memory Protection Units of the microcontroller are arrangements for other processes and the operating system.

The reverse is not allowed: Not everyone faulty memory access triggers the exception, protection violation from. The same bug may depend on the common system state and thus more or less randomly, cause a crash due to injury protection, lead to wrong arithmetic calculation results or other undesirable system behavior or even remain completely without consequence.

The English term segmentation fault comes from a time, were protected in the storage areas by segmentation from unauthorized access. Today, other protection mechanisms may be used, in particular paging; the term segmentation fault but has remained unchanged. The segmentation fault is not to be confused with the page fault ( page fault ), the only the program stops until the missing page was loaded from secondary storage into the main memory.

On Unix, solves segmentation violation SIGSEGV the exception (Exception 11 in decimal, hexadecimal, B, 0x0B ) from. For IA- 32 and x86 processors, a memory access violation ( decimal 13, hexadecimal D, 0x0D exception) referred to as General Protection Fault, which is triggered by an interrupt.

Examples

Mass occurrences of breaches indicates conceptual weaknesses of an operating system, a programming language or program. Remained a broad audience in mind is the error message "General Protection Fault in " followed by a hexadecimal address ( Blue Screen ), often crashed with the programs among early Microsoft Windows versions.

One reason for increased incidence of breaches may be faulty memory or other faulty hardware. Here are addressed by hardware failure ungebeabsichtigte addresses (for example, it is sufficient to change a single bit of address). Also overclocking or an incorrectly programmed device driver can cause such errors without the need for a defect is necessary.

Example of a C program that causes a protection violation as good as ever and on each system:

Int main ( void) {      int * ptr = (int *) 0; / / Pointer to the memory address 0      * ptr = 0; / / Write 0 to the registered address.      / / This memory area is not part of the program      / / And is therefore "protected" (hence protection fault ).      return 0; } References

  • Operating system theory

Pictures of Segmentation fault

26565
de