Science Fair Projects Ideas - Segmentation fault

All Science Fair Projects

      

Science Fair Project Encyclopedia for Schools!

  Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary     

Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

Segmentation fault

A segmentation fault (sometimes referred to as segfault for short) 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 it is not allowed to (eg, attempts to write a read-only location). 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.

UNIX programmers are likely to use the term synonymously with "segmentation violation" and the associated signal, SIGSEGV.

Microsoft Windows users are likely to see a General protection fault, but programmers still use the term segmentation fault. (The debugger of MS Visual Studio does not use the term "segmentation fault" but reports an "access violation".)

The humorous website Segfault was named after this error.

Example

Here is an example of an ANSI C program that should create a segmentation fault on most platforms with memory protection:

 #include <string.h>
 
 int main()
 {
   memset((char *)0x0, 42, 200);
 }

Compiling and running it on Linux produces the following:

 % gcc -o segfault segfault.c
 % ./segfault
 Segmentation fault
 %

Backtrace from gdb:

 Program received signal SIGSEGV, Segmentation fault.
 0x40089357 in memset () from /lib/libc.so.6
 (gdb) bt
 #0  0x40089357 in memset () from /lib/libc.so.6
 #1  0x40012280 in _rtld_global () from /lib/ld-linux.so.2
 #2  0x080483b0 in main ()

09-23-2007 01:00:40
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details
Science kits, science lessons, science toys, maths toys, hobby kits, science games and books - these are some of many products that can help give your kid an edge in their science fair projects, and develop a tremendous interest in the study of science. When shopping for a science kit or other supplies, make sure that you carefully review the features and quality of the products. Compare prices by going to several online stores. Read product reviews online or refer to magazines.

Start by looking for your science kit review or science toy review. Compare prices but remember, Price $ is not everything. Quality does matter.
Science Fair Coach
What do science fair judges look out for?
ScienceHound
Science Fair Projects for students of all ages
All Science Fair Projects.com Site
All Science Fair Projects Homepage
Search | Browse | Links | From-our-Editor | Books | Help | Contact | Privacy | Disclaimer | Copyright Notice