| Segmentation Fault |
Article Index for Segmentation |
Website Links For Segmentation |
Information AboutSegmentation Fault |
| CATEGORIES ABOUT SEGMENTATION FAULT | |
| operating system technology | |
|
A segmentation fault (often shortened to '''segfault''') is a particular error condition that can occur during the operation of Computer Software . In short, a segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed (e.g., attempts to write to a read-only location, or to overwrite part of the operating system). Systems based on processors like the Motorola 68000 tend to refer to these events as ''Address'' or ''Bus'' errors. Segmentation is one approach to Memory Management and protection in the Operating System . It has been superseded by Paging for most purposes, but much of the terminology of segmentation is still used, "segmentation fault" being an example. Some operating systems still have segmentation at some logical level although paging is used as the main memory management policy. On Unix-like operating systems, a process that accesses invalid memory receives the SIGSEGV Signal . On Microsoft Windows , a process that accesses invalid memory receives the STATUS_ACCESS_VIOLATION Exception . EXAMPLE Here is an example of an ANSI C program that should create a segmentation fault on most platforms with memory protection: Compiling and running it on NetBSD produces the following: Backtrace from Gdb : Note that the language standard does not say anything about what happens when a null pointer is dereferenced; it invokes Undefined Behaviour and literally anything might happen (including but not limited to exiting successfully). The conditions under which segmentation violations occur and how they manifest themselves is specific to an operating system. SEE ALSO
|
|
|