Programming and Problem Solving with Java

(やまだぃちぅ) #1
1.6 What’s Inside the Computer? | 21

The part of the computer that fol-
lows instructions is called the central
processing unit (CPU). The CPU usually has
two components. The arithmetic/logic unit
(ALU)performs arithmetic operations
(addition, subtraction, multiplication,
and division) and logical operations
(comparing two values). The control unit
manages the actions of the other com-
ponents so that program instructions
execute in the correct order.
To use computers, we must have
some way of getting data into and out of
them.Input/output (I/O) devicesaccept
data to be processed (input) and present data that have been processed (output).
A keyboard is a common input device, as is a mouse, a “pointing” device. A video
display is a common output device, as are printers and liquid crystal display (LCD)
screens.
For the most part, computers simply move and combine data in memory.
The many types of computers differ primarily in terms of the size of their mem-
ory, the speed with which data can be recalled, the efficiency with which data can
be moved or combined, and limitations on I/O devices.
When a program is executing, the computer proceeds through a series of
steps, making up the fetch-execute cycle:


1.The control unit retrieves (fetches) the next coded instruction from
memory.
2.The instruction is translated into control signals.
3.The control signals tell the appropriate unit (arithmetic/logic unit,
memory, I/O device) to perform (execute) the instruction.
4.The sequence is repeated beginning from Step 1.

Computers can support a wide variety of peripheral devices. An auxiliary storage
device, or secondary storage device, holds coded data for the computer until we ac-
tually want to use the data. Instead of inputting data every time, we can input it
once and have the computer store it onto an auxiliary storage device. Whenever
we need to use the data, we simply tell the computer to transfer the data from the
auxiliary storage device to its memory. An auxiliary storage device therefore
serves as both an input device and an output device.
Typical auxiliary storage devices include disk drives and magnetic tape drives.
A disk drive is like a cross between a compact disc player and a tape recorder. It uses
a thin disk made out of magnetic material. A read/write head (similar to the


Central processing unit (CPU)
The part of the computer that
executes the instructions (ob-
ject code) stored in memory;
made up of the arithmetic/logic
unit and the control unit
Arithmetic/logic unit (ALU)
The component of the central
processing unit that performs
arithmetic and logical
operations
Control unit The component
of the central processing unit
that controls the actions of the
other components so that
instructions (the object code)
execute in the correct
sequence
Input/output (I/O) devices
The parts of the computer that
accept data to be processed (in-
put) and present the results of
that processing (output)
Peripheral device An input,
output, or auxiliary storage de-
vice attached to a computer
Auxiliary storage device A
device that stores data in
encoded form outside the com-
puter’s main memory

Your data

Your program

MEMORY

Figure 1.11 Memory
Free download pdf