11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

itwise operations 51in terms <strong>of</strong> bytes. A byte is 8 bits or binary digits, whichamounts to a range <strong>of</strong> from 0 to 255 in terms <strong>of</strong> decimal (base10) numbers. A byte is thus enough to store a small integeror a character code in the st<strong>and</strong>ard ASCII character set(see character). Common multiples <strong>of</strong> a byte are a kilobyte(thous<strong>and</strong> bytes), megabyte (million bytes), gigabyte (billionbytes), <strong>and</strong> occasionally terabyte (trillion bytes). The actualnumbers represented by these designations are actually somewhatlarger, as indicated in the accompanying table.Further Reading“How Bits <strong>and</strong> Bytes work.” Available online. URL: http://www.howstuffworks.com/bytes.htm. Accessed April 22, 2007.One byte in memory can store an 8-bit binary number. Just as eachplace to the left in a decimal number represents the next higherpower <strong>of</strong> 10, the places in the byte increase as powers <strong>of</strong> 2. Here theplaces with 1 in them add up to a total decimal value <strong>of</strong> 213.With regard to computer architectures the number<strong>of</strong> bits is particularly relevant to three areas: (1) The size<strong>of</strong> the basic “chunk” <strong>of</strong> data or instructions that can befetched, processed, or stored by the central processing unit(CPU); (2) The “width” <strong>of</strong> the data bus over which data issent between the CPU <strong>and</strong> other devices—given the sameprocessor speed, a 32-bit bus can transfer twice as muchdata in a given time as a 16-bit bus; <strong>and</strong> (3) The width <strong>of</strong> theaddress bus (now generally 32 bits), which determines howmany memory locations can be addressed, <strong>and</strong> thus themaximum amount <strong>of</strong> directly usable RAM.The first PCs used 8-bit or 16-bit processors, whiletoday’s PC processors <strong>and</strong> operating systems <strong>of</strong>ten use 32-bits at a time, with 64-bit processors now entering the market.Besides the “width” <strong>of</strong> data transfer, the number <strong>of</strong> bitscan also be used to specify the range <strong>of</strong> available values.For example, the range <strong>of</strong> colors that can be displayed bya video card is <strong>of</strong>ten expressed as 16 bit (65,536 colors) or32 bit (16,777,777,216 colors, because only 24 <strong>of</strong> the bits areused for color information).Since multiple bits are <strong>of</strong>ten needed to specify meaningfulinformation, memory or storage capacity is <strong>of</strong>ten expressedbitwise operationsSince each bit <strong>of</strong> a number (see bits <strong>and</strong> bytes) can holda truth value (1 = true, 0 = false), it is possible to use individualbits to specify particular conditions in a system, <strong>and</strong>to compare individual pairs <strong>of</strong> bits using special operatorsthat are available in many programming languages.Bitwise operators consist <strong>of</strong> logical operators <strong>and</strong> shiftoperators. The logical operators, like Boolean operators ingeneral (see Boolean operators), perform logical comparisons.However, as the name suggests, bitwise logical operatorsdo a bit-for-bit comparison rather than comparing theoverall value <strong>of</strong> the bytes. They compare the correspondingbits in two bytes (called source bits) <strong>and</strong> write result bitsbased on the type <strong>of</strong> comparison.The AND operator compares corresponding bits <strong>and</strong>sets the bit in the result to one if both are one. Otherwise, itsets it to zero.Example: 10110010 AND 10101011 = 10100010The OR operator compares corresponding bits <strong>and</strong> setsthe bit in the result to one if either or both <strong>of</strong> the bits areones.Example: 10110110 OR 10010011 = 10110111The XOR (“exclusive OR”) operator works like ORexcept that it sets the result bit to one only if either (notboth) <strong>of</strong> the source bits are ones.Example: 10110110 XOR 10010011 = 00100101The COMPLEMENT operator switches all the bits totheir opposites (ones for zeroes <strong>and</strong> zeroes for ones).Example: COMPLEMENT 11100101 = 00011010Measurement Number <strong>of</strong> Bytes examples <strong>of</strong> Usebyte 1 small integer, characterkilobyte 2 10 1,024 RAM (PCs in the 1980s)megabyte 2 20 1,048,576 hard drive (PCs to mid-1990s)RAM (modern PCs)gigabyte 2 30 1,073,741,824 hard drive (modern PCs)RAM (latest PCs)terabyte 2 40 1,099,511,627,776 large drive arrays

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!