Bits Bytes and Words

来源:互联网 发布:linux给用户赋权限命令 编辑:程序博客网 时间:2024/06/10 08:16

Bits, Bytes and Words

bit is a BInary digiT. So a bit is a zero or a one. Bits can be implemented in computer hardware using switches. If the switch is on then the bit is one and if the switch is off then the bit is zero. A bit is limited to representing two values. 

Since the alphabet contains more than two letters, a letter cannot be represented by a bit. A byte is a sequence of bits. Since the mid 1960's a byte has been 8 bits in length. 01000001 is an example of a byte. Since there are 8 bits in a byte there are 28 different possible sequences for one byte, ranging from 00000000 to 11111111. This means that a byte can be used to represent any type of value with no more than 28 = 256 possible values. Since the number of things that you can enter on a computer keyboard is smaller than 256 (including all keystoke pairs, like shift or control plus another key), a code for a keystoke is represented with a code within a byte.

Since characters (letters, decimal digits and special characters such as punctuation marks, etc) can be represented with bytes, a standard is needed to insure that the code that's used on your computer is the same as the code that is used on mine. There are two standard codes that use one byte to represent a character, ASCII (ass'-key) and EBCDIC (ib'-suh-dik). ASCII, the American Standard Code for Information Interchange, is the code that is most commonly used today. EBCDIC, Extended Binary Coded Decimal Interchange Code, was used by IBM on its large mainframe computers in the past. Wikipedia has more than you want to know about ASCII and EBCDIC. Since these codes are limited to 256 possible combinations, certain character sets, such as Chinese, Arabic, Japanese, Klingon and others, cannot be represented using these codes. This problem is solved by using another code, Unicode, which uses 2 bytes for each character. This extension allows 216 different symbols to be represented, a total of 65,536. The use of Unicode gives more flexibility in the representation of data. The drawback of using Unicode is that it takes twice as much space to store the same number of characters.

word is the number of bits that are manipulated as a unit by the particular CPU of the computer. Today most CPUs have a word size of 32 or 64 bits. For example, the notebook computer that I bought in May 2008 contains a core 2 duo 64 bit processor. Data is fetched from memory to the processor in word size chunks and manipulated by the ALU in word size chunks. All other things being equal, (and they never are), larger word size implies faster and more flexible processing.

Further Information

Wikipedia contains exhaustive information about bits, bytes and words.

howSTUFFworks also has an article on (How Bits and Bytes Work)


0 0
原创粉丝点击