CS221 Lecture: Course Introduction: From Abstract Automata 10/17/95
to Real Computers; The Levels of Computer Structure
Objectives:
1. Introduce course, requirements
2. Tie this course into CS220
3. Briefly introduce binary representations for numbers - to be covered in
detail later.
4. Overview levels of structure of a "real" computer
Materials: Technology Samples, Transparency of IAS machine instructions
I. Preliminaries: Roll, Syllabus
- ------------- ---- --------
II. From Abstract Automata to Real Computers
-- ---- -------- -------- -- ---- ---------
A. You have spent the last seven weeks learning about various abstract
models of computation. Much of this work was actually done before the
first computer was built - e.g. Turing's paper on the halting problem
was published in 1937, almost a decade before the first computers were
built.
B. Not surprisingly, actual computers are built on the foundation of this
theoretical work. However, a number of practical considerations dictate
that actual computers differ in some significant ways from the abstract
models you have studied.
1. The abstract models (from the PDA up) assume some sort of infinite
memory (the stack of the PDA or the tape of the Turing machine).
No real machine can be infinite!
2. The abstract models allow for an arbitrary size alphabet. But - at
least with present technology - it is not possible to build systems
that can reliably directly represent a large number of different
symbols.
3. The "programming model" of the abstract machines is not particularly
usable - designing a Turing machine solution to even a simple
problem can be quite difficult, and the correspondence between the
solution and the problem is not at all obvious to the reader.
4. Abstract automata - Turing machines in particular - tend to do a lot
of computation to solve even simple problems, largely due to the need
to move the tape back and forth because only one spot on the tape is
accessible at a time - they are not very efficient problem solvers.
C. Actual computers are based on an architecture proposed by Jon Von Neumann
in a paper written 1946 entitled "Preliminary Discussion of the Logical
Design of an Electronic Computing Instrument".
1. There is a long line of development which led up to this proposal,
starting with Pascal's calculator and progressing through Babbage's
analytical engine and various machines built in the late 1930's and
1940's, and including the theoretical work done by Turing and others.
2. Von Neumann's paper clearly built on this previous work, but contained
two proposals that were especially important:
a. The use of the binary system for representing numbers internally
(as opposed to the arbitrary alphabets of abstract automata or
various decimal schemes used in earlier actual computers).
i. That is, the alphabet of a Von Neumann machine consists of the
set { 0, 1 }. More complex information is represented by strings
of these symbols - e.g. (as we shall learn later) - the letter
"A" is represented by 01000001 on most computers.
ii. We will cover binary representation of information in detail
later in the course, but for now we can note that with this
representation it is possible to represent any non-negative
integer easily by using a place value system - e.g. the bit
string 101010 can represent the decimal number 42 by interpreting
it as
1 x 2^5 = 32
+ 0 x 2^4 = 0
+ 1 x 2^3 = 8
+ 0 x 2^2 = 0
+ 1 x 2^1 = 2
+ 0 x 2^0 = 0
---
42
iii. Binary representation facilitates the construction of robust
computing machines, because there are many physical systems
that are BISTABLE (have two stable states) - e.g.
Electrical switchs (on, off)
Magnetic media (magnetized in one direction or the other)
b. The stored program concept (in contrast to the hardwired transition
tables of abstract automata or the use of plugboards, punched cards
or tape, or the like in earlier actual computers). This is the
idea that a single linearly addressable memory might be used to hold
both the program that controls the computation and the data the
program manipulates.
i. Von Neumann machines utilize random access memories - in which
any cell is equally accessible at any time. This contrasts
with the tape of the Turing machine or the stack of the PDA.
- Each cell in the memory holds a finite, fixed number of bits
(called the word size of the machine), normally interpreted
as representing a binary integer (though other interpretations
are possible depending on the context.)
- The machine originally implemented by VonNeumann's group
used a word size of 40 bits, and so could represent integers
in the range of approximately 0..10^12 or -5x10^11 .. 5x10^11
- Modern computer memories typically have a basic cell size
of one BYTE - 8 bits - but also allow accessing groups of
2 or more adjacent bytes as a single unit. The largest
such group is then called the word size of the machine, and
is typically 32 or 64 bits (4 or 8 bytes) for modern
computers. (However, the microprocessors used in embedded
systems such as home appliance controllers may use the byte
as their word size).
- Each cell in the memory has a distinct ADDRESS, which is an
integer in the range 0 .. some power of 2 - 1. The range of
permissible addresses is called the ADDRESS SPACE.
- The machine produced by Von Neumann's group had a memory
of 4096 words - i.e. addresses ranged from 0 .. 4096
(2^12 - 1).
- In modern computers, it is common for the word size and the
address space to be related = address space size =
2^word size. Thus, many modern computers with a word size
of 32 bits have an address space of 4 Gigabytes = 2^32
- Terminology:
BYTE: Group of 8 bits
ADDRESSABLE UNIT: Size of a basic memory cell that has its
own distinct address. Today, almost always one byte.
ADDRESS: Unique number assigned to a given addressable unit.
ADDRESS SPACE: Maximum number of distinct addresses possible =
maximum number of addressable units that can be
present. Today, typically 2^32.
WORD: Group of 1 or more bytes that are transferred to/from
memory and/or processed together as a single unit.
(Always equal to the addressable unit or a multiple of
the addressable unit)
WORDSIZE OF A MACHINE: Size of the (largest) word a given
machine can process (or can process with full
generality; some machines can perform a limited number
of operations on groups twice or more times as large
as their normal word size. Today, typically 32 bits
(64 on very high end systems)
- In addition to their random access memories, computers
based on the VonNeumann architecture have one or more
special memory cells called REGISTERS. The number of
registers is usually small - generally much less than 100.
- Instead of having addresses, registers have names, specified
as part of the machine's architecture.
- A register is typically implemented using a technology that
allows faster to the data it contains than regular memory
allows.
ii. Von Neumann style computers fetch and interpret instructions
(which are bit strings) - usually from successive locations in
memory. One part of each instruction is an operation code
(op-code) which specifies which instruction (from a fixed
repertoire) the machine is to perform. Many instructions also
contain addresses of one or more locations in memory from
which the operands are to be fetched. All instructions make
use of some of the registers.
- One register (typically called the INSTRUCTION REGISTER (IR))
holds the instruction currently being interpreted.
- Another register (typically called the PROGRAM COUNTER (PC))
holds the address of the memory cell (or beginning of a
group of memory cells) holding the NEXT instruction to be
executed.
- Most instructions also use or alter one or more other
registers.
3. Von Neumann's ideas were implemented soon thereafter in several
different forms. Of these, the most historically important was one
implemented by a group (of which Von Neumann was a part) at the
Institute of Advanced Studies at Princeton in the late 1940's. Though
it was not the first stored program computer to become operational (the
EDSAC designed by Wilkes and others at Cambridge University holds this
honor), it is commonly regarded as the ancestor of the main line of
computer development which has continued to this day. Virtually all
computers have a design that is obviously descended from this machine.
4. The basic design, as described in Burks, Goldstine, and Von Neumann,
"Preliminary Discussion of the Logical Design of an Electronic
Computing Instrument" (reprinted in Bell and Newell (1971) pp. 92-119):
- - - - - - - CONTROL - - - - - - Solid lines: flow of data
| | ^ < -| | Dashed lines: flow of control
|
v | | | v
INPUT - - > MEMORY OUTPUT
| | ^ | | ^
| | | |
| |- - > | v - -| |
|-----------> A.L.U. ------------|
a. Memory: 4096 words of 40 bits each, implemented using CRT's
b. ALU:
Single 40-bit accumulator + 40-bit MQ register used to allow
double-length operands for multiplication and division
2's complement, fixed point arithmetic used, with provision for all
four basic arithmetic operations plus negation and absolute value
Notice that all data going into or out of the machine passed through
the accumulator in the ALU.
c. Control:
Capable of executing up to 64 different instructions, each
consisting of a 6 bit op-code and 12 bit address. (Two 18 bit
instructions were packed into one memory word, with 4 bits left
over.) Of the 64 possible operations allowed for by this encoding,
fewer than 30 were actually used for the machine as built.
TRANSPARENCY - IAS MACHINE INSTRUCTION SET
Most instructions performed an operation involving the accumulator
and a memory cell - e.g. LOAD, STORE, ADD.
Instruction sequencing handled by a single program counter register.
Two registers used to store instructions - one to hold the one
currently being executed and one to hold the next one if it comes
from the other half of the same memory word. (This particular
machine was idiosyncratic in that the instruction size was less
than one addressable unit. I can't think of another example of
a machine for which this is true)
d. The execution cycle of this machine could be described as follows:
while not halted do
begin
fetch an instruction from memory (Symbolically: IR <- M[PC])
update program counter (Symbolically: PC <- PC + 1)
decode instruction
execute instruction
end
D. The ensuing 40 years have seen multitudinous developments of each
aspect of this machine, yet the family resemblance is still there,
albeit faintly in some cases. (cf Chihuahua's and Great Danes -
both recognizable as distant cousins of the wolf.) All general
purpose computers in use today are, in fact, descendants of the
Von Neumann architecture. It is common to classify computers by
technology and size.
1. Technology: (SHOW SAMPLES)
a. First generation: vacuum tubes (1950 .. 1958)
b. Second generation: individual transistors (1958 .. 1964)
c. Third generation: integrated circuits (1964 .. present, with
increasing levels of integration (SSI, MSI, LSI, VLSI)
d. Fourth generation: microprocessors - complete CPU's on a single
chip (1972 .. present)
2. Size
a. Microprocessors - CPU or even complete system on a single chip
Example: All PC's are based on these
b. Minicomputers - Multi-user systems, based on LSI or VLSI chips.
Example: DEC PDP-8, PDP-11, VAX (supermini) and many others
c. Mainframes - Multi-user systems, with one (or more) CPU's and
one or more IO processors to allow high-volume IO.
Example: IBM 360/370 family and many others
d. Supercomputers - Very fast systems using extensive parallelism
for computation-intensive tasks
Example: Cray and many others
Modern technological developments are tending to blur these
distinctions. In particular, the minicomputer is tending to merge
with the micro on one end and the mainframe oon the other.
E. The structure of the Von Neumann machine has helped to give shape to
a course like this one and CS222 in the spring:
1. We begin with a consideration of the fundamental building blocks (logic
gates, sequential circuits, and registers). Today's technology is,
of course, quite different from that used by Von Neumann's group; but
the same kinds of basic building blocks are used, albeit implemented
very differently.
2. We then move to a study of the various components of a computer
system of the Von Neumann sort:
a. Memory (now much more diverse than in Von Neumann's day.)
b. The ALU (lecture topic: Arithmetic Processing and Algorithms).
c. Functionality and Internal organization of the CPU (Functions,
Basic CPU Organization and Design)
d. Control (CS222)
e. IO Devices and Interfacing (CS222)
3. When we get to current architectural frontiers at the end of CS222,
we will begin looking at so-called non Von Neumann architectures.
Such architectures represent attempts to address the key problem of
Von Neumann machines: to so-called "Von Neumann bottleneck" - the path
between memory and the CPU through which all instructions and data
must flow. (But more on this later.)
F. A final note on the relationship of CS221/222 to CS220
1. CS220 deals with abstract models of computation that turn out not to
be suitable for direct implementation as practical computers.
a. FSM's can be implemented directly (in fact, you will do so in a
lab later in this course), but are of limited computational power.
b. It is impossible to implement a Turing machine with an infinite
tape. Although one could implement a Turing machine with a large
finite tape, the resultant machine would be difficult to program
and would spend an excessive amount of time on tape movement.
2. CS221/222 deal with real computers, which turn out to be "scruffy"
and "ad hoc"; thus it is hard to analyze their formal properties
directly (what are their capabilities and limitations?)
3. It can be proven that Turing machines and VonNeumann machines are
computationally equivalent, subject to limits on memory - i.e.
any problem that can be solved by a TM can be solved by a VNM with
a suitable amount of memory, and vice versa. Thus, the theoretical
analysis done in CS220 carries over to real computers discussed
in CS221/222.
4. Finite state machines, though computationally limited, turn out to
be very useful, too.
a. The control unit of a real computer contains, at its core, an FSM.
b. FSM's turn out to be a useful tool for software specification and
design.
Example: The elevator problem.
c. FSM's can be simulated by software; many practical problems can
be solved this way.
5. Similarly, PDA's turn out to be useful in the design of compilers,
since most programming languages are context free. One design
technique for compilers is based on creating a software simulation of
a PDA that accepts the language to be compiled.
III. The Concept of Levels of Computer Structure
--- --- ------- -- ------ -- -------- ---------
A. Computer science is ultimately concerned with understanding and
designing computer systems: systems of hardware and software which work
together to meet a particular need.
B. Many writers have observed that computer systems (hardware and software)
are the most complex engineering artifacts ever developed by man.
1. In proof of this, note that we are shocked when an engineered system
such as a bridge fails. But we are not surprised when a computer
system fails.
a. Why?
b. We have learned how to build bridges that are reliable. But
computer systems are of such a level of complexity that we still
don't know how to master them.
2. Discovering how to master this complexity is one of the most important
challenges of the discipline of computer science/engineering.
3. One of the key concepts that helps in mastering complexity is the use
of HIERARCHIES OF ABSTRACTION.
a. You have met this concept already in programming. A complex program
is first designed in terms of a series of calls to procedures, each
of which is then, in turn, developed in detail.
b. From a broader perspective, we know that computer users see a
computer system as sophisticated tool to perform a certain task,
such as word-processing. He usually does not care about the details
of how it carries out this task.
c. However, we realize that each software application is realized by
a program consisting of a series of individual statements written
in a language like Pascal or C.
d. At a lower level, each statement is translated by the compiler into
one or more machine instructions, each of which is then executed
by the underlying hardware.
e. The hardware is, in turn, realized from individual integrated
circuits, which are fabricated from silicon, and which rely
utlimately on laws derived from solid state physics.
C. In talking about complex computer systems, then it is desirable to
utilize a hierarchy of levels of abstraction. I will present here a
listing of five levels of abstraction At each level, the underlying layers
work together to present a particular "view" or interface, and the layer
responds to a particular language.
1. The user level: the computer system performs certain tasks in
response to certain commands (e.g. EDIT). To the user, it appears
as if the system "understands" a command language such as the DCL
command language of the VAX, or the keypad commands of EDT, or the
mouse clicks of a graphical interface.
2. The higher-level language programming level: each application is
programmed using the statements of a higher-level language such as
Pascal or C. A single user-level command is thus implemented by
100's or 1000's of statements in a programming language. To
the programmer, it appears as if the system "understands" the
particular higher-level language he or she is programming in.
3. The machine language programming level: as delivered by the
manufacturer, a given computer system has certain primative
components and capabilities:
a. A memory system, capable of storing and retrieving information
in fixed-size units known as "bytes" or "words".
b. An input-output system, capable of transferring information
between memory and some number of devices such as keyboards,
screens, disks etc.
c. A CPU, capable of performing primative operations such as
addition, subtraction, comparison, etc., and also capable of
controlling the other two systems.
i. The CPU is designed to respond to a set of basic machine
language instructions, which is specific to a given type of
CPU. (E.g. the machine language for the VAX is vastly
different from that of the 80x86 used in PC's or the 680x0
used in MacIntoshes.)
ii. The compiler for a higher level language translates that
language into the native machine language of the underlying
machine.
- The same program must be translated into different machine
languages to run on different machines; thus, each type of
machine must have its own set of compilers.
- Regardless of the HLL used, the machine code generated by the
compiler for a given machine will be in the same native
machine language of that machine.
- On the VAX, the .OBJ and .EXE files produced by the compiler
and linker contain machine language binary code.
At this level, it appears that the system "understands" its
machine language.
4. The hardware design level: Ultimately, computer systems are built as
interconnections of hardware devices known as gates, flip-flops, etc.,
combined to form registers and busses. These, in turn, are realized
from primitive electronic building blocks known as transistors,
resistors, capacitors etc. The resultant system is capable of
directly executing the instructions comprising the machine language
of the system.
5. The solid-state physics level: current computers are fabricated from
materials such as silicon that have been chemically "doped" to alter
their electronic properties. Transistors, resistors, and capacitors
are realized by utilizing the properties of these semiconductor
materials. (Of course, future computers may use some other technology
such as optics.)
Summary:
User Level User commands, Application software
-----------------------------------------------------------
HLL Programming level Statements in Pascal, C, etc.
-----------------------------------------------------------
Machine language level Machine language instructions
-----------------------------------------------------------
Hardware design level Gates, flip-flops etc.
-----------------------------------------------------------
Solid-state physics Physical properties of semiconductors
D. We should note that these levels are not fixed and rigid - for example:
1. Some user level software includes a facility that allows advanced
users to write programs - e.g. macros in spreadsheets, DCL command
procedures, etc.
2. Some computers have been built whose machine language is actually
very close to an HLL - e.g. the LISP machine.
3. The partitioning of functions between hardware and machine language
code sometimes varies between different computers in the same
family - e.g. some machines have hardware to perform floating point
arithmetic and others use machine language software for this.
Nonetheless, these levels are helpful tools for understanding computer
systems.
E. Your previous coursework has focused on the first two levels. In
this course and in CS222, we will look at the third and fourth levels,
with occassional glances at the lowest one.
Copyright ©1998 - Russell C. Bjork