Computer Organization: Hardware
This diagram shows the organization of the hardware in a computer.
_______________
| _________ |
| | CPU | |
| ----|---- |
| | |
| |b |
| |u |
| |s |
| ____|____ |
Secondary Storage ----|--| MM |--|---- Output Devices
Communications ----|--|rom____| |
|------|------|
|
|
Input Devices
- Main Memory (MM in the diagram).
Also known as Primary Storage
and RAM. This is where active data and programs live. Main memory is
divided into bytes, each one with a unique address. On runner,
addresses are represented by 32-bit integers, so there are 2 to the
32nd power addresses, enough for about four billion bytes.
Only some of the addresses are used, about 512 million (2 to the 29th).
Main memory is volatile, i.e., it loses its data as soon as you
turn off the power.
Access time to main memory is on the order of nanoseconds, i.e., billionths
of a second. A typical DRAM (dynamic random access memory) chip will
have an access time of about 10 to 100ns to retrieve memory from one
address.
ROM (read-only memory) is a special part of main memory that doesn't lose
its data when the computer is shut off. It contains instructions and data
used when the computer is first turned on. The instructions basically
tell the computer how to load the operating system from the hard disk
or network.
-
Secondary Storage
These are things like
- fixed disk (hard disk)
- removeable media (floppy disk, large removeable hard-disk things,
writeable CD-ROMs, "flopticals")
- tape (used mainly for backup)
Data are arranged in blocks of many bytes, usually 512 or 1024.
A hard disk is a random access device. Several platters with rotate under
several read/write heads that can move to different parts of the media.
You specify the particular block you want, the head seeks over there and gets
it.
A tape is a sequential access device; to get to block 100 you have to
"fast forward" past blocks 1 through 99. So it is slower than hard disk,
but tapes are cheaper.
The access time for hard disks is on the order of milliseconds, or thousandths
of a second. This is literally a million times slower than main memory!
Secondary storage is non-volatile. This means that the data is still there
when you turn off the power. Your files, computer programs, and other
data are stored on secondary storage.
-
Input devices
These encode human actions or other real world phenomenae, such as
- keystrokes on a keyboard,
- movement and clicks on a mouse,
- paper going through a scanner,
- voice or music over a microphone
into bits that go over the wires connecting them
to the CPU/MM via the computer's bus. Think of some examples of
input devices.
-
Output devices
These take electrical signals fron the computer and translate
them into real world actions, such as
- printing somthing on a page,
- drawing a picture on the screen,
- making sound come out of a speaker.
- Communications (not present on all computers)
This allows the computer to communicate with other computers. For example:
- network interface card + media,
- modem + phone line,
- digital phone line + adapter.
- The CPU
This is the part that executes programs.
Programs are the instructions that tell the computer what to do.
The CPU interprets the instructions, in a simple binary language called
machine language. The CPU starts executing instructions at a specified address
on startup, then does the instructions in sequence until it finds an instruction
that tells it to execute code at a different address. It might loop, doing
the same thing over and over many times.
The CPU may do numerical or other types of computations, using its
registers and MM as temporary storage for the results.
The CPU may instruct the other devices in the computer to do something,
such as get information from the disk or see if something is being typed at
the keyboard.
The ROM (read-only memory) has the initial program the computer needs to
start up. The ROM usually tells the CPU to immediately load the operating
system from the secondary storage.
A program lives on the disk until the operating system (perhaps at the
request of the user) loads a program into main memory and begins executing
it. When a program begins running, it is known as a process.
Software
Software is the part of the computer you can't touch; it's the ideas
of programmers codified into machine language, represented by electrical
impulses, that tell the computer what to do (via the CPU). (There
are other parts of the computer you shouldn't touch, like the
power supply and the inside of the monitor, but software is something
you can't touch because, in a sense, software doesn't really
exist in the real world.) Programming, the topic of this course, is the
process of writing programs (software).
There are two kinds of software: application and system
software. Application software does what people use the computer for, e.g.,
word processors, spreadsheet programs, video games, etc. System software
exists for the sake of the computer, from the operating system that organizes
and allocates resources to a program to list the files in your account.
The operating system is a big piece of system software that is
loaded into main memory when the computer first comes up, and stays there
until you turn off the computer. It manages the activities of the computer,
allocating and controlling access to resources (such as memory, CPU time,
storage, the printer, etc.) On runner, the operating system is
a version of Unix System V called Solaris. Other operating systems are
BSD Unix, Linux, MacOS, VMS, and Windows NT.
Computer Languages
In the beginning, programmers simply programmed in machine language.
This can be quite tedious, so computer scientists invented computer
languages that could be used instead of machine language. A program would
be written in this high-level language, then automatically translated
to machine language by another program.
The first computer languages were simply human-readable forms of machine
language called assembly languages. For instance, if the machine
language instruction for "add two numbers" was 100101010, the assembly
language version might be "ADD". A program called an assembler
(hence the name "assembly language") would translate the program into
machine language. Assembly language is still used today for specialized
applications.
Higher level languages were developed that used mathematical and human
language notation in place of machine instructions. Two of the first
were FORTRAN, for scientific programming, and LISP,
for list processing (used mostly for artificial intelligence).
A FORTRAN
program looks like this:
program number
integer i
do 10 i=1,10
print*, i
10 continue
stop
end
This simple program prints the numbers from 1 through 10.
A text file containing a program written in assembly or a high level
language is called a source file. It can be translated by a
compiler into a machine language file, called an object file,
that must then be linked with some other object files, and can
then be executed. On runner, the compiler and linker are accessed
through the cc command; cc stands for "C Compiler."