Solved

Exception/bus error

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

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…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

776 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