What happens when segmentation faults occur?

Status
Not open for further replies.

sacrpio

Member level 3
Joined
May 24, 2004
Messages
56
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
500
Hello All,
While compiling C program sometimes segmentation faults come. What happens internally with operating system if such type of fault comes. What is core dumped.

Thanks in advance.
 

Re: Segmentation Faults

visit to:
h**p://www-ee.eng.hawaii.edu/Courses/EE150/Book/chap7/subsection2.1.3.2.html
h**p://web.mit.edu/answers/c/unix_bus_or_seg.html

enjoy
 

Re: Segmentation Faults

for the lazy ppl who don't want to visit the second link and read the info there:

Segmentation fault means that the program uses area in the memory that isn't allocated to it. Most of the time it happens when using arrays and don't do bounds cheching (meaning you try to read the 5th element in an array of 4 ;-) )

Core Dumped (they have seen way too much star trek) means that the when the program chrashes, all memory used by the program (+ all other usefull info like from CPU) is written to a file that can be examined later (gdb can be used for that matter)

Antharax
 

Segmentation Faults

Little addition - this error is mainly relevant to processors where memory management unit is used (MMU) where access to different memory positions are guided under hardware control . In non mmu processors you can just get crashed program . For simplicity and speed reason run time libraries do not include input range check when their functions are called . But there are also libraries where software argument checking is enabled - to make safe buffer overflow protected software(e.g. communication libraries ).
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…