Solved

Exception/bus error

Posted on 2004-09-13
5
419 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

821 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