Lecture#5 A, 5 B
Lecture#5 A, 5 B
All
McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies, Inc. All
Chapter 5A
5A-3
How Computers Represent Data
• Binary number system
– Used by computers to count
– Two distinct digits, 0 and 1
– 0 and 1 combine to make numbers
5A-4
How Computers Represent Data
• Bits and bytes
– Binary numbers are made of bits
– Bit represents a switch
– A byte is 8 bits
– Byte represents one character
5A-5
How Computers Represent Data
• Text codes
– Converts letters into binary
– Standard codes necessary for data transfer
– ASCII
• American English symbols
– Extended ASCII
• Graphics and other symbols
– Unicode
• All languages on the planet
5A-6
How Computers Process Data
• The CPU
– Central Processing Unit
– Brain of the computer
– Control unit
• Controls resources in computer
• Instruction set
– Arithmetic logic unit
• Simple math operations
-Registers
5A-7
How Computers Process Data
• Machine cycles
– Steps by CPU to process data
– Instruction cycle
• CPU gets the instruction
– Execution cycle
• CPU performs the instruction
– Billions of cycles per second
– Pipelining processes more data
– Multitasking allows multiple instructions
5A-8
How Computers Process Data
• Memory
– Stores open programs and data
– Small chips on the motherboard
– More memory makes a computer faster
5A-9
How Computers Process Data
• Nonvolatile memory
– Holds data when power is off
– Read Only Memory (ROM)
– Basic Input Output System (BIOS)
– Power On Self Test (POST)
5A-10
How Computers Process Data
• Flash memory
– Data is stored using physical switches
– Special form of nonvolatile memory
– Camera cards, USB key chains
5A-11
How Computers Process Data
• Volatile memory
– Requires power to hold data
– Random Access Memory (RAM)
– Data in RAM has an address
– CPU reads data using the address
– CPU can read any address
5A-12
Components affecting Speed
5A-13
Affecting Processing Speed
• Registers
– Number of bits processor can handle
– Word size
– Larger indicates more powerful computer
– Increase by purchasing new CPU
5A-14
Affecting Processing Speed
• Virtual RAM
– Computer is out of actual RAM
– File that emulates RAM
– Computer swaps data to virtual RAM
• Least recently used data is moved
5A-15
Affecting Processing Speed
• The computer’s internal clock
– Quartz crystal
– Every tick causes a cycle
– Speeds measured in Hertz (Hz)
• Modern machines use Giga Hertz (GHz)
5A-16
Affecting Processing Speed
• The bus
– Electronic pathway between components
– Expansion bus connects to peripherals
– System bus connects CPU and RAM
– Bus width is measured in bits
– Speed is tied to the clock
5A-17
Affecting Processing Speed
• External bus standards
– Industry Standard Architecture (ISA)
– Local bus
– Peripheral control interface
– Accelerated graphics port
– Universal serial bus
– IEEE 1394 (FireWire)
– PC Card
5A-18
Affecting Processing Speed
• Peripheral control interface (PCI)
– Connects modems and sound cards
– Found in most modern computers
5A-19
Affecting Processing Speed
• Accelerated Graphics Port (AGP)
– Connects video card to motherboard
– Extremely fast bus
– Found in all modern computers
5A-20
Affecting Processing Speed
• Universal Serial Bus (USB)
– Connects external devices
– Hot swappable
– Allows up to 127 devices
– Cameras, printers, and scanners
5A-21
Affecting Processing Speed
• PC Card
– Used on laptops
– Hot swappable
– Devices are the size of a credit card
5A-22
Affecting Processing Speed
• Cache memory
– Very fast memory
– Holds common or recently used data
– Speeds up computer processing
– Most computers have several caches
– L1 holds recently used data
– L2 holds upcoming data
– L3 holds possible upcoming data
5A-23
Chapter 5A
End of Chapter
Transforming Data
Into
Information
5A-3
How Computers Represent
Data
5A-4
How Computers Represent
Data
• Text codes
– Converts letters into binary
– Standard codes necessary for data
transfer
– ASCII
• American English symbols
– Extended ASCII
• Graphics and other symbols
– Unicode
• All languages on the planet
5A-5
How Computers Represent
Data
• Number systems
– A manner of counting
– Several different number systems
exist
• Decimal number system
– Used by humans to count
– Contains ten distinct digits
– Digits combine to make larger
numbers
5A-6
Number Systems
• Binary number system
– Used by computers to count
– Two distinct digits, 0 and 1
– 0 and 1 combine to make
numbers
5A-7
Number Systems
• There are four common types of
number systems based on the radix
or base of the number :
– Decimal number system or Base 10 number
system
– Binary number system or Base 2 number
system
– Octal number system or Base 8 number
system
– Hexadecimal number system or
Base 16 number
system
5A-8
Number System Conversion
• A number N in base or radix b
can be written as:
(N)b = dn-1 dn-2 -- -- -- -- d1 d0 . d-1 d-2 -- -- -- -- d-m
5A-9
Number Systems
5A-10
Number Systems
5A-
Decimal to Binary Conversion
• Conversion steps:
• Divide the number by 2.
• Get the integer quotient for the next
iteration.
• Get the remainder for the binary digit.
• Repeat the steps until the quotient is
equal to 0.
Decimal to Binary Conversion
5A-13
Decimal to Binary Conversion
Decimal to Binary Conversion
5A-15
Binary to Decimal Conversion
• Multiply each digit starting from
the rightmost digit by the powers
of 2.
• The sum of all these values
obtained for each digit gives the
equivalent value of the given
binary number in the decimal
system.
Binary to Decimal Conversion
Binary to other Number
Systems
• There are three conversions
possible for binary number
– Binary to decimal
– Binary to octal
– Binary to hexadecimal
5A-18
Decimal to Octal Conversion
• Step 1: Check if the decimal
number is less than 8. If yes, the
octal number is the same. If no,
then proceed forward.
– 350 is more than 8 so let's go to
step 2.
• Step 2: Divide 350 by 8 (octal
base number). Note down the
quotient and the remainder
in the quotient- remainder
form. Repeat this process
(dividing the quotient again by 8)
until we get the quotient to be
less than 8.
Decimal to Octal Conversion
Octal to Decimal Conversion
• Since an octal number only uses digits from 0 to 7,
we first arrange the octal number with the power of 8.
• We evaluate all the power of 8 values such as 80 is 1,
81 is 8, etc., and write down the value of each octal
number.
• Once the value is obtained, we multiply each number.
• Final step is to add the product
of all the numbers to obtain the
decimal number.
Octal to Decimal Conversion
5A-22
Octal to Decimal Conversion
Decimal to Hexadecimal
Conversion
• Step 1: Divide the given decimal number system value by
16 and note the remainder.
• Step 2: Divide the quotient by 16. Repeat this until you get a
quotient equal to zero.
• Step 3: Use the characters A, B, C, D, E, F in place of 10,
11, 12, 13, 14, 15 in the remainders respectively, wherever
needed.
• Step 4: Follow the reverse order pattern to arrange all the
values of the remainder.
• Step 5: The obtained number is the
required hexadecimal number.
Decimal to Hexadecimal
Conversion
5A-25
Decimal to Hexadecimal
Conversion
Hexadecimal to Decimal
Conversion
To convert a hexadecimal
number to decimal, each digit
is multiplied by the
corresponding power of 16
and then the products are
added together. The rightmost
digit represents the units
place, the next digit to the left
represents the 16s place, the
next digit represents the
256s place, and so on.
•160 = 1
161 = 16
162 = 256
163 = 4,096
164 = 65,536
165 = 1,048,576
Hexadecimal to Decimal
Conversion
Hexadecimal to Decimal
Conversion
Binary to Octal Conversion
• Step 1: Consider the binary number.
• Step 2: For the integer component,
divide the binary digits into three
groups (beginning from the right)
• Step 3: For the fraction part, start
from the left.
• Step 4: Each set of three binary
digits should be converted to one
octal digit.
Binary to Octal Conversion
Binary to Octal Conversion
Octal to Binary Conversion
• For Octal
to Binary
Conversio firs
n, convert t
Numb Syste
Octa
er to ml
Numb Decim
er
and al
then
convert Syste
Decimal m
Number System
Octal to Binary Conversion
HexaDecimal to Binary
5A-35
Chapter
5B
End of
Chapter