|
|
![]() |
Figure 1: The Central Processing Unit |
Before we discuss the control unit and the arithmetic/logic unit in detail,
we need to consider data storage and its relationship to the central processing unit. Computers use two types of storage: Primary storage and secondary
storage. The CPU interacts closely with primary storage, or main memory, referring to it for both instructions and data. For this reason this part of
the reading will
discuss memory in the context of the central processing unit. Technically,
however, memory is not part of the CPU.
Recall that a computer's memory holds data only temporarily, at the time
the computer is executing a program. Secondary storage holds permanent
or semi-permanent data on some external magnetic or optical medium. The
diskettes and CD-ROM disks that you have seen with personal computers
are secondary storage devices, as are hard disks. Since the physical attributes of
secondary storage devices determine the way data is organized on them, we will
discuss secondary storage and data organization together in
another part of our on-line readings.
Now let us consider the components of the central processing unit.
To see how registers, memory, and second storage all work together, let us
use the analogy of making a salad. In our kitchen we have:
The refrigerator is the equivalent of secondary (disk) storage. It can store high volumes of veggies for long periods of time. The counter top is the equivalent of the computer's motherboard - everything is done on the counter (inside the computer). The cutting board is the ALU - the work gets done there. The recipe is the control unit - it tells you what to do on the cutting board (ALU). Space on the counter top is the equivalent of RAM memory - all veggies must be brought from the fridge and placed on the counter top for fast access. Note that the counter top (RAM) is faster to access than the fridge (disk), but can not hold as much, and can not hold it for long periods of time. The corners of the cutting board where we temporarily store partially chopped veggies are equivalent to the registers. The corners of the cutting board are very fast to access for chopping, but can not hold much. The salad bowl is like a temporary register, it is for storing the salad waiting to take back to the fridge (putting data back on a disk) or for taking to the dinner table (outputting the data to an output device).
Now for a more technical example.
let us look at how a payroll program uses all three types of
storage. Suppose the program calculates the salary of an employee. The
data representing the hours worked and the data for the rate of pay are
ready in their respective registers. Other data related to the salary
calculation-overtime hours, bonuses, deductions, and so forth-is waiting
nearby in memory. The data for other employees is available in secondary
storage. As the CPU finishes calculations about one employee, the
data about the next employee is brought from secondary storage into
memory and eventually into the registers.
The following table summarizes the characteristics of the various kinds of
data storage in the storage hierarchy.
Storage | Speed | Capacity | Relative Cost ($) | Permanent? |
Registers | Fastest | Lowest | Highest | No |
RAM | Very Fast | Low/Moderate | High | No |
Floppy Disk | Very Slow | Low | Low | Yes |
Hard Disk | Moderate | Very High | Very Low | Yes |
For more detail on the computer's memory hierarchy, see the How Stuff Works pages on computer memory.. This is optional reading.
![]() |
Figure 2: The Machine Cycle |
![]() |
Figure 3: The Machine Cycle in Action |
It is one thing to have instructions and data somewhere in memory and
quite another for the control unit to be able to find them. How does it do
this?
![]() |
Figure 4: Memory Addresses Like Mailboxes |
Now that we see conceptually how a computer works, we will look at the hardware components that make up the internals os a modern computer. Click here to continue the required reading.