Bus Error v Segmentation Fault

Bus Error v Segmentation Fault

Post by Richard Harri » Thu, 10 Jul 2003 08:34:15



Hello,

    I was hoping someone could explain the difference between a Bus
error and a Segmentation Fault.  Specifically what poor programing
causes them.

Thanks

 
 
 

Bus Error v Segmentation Fault

Post by Marc Rochkin » Thu, 10 Jul 2003 11:26:27


On Tue, 08 Jul 2003 18:34:15 -0500, Richard Harris


> Hello,

> I was hoping someone could explain the difference between a Bus
> error and a Segmentation Fault.  Specifically what poor programing
> causes them.

> Thanks

Either can be caused by the hardware automatically detecting an invalid
pointer. Traditionally, the two signals are for two different types of
invalidity, but this is no longer a requirement and they are really just
names:

1. Bus error meant that the pointer had a value that the memory bus
couldn't possibly handle, such a an odd number when the memory system only
works in units of 2, 4, etc., bytes.

2. Segmentation fault meant that the address was outside the bounds of the
segmentation registers that defined what physical memory the process could
use. (Now generalized to any sort of address-translation hardware.)

The "poor programming" is generally using an invalid pointer, and in C,
anyway, there are numerous ways to do this. The most common are failure to
initialize a pointer to storage before using it, and messing up the heap by
overwriting memory or freeing something twice. But these are just the tip
of the iceberg!

These days, many people choose languages that don't even have pointer,
which neatly disposes of the problem, although even those languages still
offer many ways to mess up. Examples would be Java or Cobol (although I
haven't checked the latter lately).

--Marc

 
 
 

1. bus error, alloc error, segmentation fault

hi all

my netscape 4.07 often crashes with bus error or alloc error.
arena also often crashes with segmentation fault.

I don't know what's wrong with my X.
but everything seems ok except these web browsers.

I'm using slackware 3.6 packages.
CPU is P-133, Memory is 16M, and no swap partition.
kernel is 2.0.35.

help me please..!

thanks.

2. The Last Barrier to Desktop Linux?

3. Segmentation Faults and Bus Errors

4. Linux on PC without floppy.

5. segmentation fault and bus error

6. I'm on, now how do I get off?

7. ps command failed and produced "Bus error" or "Segmentation fault" messages

8. QUESTION: Encryption with write

9. "Bus error" or "Segmentation Fault" By ps command

10. Segmentation Fault & Bus error

11. difference between bus error and segmentation fault

12. Compiling *** VIM 5.3 *** Segmentation Fault..what is Seg-Fault..MEM Bounds?

13. Page Faults/Segmentation Faults??