in Technology by
What is the difference between Segmentation fault and Bus error?

1 Answer

0 votes
by

In the case of segmentation fault, SIGSEGV (11) signal is generated. Generally, a segmentation fault occurs when the program tries to access the memory to which it doesn’t have access to.

Below, I have mentioned some scenarios where SIGSEGV signal is generated.

  • When trying to de-referencing a NULL pointer.
  • Trying to access memory which is already de-allocated (trying to use dangling pointers).
  • Using uninitialized pointer(wild pointer).
  • Trying to access memory that the program doesn’t own (eg. trying to access an array element out of array bounds).

In case of a BUS error, SIGBUS (10) signal is generated. The Bus error issue occurs when a program tries to access an invalid memory or unaligned memory. The bus error comes rarely as compared to the segmentation fault.

Related questions

0 votes
    What are the common causes of the segmentation fault in C?...
asked Jan 22, 2021 in Technology by JackTerrance
0 votes
    What is segmentation fault in C?...
asked Jan 22, 2021 in Technology by JackTerrance
0 votes
    So I've got some C code: #include #include /* putting one of the "char*"s here causes a segfault ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    static storage is decided at compilation time. However, consider the scenario where we have lot of lazy ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    static storage is decided at compilation time. However, consider the scenario where we have lot of lazy ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    static storage is decided at compilation time. However, consider the scenario where we have lot of lazy ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    In my signal.h file I have added a signal handler like this: #define SIG_WPG ((__sighandler_t)3) and ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I have a class that logs on to a server and retrieves some data. The data is put in a NSMutableArray, ... [heleTeksten componentsSeparatedByString:@"\n"]; NSString *searchFor = @"...
asked Jan 16, 2022 in Education by JackTerrance
0 votes
    Differentiate between the Windows Azure bus queues and Windows Azure queues?...
asked Dec 27, 2020 in Technology by JackTerrance
0 votes
    What is the difference between syntax error and runtime error?...
asked Dec 17, 2020 in Technology by JackTerrance
0 votes
    Which one of the following is a military standard data bus? a) Mil Std 1553 b) ARINC 629 c) ARINC 429 d) COMAC C919...
asked Dec 25, 2020 in Technology by JackTerrance
0 votes
    In bus topology, the device linking all the nodes in a network is A) Router B) DropLine C) Backbone D) Hub Select the correct answer from above options...
asked Dec 25, 2021 in Education by JackTerrance
0 votes
    What is bus in computer system ?Explain the importance of bus? Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    If page size of 1MB memory is 1 KB then the number of higher order bits of address bus used to denote page number is ( ... (c) 12 (d) 9 Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
0 votes
    What is data bus? State the size of data bus used for Pentium processor. Select the correct answer from above options...
asked Dec 13, 2021 in Education by JackTerrance
...