Chapter 1 Readings: 1.3 How Computers Store Data
Fundamental Computer Memory Architecture
All data stored within a computer is converted into sequences of s and s. Computer memory is partitioned into tiny storage locations called bytes. A single byte contains enough memory to store a letter of the alphabet or a small number. To perform meaningful tasks, computers require millions or billions of bytes of memory.
Each byte is subdivided into smaller storage locations called bits. The term bit is an acronym for binary digit. Conceptually, bits operate as tiny switches that can exist in either an on or off position. Physically, bits in most computer systems are minute electrical components that hold either a positive or a negative charge:
A positive electrical charge represents a switch in the on position ().
A negative electrical charge represents a switch in the off position ().
A byte can be visualized as a contiguous collection of switches, each flipped to an on or off position. When data is saved to a byte, the computer sets these bits to an on/off pattern that explicitly represents that specific piece of data. For instance, storing the decimal number produces a specific -bit on/off pattern, whereas storing the uppercase letter A produces a distinct -bit pattern.
Binary Number System and Numerical Calculation
Bits represent numbers based on their state. In computer systems, an off bit represents the value , and an on bit represents the value . This binary state directly aligns with the binary numbering system, where all numerical values are expressed as sequences of s and s (such as the binary sequence ).
In the binary numbering system, each digit position carries a specific positional value. Moving from the rightmost digit toward the left, positional values increase as powers of :
Rightmost position ( bit from right):
Second position from right ( bit):
Third position from right ( bit):
Fourth position from right ( bit):
Fifth position from right ( bit):
Sixth position from right ( bit):
Seventh position from right ( bit):
Eighth position from right ( bit):
To determine the total value of a binary number, the positional values corresponding to all bits set to are summed together.
Calculation Example: Binary Number 10011101
For the binary number , the bits set to correspond to positional values , , , , and :
Thus, the binary sequence equals the decimal value .
Byte Storage Limits and Multi-Byte Storage
Minimum Byte Value: When all bits in a byte are set to (turned off), the byte holds a value of .
Maximum Byte Value: When all bits in a byte are set to (turned on), the byte holds its maximum possible value:
Because a single byte contains only bits, it cannot store numbers larger than . To store values greater than , multiple bytes are combined:
Combining bytes provides bits.
Positional values for bits range from up through .
The maximum value achievable across bytes ( bits) is 65,535$.\n- Values exceeding 65,535 require additional bytes.\n\nProgrammers do not need to manually execute binary conversions while coding, but understanding internal memory behavior aids long-term programming mastery.\n\n# Character Encoding Schemes: ASCII and Unicode\n\nAll data stored in memory must ultimately be formatted as binary numbers. Non-numeric data, such as letters and punctuation marks, must first be mapped to a numeric code. That numeric code is then converted into a binary number and stored in memory.\n\n## ASCII (American Standard Code for Information Interchange)\n- Developed in the early 1960s and adopted by nearly all computer manufacturers.\n- Pronounced "askee".\n- Comprises a set of 128 numeric codes representing English letters, punctuation marks, and other characters.\n- Code Examples:\n - Uppercase letter A maps to ASCII code 6565).\n - Uppercase letter B maps to ASCII code 66.\n - Uppercase letter C maps to ASCII code 67$.
Limitation: ASCII is strictly restricted to total characters.
Unicode
Developed in the early 1990s to overcome ASCII limitations.
Serves as an extensive encoding scheme compatible with ASCII.
Capable of representing character sets across many world languages.
Rapidly becoming the standard character encoding scheme across the computing industry.
Advanced Numeric Storage Techniques
Standard binary notation only accommodates non-negative integers starting at . It cannot directly encode negative numbers or real (floating-point) numbers such as . Computer systems employ specialized encoding schemes to convert these complex numbers into binary:
Negative Numbers: Encoded using a technique known as two's complement.
Real Numbers: Encoded using floating-point notation.
Digital Media Representation: Images and Sound
Computers are classified as digital devices because they operate on binary numbers. Digital data refers to any data stored in binary format, and a digital device refers to any hardware device that processes binary data.
Image Storage Mechanisms
Photographs taken with digital cameras consist of microscopic dots of color known as pixels (short for picture element).
Every pixel in an image is assigned a unique numeric code corresponding to its color.
This numeric color code is stored in memory as a binary number.
Audio Storage Mechanisms
Songs played on digital music players (such as CD players, iPods, or MP3 players) are broken into small segments called samples.
Each individual sample is converted into a binary number and saved in memory.
Increasing the number of samples per second yields higher playback quality, closely matching the original sound.
Standard CD-quality audio splits sound into more than samples per second.
Questions & Discussion
Question 1.12
What amount of memory is enough to store a letter of the alphabet or a small number?
Answer: A byte.
Question 1.13
What do you call a tiny “switch” that can be set to either on or off?
Answer: A bit.
Question 1.14
In what numbering system are all numeric values written as sequences of 0s and 1s?
Answer: The binary numbering system.
Question 1.15
What is the purpose of ASCII?
Answer: ASCII (American Standard Code for Information Interchange) provides a set of numeric codes used to represent English letters, punctuation marks, and other characters in computer memory.
Question 1.16
What encoding scheme is extensive enough to represent all the characters of many of the languages in the world?
Answer: Unicode.
Question 1.17
What do the terms digital data and digital device mean?
Answer: Digital data is data stored in binary format. A digital device is any device that processes or works with binary data.