Datasheet
528
An Overview of Programming
Figure 1-1 shows a simplified view of a computer, highlighting the major
parts that are important to a programmer.
Figure 1-1:
A simplified
view of a
computer
and how
it runs
programs.
User
Memory
Transient storage where programs are
loaded and executed by the CPU
Central Processing Unit (CPU)
The computer’s brain — the microprocessor —
that executes the instructions contained in
the program loaded into memory
Hard Drive
Permanent storage where programs are
loaded and data is stored in files
Output
Input
At the heart of a computer is the central processing unit (CPU) that performs
the instructions contained in a computer program. The specific piece of
hardware that does the job (which its makers call a microprocessor and the
rest of us call a chip) varies by system: In a Pentium PC, it’s a Pentium; in a
Sun SPARC workstation, it’s a SPARC chip; in an HP UNIX workstation, it’s
a PA-RISC chip. These microprocessors have different capabilities but the
same mission: Tell the computer what to do.
Random Access Memory (RAM), or just memory, serves as the storage for
computer programs while the CPU executes them. If a program works on
some data, that data is also stored in memory. The contents of memory
aren’t permanent; they go away (never to return) when the computer is shut
down or when a program is no longer running.
The hard drive (also referred to as the hard disk or disk) serves as the per-
manent storage space for computer programs and data. The hard drive is
organized into files, which are in turn organized in hierarchical directories
and subdirectories (somewhat like organizing paper folders into the draw-
ers in a file cabinet). Each file is essentially a block of storage capable
of holding a variety of information. For example, a file may be a human-
readable text file — or it may be a collection of computer instructions that
makes sense only to the CPU. When you create computer programs, you
work a lot with files.
42_770191-bk08ch01.indd 52842_770191-bk08ch01.indd 528 8/6/10 9:51 AM8/6/10 9:51 AM