Download Chapter 3 - The Central Processing Unit What Goes on Inside the

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Tandem Computers wikipedia , lookup

Transcript
Chapter 2
23
Chapter 3 - The Central Processing Unit
What Goes on Inside the Computer
LEARNING OBJECTIVES
• Identify the components of the central processing unit and how they work
together and interact with memory
• Describe how program instructions are executed by the computer
• Understand how data is represented in the computer
• Be able to describe how the computer finds instructions and data
• Become acquainted with personal computer chips
• Understand the measures of computer processing speed and approaches that
increase speed
CHAPTER OVERVIEW
This chapter focuses on the controlling unit inside the computer, the central
processing unit. Unlike the broader approach of the first chapter, this chapter
details how the CPU takes raw data and transforms it into meaningful
information. Students may find this one of the more technical chapters, with
many new computer terms introduced. Although it may seem daunting at first,
mastering the terms may help shrink the concepts to a manageable size.
LECTURE OUTLINE
➣ The Central Processing Unit
• The central processing unit (CPU) is a highly complex, extensive set of
electronic circuitry that executes stored program instructions.
24
Chapter 2
• The CPU consists of two parts: the control unit and the arithmetic/logic unit.
The Control Unit
• The control unit directs the entire computer system to carry out stored
program instructions.
• The control unit must communicate with both the arithmetic/logic unit and
memory.
The Arithmetic/Logic Unit
• The arithmetic/logic unit (ALU) executes arithmetic and logical operations.
• Arithmetic operations include addition, subtraction, multiplication, and
division.
• Logical operations compare numbers, letters, and special characters.
Logical operations test for three conditions:
- equal-to condition in which two values are the same;
- less-than condition in which one value is smaller than another;
- greater-than condition in which one value is larger than another.
• Relational operators (=, <, >) are used to describe the comparison
operations used by the ALU.
Registers: Temporary Storage Areas
• Registers are temporary storage areas used by the CPU for instructions or
data.
• Computers usually assign special tasks to registers, including collecting the
results of computations, keeping track of where a given instruction or piece
of data is stored in memory, and temporarily holding data taken from or
about to be sent to memory.
Chapter 2
25
➣ Memory
• Memory is the part of the computer that holds data and instructions for
processing.
• Although closely associated with the CPU, it is separate from it.
• Memory associated with the CPU is also called primary storage, primary
memory, main storage, internal storage, and main memory.
• Manufacturers often use the term RAM, which stands for random-access
memory.
➣ How the CPU Executes Program Instructions
• Many types of personal computers can execute instructions in less than onemillionth of a second; supercomputers can execute instructions in less than
one-billionth of a second.
• The CPU performs four steps in executing an instruction:
1. The control unit gets the instruction from memory.
2. The control unit decides what the instruction means and directs the
necessary data to be moved from memory to the arithmetic/logic
unit.
3. The arithmetic/logic unit performs the actual operation on the data.
4. The result of the operation is stored in memory or a register.
• The first two instructions make up what is called the instruction time, or Itime. The last two instructions make up what is called the execution time, or
E-time.
• The combination of the I-time and E-time is called a machine cycle.
• Each central processing unit has an internal clock, which produces pulses at
a fixed rate to synchronize all computer operations. A single machine-cycle
instruction is made up of a number of subinstructions, each of which must
take at least one clock cycle.
26
Chapter 2
• Each type of central processing unit is designed to understand a specific
group of instructions called the instruction set.
➣ Storage Locations and Addresses:
How the Control Unit Finds Instructions and Data
• The location in memory for each instruction and each piece of data is
identified by an address, or a number that stands for a location in computer
memory.
• An address may be compared to a mailbox in everyday life, except that the
address can hold only one item—a fixed amount of data, a number, or a
word—at any one time.
• Programmers using programming languages do not have to worry about the
actual address number, since each address is a symbolic address, using a
name to identify its location.
➣ Data Representation: On/Off
• A computer basically knows only two things: on and off. This on/off, yes/no,
two-state system is called a binary system.
• The binary system has a base of 2. This means it contains only two digits, 0
and 1, which correspond to the two states off and on.
Bits, Bytes, and Words
• Each 0 or 1 in the binary system is called a bit (for binary digit). The bit is
the basic unit for storing data in computer memory (0 means off, 1 means
on). Since a bit is always either on or off, the computer is always storing
some kind of data.
• Single bits cannot store all the numbers, letters, and special characters (such
as $ and ?) that must be processed by a computer. The bits are put together
in a group called a byte (pronounced “bite”).
Chapter 2
27
• A byte usually holds 8 bits and represents one entity, like a character of data
such as a letter, digit, or special character.
• Computer manufacturers use bytes to express the capacity of memory and
storage. A kilobyte (KB or K) is 1024 or approximately 1000 bytes, a
megabyte (MB) is (1024 x 1024) or approximately one million bytes, and a
gigabyte (GB) is approximately a billion bytes.
• A computer word is defined as the number of bits that constitute a common
unit of data, as defined by the computer system, varying from early 8-bit
personal computers to powerful 64-bit machines.
Coding Schemes
• Coding schemes define which particular set of bits represents which
character of data.
• A common coding scheme for representing numbers, letters, and special
characters is ASCII (pronounced “AS-key”), which stands for American
Standard Code for Information Interchange. ASCII uses 7 bits for each
character; the more common ASCII-8 uses 8 bits per character.
➣ Personal Computer Chips
• Computer chips are attached to a motherboard, the flat board within the
personal computer housing.
• The motherboard also holds expansion slots, into which circuit boards for
peripheral devices can be inserted.
Microprocessors
• A central processing unit, or processor, on a chip is a microprocessor, or
microchip for short.
28
Chapter 2
• A microprocessor may be called a logic chip when it is used to control
specialized devices such as the fuel system of a car.
• Microprocessors contain tiny transistors, electronic switches that may or
may not allow current to pass through. If current passes through, the switch
is on, representing the 1 bit. If current does not pass through, the switch is
off, representing a 0 bit.
• Microprocessors usually include these key components: a control unit and an
arithmetic/logic unit (the central processing unit), registers, and a clock.
Clocks are often on a separate chip in personal computers.
Memory Components
• Historically, memory components have evolved from primitive vacuum tubes
to today's modern semiconductors.
Semiconductor Memory
• Most modern computers use semiconductor storage because it has several
advantages: reliability, compactness, low cost, and lower power usage.
• Since semiconductor memory can be mass-produced economically, the cost
of memory has been considerably reduced.
• Semiconductor storage has the disadvantage of being volatile: it requires
continuous electric current to represent data. If the current is interrupted, the
data is lost.
• Semiconductor storage is made up of thousands of very small circuits—
pathways for electric currents—on a silicon chip.
• A chip is described as monolithic because the circuits on a single chip
compose an inseparable unit of storage.
Chapter 2
29
• One important type of semiconductor design is called complementary
metal oxide semiconductor, or CMOS, known for low power consumption,
and thus of particular use for portable computers.
RAM and ROM
• Random-access memory (RAM) keeps the instructions and data for
whatever programs you happen to be using at the moment. RAM can be
erased or written over at will by the computer software.
• A personal computer's RAM can be augmented with extra memory chips or
by installing a single in-line memory module (SIMM), a board that
contains memory chips.
• RAM is often divided into two types: static RAM (or SRAM) and dynamic
RAM (or DRAM). DRAM must be constantly refreshed (recharged) by the
central processing unit or it will lose its contents—hence the name dynamic.
Although SRAM is faster, DRAM is used in most personal computer
memory because of its size and cost advantages.
• Read-only memory (ROM) contains programs and data that are
permanently recorded into this type of memory at the factory; they can be
read and used, but they cannot be changed by the user. ROM is nonvolatile.
• Using specialized tools called ROM burners, the instructions within some
ROM chips can be changed. These chips are known as PROM chips, or
programmable read-only memory chips.
➣ Speed and Power
• The characteristic of speed is universally associated with computers. Power is
a derivative of speed, as well as other factors such as memory size.
30
Chapter 2
Computer Processing Speeds
• There is a wide diversity of computer speeds. The execution of an instruction
on a very slow computer may be measured in less than a millisecond, which
is one-thousandth of a second. Most computers can execute an instruction
measured in microseconds, one-millionth of a second, some in a
nanosecond—one-billionth of a second, and someday in a picosecond—onetrillionth of a second.
• Microprocessor speeds are usually expressed in megahertz (MHz), millions
of machine cycles per second.
• Another measure of computer speed is MIPS, which stands for one million
instructions per second.
• A third measure of speed is the megaflop, which stands for one million
floating-point operations per second. It measures the ability of the computer
to perform complex mathematical operations.
Bus lines
• A bus line is a set of parallel electrical paths that internally transports data
from one place to another within the computer system. The amount of data
that can be carried at one time is called the bus width—the number of
electrical paths.
• The larger the word size or bus, the more powerful the computer. A larger
bus size means:
-the computer can transfer more data at a time, making the computer faster.
- the computer can reference larger numbers, allowing more memory.
- the computer can support a greater number and variety of instructions.
Chapter 2
31
Cache
• A cache (pronounced "cash") is a relatively small amount of very fast
memory designed for the specific purpose of speeding up internal transfer of
data and software instructions by storing those that are most recently and/or
most frequently used.
• Internal cache is built into the processor’s design; external cache is on a
separate chip.
Flash Memory
• Flash memory is non-volatile.
• Flash chips are currently being used in cellular phones and cockpit flight
recorders, and they are replacing disks in some hand-held computers.
RISC Technology: Less Is More
• RISCs—reduced instruction set computers—offer only a small subset of
instructions; the absence of a set of complex instructions increases speed.
• Conventional computers (called CISCs, or complex instruction set
computers) have many built-in instructions that are rarely used.
• RISC computers execute at speeds four to ten times those of CISC
computers.
Parallel Processing
• Parallel processing uses several processors at the same time, each with its
own memory unit, working at the same time.
• This is in contrast to conventional serial processing, which uses one
processor and processes one instruction at a time.
• A variation is pipelining, in which an instruction’s actions need not be
complete for another instruction to begin.