Computer Science An Overview Chapter 1 PDF Notes
Computer Science An Overview Chapter 1 PDF Notes
0 1 0
AND 1 1 0
Result 0 1 0
Gates
• Gate or Logic gate: A device that computes a Boolean
operation
– Often implemented as small electronic circuits called
transistors
– Digits 0 and 1 are presented as voltage levels
– Can be constructed from a variety of other
technologies (gears, relays, optic devices)
– Provide the building blocks from which computers
are constructed
Figure 1.2 A pictorial representation of AND, OR,
XOR, and NOT gates as well as their input and output
values
Flip-flops
• Circuits built from gates that act as a fundamental unit
of computer memory
– One input line is used to set its stored value to 1
– One input line is used to set its stored value to 0
– While both input lines are 0, the most recently stored value is
preserved
– Example of
– Digital circuit design: how to build circuits from gates
– Abstract tools: many ways to build a flip-flop, but external
properties known
– How to store a bit within a modern computer
– A computer on a single chip can be built from flip-flops
Figure 1.3 A simple flip-flop circuit
Figure 1.4 Setting the output of a
flip-flop to 1
Figure 1.4 Setting the output of a
flip-flop to 1 (continued)
Figure 1.4 Setting the output of a
flip-flop to 1 (continued)
Figure 1.5 Another way of constructing a
flip-flop
Hexadecimal Notation
• Computer deals with patterns of bits, which can be long
• Example: 101101010011
• For humans hard to comprehend
• Hexadecimal notation: A shorthand notation for long bit patterns
• Divides a pattern into groups of four bits each
• Machines use bit patterns that have lengths in multiples of
four (8, 16, 32, 64, 128, 256, etc.)
• Represents each group by a single symbol
• Example: 10110101 becomes 0xB5
• Here 0x means that the following number is hexadecimal
• 1011 0101 -> B 5 (see Table 1.6)
Figure 1.6 The hexadecimal coding system
1.2 Main Memory
• Computers have a large collection of circuits capable of storing a
single bit. This is called main memory.
• Cell: A unit of main memory (typically 8 bits which is one byte)
• Small embedded systems can have a few hundred memory cells
• Desktop computers have billions of memory cells
• Most significant bit: the bit at the left (high-order) end
• Least significant bit: the bit at the right (low-order) end
Figure 1.7 The organization of a byte-size
memory cell
Main Memory Addresses
• Address: A “name” that uniquely identifies one cell in the computer’s
main memory
• The names are actually numbers.
• These numbers are assigned consecutively starting at zero.
• Numbering the cells in this manner associates an order with the
memory cells.
• The bits in main memory are in one long row, so stored bit
patterns may be longer than the length of one cell
• Example: A string of 16 bits can be stored in two consecutive
memory cells
• Bit patterns can be read from or written to a particular
memory address
Figure 1.8 Memory cells arranged by address
Memory Terminology
• Random Access Memory (RAM): Memory in which individual cells
can be easily accessed in any order
• The way computers main memory is used
• Dynamic Memory (DRAM): RAM composed of volatile memory
• Modern circuitry which is smaller and faster than flip-flops
• Needs a refresh circuit
• Synchronous DRAM (SDRAM)
• Even faster technology
Measuring Memory Capacity
• Kilobyte: 210 bytes = 1024 bytes (“about 1000 bytes”)
• Example: 3 KB = 3 times1024 bytes
Flash drive
• Check bytes
• Many related parity bits are collected to a byte -> check byte
• Collection of errors can be detected
• More general version is a Checksum where a function is used to generate the
reference value
Figure 1.26 The ASCII codes for the letters A
and F adjusted for odd parity
1.10 Communication Errors
• Parity bits only detect an error
• Error correcting codes
• Can correct errors
• Hamming Distance: the number of bits in which two bit patterns
differ
• Example Figure 1.27
• Hamming distance between patterns representing A and B is four, C and D is three
• Note in Figure 1.27 distance between bit patterns is at least three
• If a single error occurs result is not a legal pattern, and we can figure out what the
original pattern was
• To decode a message which was encoded with 1.27, we must find the reverse
code that is the same or differs with 1 bit
• See Figure 1.28
• Also longer codes can be made to correct more errors
• Used in magnetic disks and CD disks
Figure 1.27 An error-correcting code
Figure 1.28 Decoding the pattern 010100
using the code in Figure 1.27