What is the significance of SIGBUS

What is the significance of SIGBUS? explain why SIGBUS happens?

Hint: Most certainly it happens as a result of load/store operation!!
 

=== LOAD is to load the processors' registers from the memory and STORE is vice-versa.

SIGBUS happens whenever there s a fault on the hardware bus ie whenever an attempt is made to access an invalid address or
a (un/mis)alligned address.

The bus hardware of many modern processors cannot access multi-byte objects at any memory address. So, often word-sized
objects must be aligned to word boundaries, double-words to double-word boundaries, double-floats to 8-byte boundaries,
and so on. If a program attempts to access an object that is incorrectly aligned, a bus error occurs.

Cheers
 

===You got it.

Another point here to make is that historically this error represented choking of the address bus and hence the name SIGBUS.

More than often this is the case i.e. misalinged/unalinged data access, compilers provide pragmas to correct these situations if
you know where the problem is. If not you can ask the compiler to be conservative and to byte load/store opers. Though byte
load/stores are safe from alingment point of view they will make the program suffer.

Have fun.
 

===Richard stevens in Advanced Programming in the Unix environment, page 410, says this:

Two signals are normally used with mapped [memory]regions. SIGSEGV is the signal normally used to indicate that we have
tried to access memory that is not availaable to us. It can also be generated if we try to store into a mapped region that we
specifed to mmap as read-only. The SIGBUS signal can be generated if we access a portion of the mapped region that does not make sense at the time of the access.
For example, assume we map a file using the file's size, but before we reference the mapped region the file's size is truncated by
some other process. If we then try to access the memory mapped region corresponding to the end portion of the file that was
truncated we'll receive SIGBUS.

Have a Unix Problem
Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.