2.2 The Binary Number System
A computer is an electronic device thatoperates on precisely timed pulses ofelectric current. The processor reactsto pulse and no pulse patterns.
Memory holds these on/off patterns.The binary number system is ideal forrepresenting such patterns because ituses only two symbols:O and 1.
Bytes are fine for storing characters, butare too small to hold a meaningful
number. Most computers are able tomanipulate a group of bytes called aword. Some small computers have 8-bit words- Other, more powerful
machines work with 16- bit(2-byte),32 -bit(4 - byte),and even 64 -bttwords.
Thus we have a memory hierarchy.The basic unit of storage is the bit.Bits are grouped to form bytes, which,in turn,are grouped to form words,none application, a given word might beused to hold a binary number. ln
another, that word's bytes might holdindividual characters,or a programinstruction.
t's important to note that character dataand numeric data are different.
Characters are represented by a code.Each one is independent. The concept ofpositional value is irrelevant: multiplyingeach digit by its positional value and thenadding the products produces a
meaningless result. in contrast, the bitsthat form a number are coded in specificrelative positions,each of which has apositional value-1,2,4,8, and so on. Thedigit - times - place - value " rule workswith numbers, but not with characters.
2.3.3 Addressing memory
A typical microcomputer contains128,000(128K)or more bytes or
words, while a large mainframe mayhave milions: Agiven element ofdata might be stored in any one ofthem. f the processor needs a
particular data element, how does itfind the byte or word that holds it?
Each physical storage unit is assigned a unique address. onmost computers,the bytes or
words are numbered sequentially -0,1,2, and so on. The processoraccesses a specific memory
location by referencing its address.
For example, if the processor needs thedata stored in byte 1048, itasks
memory for the contents of byte 1048.Since there is only one byte 1048, theprocessor gets the right data.
Depending on the computer, bytes orwords are the basic addressable unitsof memory.Data move between theprocessor and main memory a byte oraword at a time.
2.3.4 Reading and Writing Memory
A location in main memory is accessed byits address. often,the contents of
memory are simply read. When memory isread,its contents are not changed. Forexample, imagine that byte number 42
contains the character A. If the processorreads byte 42, the A is still there.
However,writing to main memory destroysthe old contents. If the processor were towrite the character X to byte 42, the newvalue would replace the old, and the Awould be lost forever.