Solved

Exception/bus error

Posted on 2004-09-13
5
415 Views
Last Modified: 2010-04-15
Hi All,

I would like to know the difference between an exceptiona nd bus error. Maybe some examples would be of help.

Another(out of context) question : Is it necessary to have a 'ile system' for printf( ) to work ?

Thanks,
Arut
0
Comment
Question by:arut
  • 3
  • 2
5 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12042038
There are a number of exceptions, but just an example: zero-divide. And a bus-error could be the use of an address (by means of a pointer or array) that isn't in your dataspace, i.e. that isn't accessible by your program.

If you are on linux/unix, try man 2 signal, or use Google searching for "man signal linux"
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 12042133
A fatal failure in the execution of a machine language instruction resulting from the processor detecting an anomalous condition on its bus. Such conditions include invalid address alignment (accessing a multi-byte number at an odd address), accessing a physical address that does not correspond to any device, or some other device-specific hardware error. A bus error triggers a processor-level exception which Unix translates into a "SIGBUS" signal which, if not caught, will terminate the current process.

http://computing-dictionary.thefreedictionary.com/bus%20error
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 12042153
Bus error is a kind of exception ... There are several exceptions including but not limited to what sjef_bosman said

"And a bus-error could be the use of an address (by means of a pointer or array) that isn't in your dataspace, i.e. that isn't accessible by your program."
Is segmentation fault but not bus error .. I do not thing divide by zero is a bus error either .. that should be arithmetic or floating point exception
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 125 total points
ID: 12042187
Another way of putting it

There's a subtle difference between "segmentation fault" and "bus error". A "bus error" means that the kernel didn't detect the problem on its own; the memory system (i.e. hardware) realized that there was a problem.
http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/CommonFAQ/SGIErrors.html#buserror

Some processors generate fault when you try to access non aligned memory, bus error is generally an indication of that condition
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12042286
Too subtle for me... I  must admit that "Bus Error - Core dumped" reminds me of the PDP-11 series, which indeed had word-alignment.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now