Citizendia
Your Ad Here

In computing, a bus error is generally an attempt to access memory that the CPU cannot physically address. Computing is usually defined like the activity of using and developing Computer technology Computer hardware and software. Computer data storage, often called storage or memory, refers to Computer components devices and recording media that retain digital Bus errors can also be caused by any general device fault that the computer detects. A bus error rarely means that computer hardware is physically broken - it is normally caused by a bug in a program's source code. Typical PC hardware A typical Personal computer consists of a case or chassis in a tower shape (desktop and the following parts Motherboard A software bug (or just “bug” is an error flaw mistake Failure, fault or “undocumented feature” in a Computer program that prevents it Computer programs (also software programs, or just programs) are instructions for a Computer. In Computer science, source code (commonly just source or code) is any sequence of statements or declarations written in some Human-readable

There are two main causes of bus errors:

non-existent address 
The CPU is instructed by software to read or write a specific physical memory address. In Computer science, a memory address is an identifier for a memory location at which a Computer program or a hardware device can store a piece of data Accordingly, the CPU sets this physical address on its address bus and requests all other hardware connected to the CPU to respond with the results, if they answer for this specific address. An address bus is a Computer bus, controlled by CPUs or DMA -capable Peripherals for specifying the Physical addresses of computer If no other hardware responds, the CPU raises an exception, stating that the requested physical address is unrecognised by the whole computer system. Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of a condition that changes the normal flow of execution Note that this only covers physical memory addresses. When software tries to access an undefined virtual memory address, that is generally considered to be a segmentation fault rather than a bus error. A segmentation fault (often shortened to segfault) is a particular error condition that can occur during the operation of Computer software.
unaligned access 
Most CPUs are byte-addressable, where each unique memory address refers to an 8-bit byte. A byte (pronounced "bite" baɪt is the basic unit of measurement of information storage in Computer science. Most CPUs can access individual bytes from each memory address, but they generally cannot access larger units (16 bits, 32 bits, 64 bits and so on) without these units being "aligned" to a specific boundary, such as 16 bits (addresses 0, 2, 4 can be accessed, addresses from 1, 3, 5, are unaligned) or 32 bits (0, 4, 8, 12 are aligned, all addresses in-between are unaligned). Attempting to access a value larger than a byte at an unaligned address can cause a bus error.

CPUs generally access data at the full width of their data bus at all times. In Computer architecture, a bus is a subsystem that transfers data between computer components inside a Computer or between computers To address bytes, they access memory at the full width of their data bus, then mask and shift to address the individual byte. This is inefficient, but tolerated as it is an essential feature for most software, especially string-processing. In Computer programming and some branches of Mathematics, a string is an ordered Sequence of Symbols. Unlike bytes, larger units can span two aligned addresses and would thus require more than one fetch on the data bus. It is possible for CPUs to support this, but this functionality is rarely required directly at the machine code level, thus CPU designers normally avoid implementing it and instead issue bus errors for unaligned memory access. Machine code or machine language is a system of instructions and data executed directly by a Computer 's Central processing unit.

Example

This is an example of un-aligned memory access, written in the C programming language. tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured

#include <stdlib. h>
int main (void) {
  /* iptr is a pointer to an integer, usually 32 or 64 bits in size.  It is currently undefined.  */
  int x, *iptr;

  /* cptr is a pointer to a character (the "smallest addressable unit" of the CPU, normally a byte) */
  char *cptr;

  /* malloc() gives us a valid, aligned memory address.  put this in cptr */
  cptr = (char*)malloc(33);
  if (!cptr) return 1;

  /* increment cptr by 1.  It is now unaligned */
  cptr++;

  /* it is OK to access individual bytes from unaligned addresses */
  x = *cptr;

  /*  copy cptr into iptr */
  iptr = (int *) cptr;
  /* this will cause a bus error - accessing more than 1 byte from an unaligned address */
  x = *iptr;

  return 0;
}



See also

A segmentation fault (often shortened to segfault) is a particular error condition that can occur during the operation of Computer software. In Software development, a Software project's bus factor is an irreverent measurement of concentration of information in a single person or very few people
© 2009 citizendia.org; parts available under the terms of GNU Free Documentation License, from http://en.wikipedia.org
Dapyx Software network: MP3 Explorer | Ebook Manager | Zenithic